Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Jan 11, 2011 2:12 am

I need to convert a Word document to HTML. Could Spire.Doc help me?

eternalsummer
 
Posts: 11
Joined: Mon Dec 13, 2010 7:31 am

Thu Jan 13, 2011 2:27 am

Yes, Spire.Doc supports to convert Word to HTML.
Please use
document.SaveToFile("Sample.html", FileFormat.Html);
e-iceblue support
User avatar

iceblue support
 
Posts: 240
Joined: Tue Dec 21, 2010 2:56 am

Wed Nov 27, 2024 7:55 am

iceblue support wrote:Yes, Spire.Doc supports to convert Word to HTML.
Please use
document.SaveToFile("Sample.html", FileFormat.Html);

When I want to use the SaveToFile function in an ubuntu-based docker container, the following problem occurs.
Code: Select all
Unhandled Exception: System.TypeInitializationException: TypeInitialization_Type_NoTypeAvailable
 ---> System.DllNotFoundException: DllNotFound_Linux, libSkiaSharp,
libfontconfig.so.1: cannot open shared object file: No such file or directory
liblibSkiaSharp.so: cannot open shared object file: No such file or directory
libSkiaSharp: cannot open shared object file: No such file or directory
liblibSkiaSharp: cannot open shared object file: No such file or directory

   at System.Runtime.InteropServices.NativeLibrary.LoadLibErrorTracker.Throw(String) + 0x4e
   at Internal.Runtime.CompilerHelpers.InteropHelpers.FixupModuleCell(InteropHelpers.ModuleFixupCell*) + 0x10f
   at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvokeSlow(InteropHelpers.MethodFixupCell*) + 0x35
   at SkiaSharp.SkiaApi.sk_colortype_get_default_8888() + 0x2d
   at SkiaSharp.SKImageInfo..cctor() + 0x2b
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0xb9
   Exception_EndOfInnerExceptionStack
   at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x153
   at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstructionReturnNonGCStaticBase(StaticClassConstructionContext*, IntPtr) + 0x9
   at sprhxg..ctor(Int32, Int32, Single, Single, SKColorType) + 0x5d
   at sprktg.spra() + 0x78
   at sprktg.sprd(Stream) + 0xdc
   at sprlsc.spra(Stream, sprkth) + 0x29f
   at sprksd.spra(ShapeBase, Boolean, sprlsf) + 0x3f9
   at sprksd.spra(ShapeBase, Paragraph) + 0x918
   at sprksd.spre(Paragraph) + 0x6bd
   at sprksd.spra(Section) + 0x6b6
   at sprksd.sprc(Document) + 0x61e
   at sprksd.sprb(Document, String) + 0x101
   at sprksd.sprc(Document, String) + 0x482
   at Spire.Doc.Document.sprn(String) + 0x56
   at Spire.Doc.AOT.NLDocument.Document_SaveToFileFF(IntPtr, IntPtr, Int32) + 0x65

arist.yang
 
Posts: 6
Joined: Wed Nov 27, 2024 7:39 am

Tue Dec 03, 2024 6:45 am

Hello,

We apologize for overlooking your post and regret any inconvenience this may have caused.

For Linux systems, please use our .netstandard DLL. You can install it via NuGet: https://www.nuget.org/packages/Spire.Docfor.NETStandard/12.11.7.

If you have any questions or need further assistance, please do not hesitate to contact us.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Wed Dec 04, 2024 5:08 pm

Hi, I am using spire.doc in the latest version(12.7.1).
I convert using this code docx file to html file.
This is code very good for me except from certain cases.
From some reason part of the files that I convert using this throw the next Error:

Unhandled Exception: System.ArgumentNullException: ArgumentNull_Generic Arg_ParamName_Name, buffer
at SkiaSharp.SKManagedStream.OnReadManagedStream(IntPtr, IntPtr) + 0x180
at SkiaSharp.SKAbstractManagedStream.ReadInternal(IntPtr s, Void* context, Void* buffer, IntPtr size) + 0xbb
at Spire.Doc.Base!<BaseAddress>+0x29119d0

