Tab indent not working in latest version 24.4.0

when word to html conversion is done tab indent is not match exact space as word doc so alignment is getting affected. please refer the img.

@ansaridurai Could you please attach your input and output documents here for our reference? We will check the issue and provide you more information. Unfortunately, it is impossible to analyze the problem using screenshots.

@alexey.noskov Sure please refer attached word input doc,word app html output, aspose html output and source code.
wordToHTMLfiles.zip (23.2 KB)

C# code :

Aspose.Words.Document doc = new Aspose.Words.Document(@"C:\ANSARI\Project sample File\" + "Use of our report.docx");         
// Save output HTML
doc.Save(dataDir + "output.html");

@ansaridurai Thank you for additional information. MS Word 2019 on my side also produces the result similar to Aspose.Words:
MS Word 2019 save as Web page: ms.zip (7.0 KB)
MS Word 2019 save as Web page filtered: ms_filtered.zip (2.3 KB)
Aspose.Words: out.zip (2.1 KB)

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.

out_html_fixed.zip (47.9 KB)

Thanks alexey for your suggestions, Iā€™m using MS Word 2013 text are aligned correctly when save as web page. Aspose word to HTML not converting with exact space which is in word doc.

Also HTMLFixed format output as text alignment are good but page format is not like word doc can I change the page format. we have option for remove the border too, please give me hand for same page margin as in document so the html output look same as word document.

@ansaridurai Please note, Aspose.Words is designed to work with MS Word documents. HTML documents and MS Word documents object models are quite different and it is not always possible to provide 100% fidelity after conversion one format to another. In most cases Aspose.Words mimics MS Word behavior when work with HTML documents. And as I have mentioned the output HTML produced by MS Word 2019 looks similar to HTML produced by Aspose.Words.

The produced HtmlFixed document looks exactly as it looks in MS Word. Here is PDF document produced by MS Word on my side: ms.pdf (14.6 KB). As you can see it looks exactly the same as the produced HtmlFixed.

thanks for the explantion, HTMLFixed format is same as ms word document but we have only three option for page alignmnet(PageHorizontalAlignment) center as default, then left and right. so the page fomat is not look same as word docuement.
Refer the image of HTML output in both Htmlfixed format and html format, use can see that page fomat is not same.

@ansaridurai When the document is converted to HtmlFixed format, Aspose.Words builds the document layout and renders the document the same way as it look in MS Word in page layout mode. So this is an expected behavior.

@alexey.noskov thanks for the information.

1 Like