Misalignment of Index Table Numbers

Hii team,
I am experiencing an issue while converting a DOCX document to HTML. The alignment of the index table numbers in the HTML output does not match the alignment in the original Word document. Could you please provide insight into why this issue is occurring and how it can be resolved?

Snippet :

Aspose.Words.Saving.HtmlSaveOptions options = new Aspose.Words.Saving.HtmlSaveOptions(Aspose.Words.SaveFormat.Html)
{
    ExportImagesAsBase64 = true,
    ExportXhtmlTransitional = true,
    Encoding = System.Text.Encoding.UTF8,
    ExportHeadersFootersMode = Aspose.Words.Saving.ExportHeadersFootersMode.PerSection,
    ExportPageMargins = true,
    ExportPageSetup = true,
    UseHighQualityRendering = true,
    //ExportFontResources = true,
    //ExportFontsAsBase64 = true,
    //options.ExportRelativeFontSize = true,
    ResolveFontNames = true,
    AllowEmbeddingPostScriptFonts = true,
    PrettyFormat = true,
    SaveFormat = SaveFormat.Html,
    ExportTocPageNumbers = true,
    //ExportDocumentProperties = true,
    CssStyleSheetType = CssStyleSheetType.Inline
};

var wordloadoption = new Aspose.Words.Loading.LoadOptions() { LoadFormat = LoadFormat.Docx };
Aspose.Words.Document doc = new Aspose.Words.Document(@"D:\Temp\FormattingIssue\Sample1.docx", wordloadoption);
doc.Cleanup();
doc.WebExtensionTaskPanes.Clear();
doc.RemoveExternalSchemaReferences();
doc.RemoveMacros();

doc.Save(@"D:\Temp\FormattingIssue\Sample1.html", options);

Output:
Sample1.zip (8.2 KB)

Source Document :
Sample1.docx (130.7 KB)

@AlpeshChaudhariDev
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-27344

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

You should note that Aspose.Words is designed to work with MS Word documents. MS Word and HTML documents are quite different and it is not possible to provide 100% fidelity after conversion one format to another.

If the output HTML is for viewing purposes, i.e. it is not supposed to be edited or processed, you can consider using HtmlFixed format. In this case the output should look exactly the same as it looks in MS Word:

Document doc = new Document(@"C:\Temp\in.docx");

HtmlFixedSaveOptions opt = new HtmlFixedSaveOptions();
opt.ExportEmbeddedCss = true;
opt.ExportEmbeddedFonts = true;
opt.ExportEmbeddedImages = true;
opt.ExportEmbeddedSvg = true;

doc.Save(@"C:\Temp\out_html_fixed.html", opt);

HtmlFixed format is designed to preserve original document layout for viewing purposes. So if your goal is to display the HTML on page, then this format can be considered as an alternative.

1 Like

@AlpeshChaudhariDev We have completed analyzing the issue and concluded this is not a bug. Apparently, the font that is used in the document is not available on all machines.
Please, try saving the document with fonts by specifying HtmlSaveOptions.ExportFontResources = true.

1 Like

Thank you, I understand your point.

1 Like

The issues you have found earlier (filed as WORDSNET-27344) have been fixed in this Aspose.Words for .NET 24.10 update also available on NuGet.