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.

Thu Apr 04, 2024 10:35 am

Hi!

I was trying to convert word (docx) file into html. But after conversion nembering of paragraphs are not matching with TOC. The TOC numbering is starting with 3.1. but after converting TOC is intact but pargraph numbering is starting from 1.1 instead of 3.1.

Image

apalchaudhry
 
Posts: 3
Joined: Thu Apr 04, 2024 10:13 am

Fri Apr 05, 2024 3:53 am

Hi,

Thanks for your inquiry.
To help us investigate accurately your issue, please offer the code that can reproduce your issue and the input word file and output Html file, you can send them via email([email protected]) or attach here. Thanks in advance.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Fri Apr 05, 2024 4:18 am

public static string DocReader1(Stream stream)
{
//Create a Document object
FreeWord.Document doc = new FreeWord.Document();

//Load a Word document
stream.Position = 0;
doc.LoadFromStream(stream, FreeWord.FileFormat.Docx, FreeWord.Documents.XHTMLValidationType.None);

//Embed images in generated HTML file
doc.HtmlExportOptions.ImageEmbedded = true;

string htmlString = string.Empty;
//Save to HTML
using (MemoryStream ms = new MemoryStream())
{
doc.SaveToStream(ms, FreeWord.FileFormat.Html);

ms.Position = 0;
using (StreamReader reader = new StreamReader(ms, Encoding.UTF8))
{
htmlString = reader.ReadToEnd();
}
}
doc.Dispose();

return htmlString;
}

apalchaudhry
 
Posts: 3
Joined: Thu Apr 04, 2024 10:13 am

Fri Apr 05, 2024 8:54 am

Hi,

Thanks for your feedback.
Why does “FreeWord” exists before the Document object in your code? Are you sure using Spire.Doc for Net? Due to there should be “Spire.Doc” exist before Document object?

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Tue Apr 09, 2024 5:43 am

Hi!

I was trying free version of Spire for testing before purchase. To purchase, we need to test any new library whethere it will fit withour all requerements or not.

using FreeWord = Spire.Doc; // In code it's mentioned to identify it as a free library

apalchaudhry
 
Posts: 3
Joined: Thu Apr 04, 2024 10:13 am

Tue Apr 09, 2024 6:50 am

Hi,

Thanks for your feedback.
I get what you means, and I reproduced this issue. I have logged it into our bug
tracking system with the ticket id SPIREDOC-10426. Our Dev team will to investigate and fix it. Once it is resolved. I’ll inform you in time. Sorry for the inconvenience caused.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.Doc