Free Support Forum - aspose.com

Text alignment missing in Doc to HTML conversion

Hi,

We are using licensed version of aspose air. Latest Aspose Words 11.10.0.0 version is used during conversion. Text alignment missing in Doc to HTML conversion for specific case. Following is the the code used during conversion.

Aspose.Words.Saving.SaveOptions
docSaveOptions = new Aspose.Words.Saving.HtmlSaveOptions()<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

{<o:p></o:p>

SaveFormat = Aspose.Words.SaveFormat.Html,<o:p></o:p>

ExportHeadersFootersMode = ExportHeadersFootersMode.PerSection,<o:p></o:p>

ExportPageSetup = true,<o:p></o:p>

ExportRelativeFontSize = true,<o:p></o:p>

PrettyFormat = true,<o:p></o:p>

TableWidthOutputMode = HtmlElementSizeOutputMode.All,<o:p></o:p>

ImageSavingCallback = new HtmlImageExportCallback(),<o:p></o:p>

CssStyleSheetType = CssStyleSheetType.Inline<o:p></o:p>

};<o:p></o:p>

using (Stream
inputBlobStream = dataStoreManager.Read(companyId, relativeDocBlobUri))<o:p></o:p>

{<o:p></o:p>

Aspose.Words.Document
doc = new Aspose.Words.Document(inputBlobStream);<o:p></o:p>

foreach
(Paragraph para in
doc.GetChildNodes(NodeType.Paragraph, true))

para.ParagraphBreakFont.HighlightColor
= Color.Empty;<o:p></o:p>

doc.Save(localStorageHtmlFilePath,
docSaveOptions); //Image File Format conversion<o:p></o:p>

}<o:p></o:p>

Attached is the word document which encounters issue during conversion and screenshot pointing its details.

Thank you!

Abhijeet

Hi Abhijeet,


Thanks for your inquiry. Please note that Aspose.Words tries to mimic the same behavior as MS Word do. The text in your shared document starts with “Quarterly Report …” and “Transition Report Pursuant …” has text alignment as left. Please see the attached image for details.

The output HTML also have same text alignment. Hope this answers your query. Please let us know if you have any more queries.