Reputation: 61
I Converted .docx file into .html using HtmlFixedSaveOptions in aspose words. Then i opened that html in an html editor(froala editor) and tried to add some text in that file. then text is overlapping in html file. I tried to use HtmlSaveOptions to convert earlier but i faced alignment problem. and here’s the code snippet i used to convert doc to html.
com.aspose.words.HtmlFixedSaveOptions options = new com.aspose.words.HtmlFixedSaveOptions();
options.setSaveFormat(SaveFormat.HTML_FIXED);
options.setEncoding(Charset.defaultCharset());
options.setExportEmbeddedFonts(true);
options.setExportEmbeddedCss(true);
options.setExportEmbeddedImages(true);
options.setExportEmbeddedSvg(true);
options.setExportFormFields(true);
options.setPrettyFormat(true);
options.setUseHighQualityRendering(true);
options.setJpegQuality(90);
options.setPageCount(Integer.MAX_VALUE);
options.setPageMargins(10);
options.setShowPageBorder(false);
options.setDmlEffectsRenderingMode(2);
options.setDmlRenderingMode(1);
options.setDefaultTemplate("");
options.setFontFormat(ExportFontFormat.WOFF);
options.setOptimizeOutput(true);
String outHtmlFile = htmlPath + "test-html" + ".html";
doc.save(outHtmlFile, options);
So, is there any way to convert .docx to html with preserving alignment and feasibility to edit the content in html without overlapping text?
Upvotes: 0
Views: 531
Reputation: 31
Aspose.Words supports two HTML save options: HtmlFixed and HtmlFlow. The HtmlFixed format preserves the original document page layout (similar to images or Pdf documents). With this format, the text will not re-flow when the window is resized. As a result, the text overlaps in the Html file when you add more content in the document. In contrast, the HtmlFlow format enables you to edit the document. If you need an editable Html document, it is better to use SaveFormat.html. For more details on Flow-Layout or Fixed-Layout Document Formats in Aspose.Words, see: https://docs.aspose.com/display/wordsjava/Rendering https://apireference.aspose.com/words/java/com.aspose.words/SaveFormat
Upvotes: 3