Thanks ahead for any help that I could get. This tool helped me a lot where other tools were't abled to achieve the same success.
My docker file is:


# Stage 1: Install Python dependencies
FROM ubuntu:plucky-20241111 AS requirements-stage
WORKDIR /tmp
RUN apt update && apt install -y python3 && apt install -y python3-pip
RUN python3 -m pip config set global.break-system-packages true
RUN pip install poetry
COPY .env /

COPY pyproject.toml poetry.lock .

RUN poetry export -f requirements.txt --output requirements.txt --without-hashes



# stage 2
FROM ubuntu:plucky-20241111
RUN apt update && apt install -y python3\
python3-pip\
cron\
libfontconfig1 \
libfreetype6 \
libx11-6 \
libxext6 \
libxrender1 \
libssl-dev \
curl

WORKDIR code

COPY --from=requirements-stage /tmp/requirements.txt requirements.txt
RUN python3 -m pip config set global.break-system-packages true
RUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY . /code

RUN chmod 0774 /code/main.py
# Copy run-main file to the cron.d directory
COPY run-main /etc/cron.d/run-main

# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/run-main

# Apply cron job
RUN crontab /etc/cron.d/run-main

# Create the log file to be able to run tail
RUN touch /var/log/cron.log
EXPOSE 5000
ENV PYTHONPATH "${PYTHONPATH}:/code/"
# Run the command on container startup
CMD python3 simple_listener.py & cron && tail -f /var/log/cron.log

liadmateless
 
Posts: 2
Joined: Wed Dec 04, 2024 4:37 pm

Thu Dec 05, 2024 6:04 am

Hello,

Thank you for evaluating our Spire.Doc for Python product.

Regarding the error you encountered, does this issue occur with all documents or only with specific ones? If it's specific to certain documents, please provide those Word files so we can reproduce and investigate the issue.

Please note that ensuring the successful installation of libfontconfig1 using the command "apt-get install -y libfontconfig1" is crucial on Ubuntu.

Additionally, I would like to confirm the following information:
1. In your docker file, I did not find the installation instructions for our product: "pip install Spire.Doc" or "pip install Spire.Doc-12.7.1-py3-
none-manylinux1_x86_64.whl". Could you please clarify whether you are running the Spire.Doc installation command inside the Docker
container after its creation?
2. What architecture your current system is based on? 64-bit PC (AMD64) or 64-bit ARM?
As a friendly reminder, our Python products currently do not support systems based on the ARM architecture, although we plan to add
support for it in the future.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Thu Dec 05, 2024 9:03 am

Hi, thanks for the quick response. I am using amd.
I also installed poetry using pip.
Adding the file in the mail

liadmateless
 
Posts: 2
Joined: Wed Dec 04, 2024 4:37 pm

Thu Dec 05, 2024 9:11 am

Well. Thank you for your reply. I'll look in your email for more information.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Thu Dec 05, 2024 9:19 am

Hello,

The file you attached in your email is an HTML document. From your code, it appears you are working on functionality to convert a Word document to an HTML document. It seems like you might have shared the wrong document. Could you please provide the input Word document? This would help me test and reproduce the error you're encountering.

Thank you for your further assistance.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Thu Dec 05, 2024 9:50 am

Hello,

I have received your Word document from your new email. Thanks for your assistance.
I have reproduced the issue you encountered with your html.docx file and have logged it into our issue system with the tracking number SPIREDOC-10996.

We apologize for any inconvenience caused and will keep you updated on the progress of the issue.


Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Wed Apr 30, 2025 11:50 am

Hello,

Thanks for your patience.
We just released the latest Spire.Doc for Python Version:13.4.6 which fixes issue SPIREDOC-10996 . Welcome to update and test.
WebSite Link:https://www.e-iceblue.com/Download/Spire-Doc-Python.html

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 732
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.Doc