Left Absolute Positioning Property Added to SPAN when Converting DOCX to HTML Fixed using Java | Froala Editor

I Converted a .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.setDmlEffectsRenderingMode(2);
options.setDmlRenderingMode(1);
options.setDefaultTemplate("");
options.setFontFormat(ExportFontFormat.WOFF);

    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?

@maheswararao44,

Please ZIP and upload your input Word document and Aspose.Words generated HTML Fixed format file showing the undesired behavior here for testing. We will then investigate the issue on our end and provide you more information.

@awais.hafeez thankyou for reply. Here are the files. test.zip (20.3 KB)
test-html.zip (59.5 KB)

@maheswararao44,

We have converted your Word document to HTML Fixed file format by using the code you provide and using the latest version of Aspose.Words for Java i.e. 20.4 and attached it here for your reference:

We do not see any issue when viewing this file with Web Browsers such as Google Chrome, Firefox on our end. We suggest you please upgrade to the latest (20.4) version of Aspose.Words for Java and see how it goes? In case the problem still remains, please also provide a comparison screenshot highlighting the problematic area in above HTML here for further testing. Thanks for your cooperation.

@awais.hafeez
Hi, i copied the fixed html script you generated and pasted in an html editor as shown in the below image ‘capture 1’.

then i tried to add some extra content at the starting line of the letter body, then you can see the overlapping text in 'capture 2’captures.zip (601.4 KB)

@maheswararao44,

If you want to write new content/text in that particular place of Aspose.Words’ generated HTML Fixed file format, then please find and write in the following span area. Hope, this helps.

<span class="awspan awtext002" style="font-size: 10.5pt; left: 0pt; top: 0.34pt;">We received your request for </span>

@awais.hafeez
Thankyou, But i can not do that.
i am using an editor named froala which is reading this html script as input and displaying html output and enables me to edit the content without touching script. i hope you understood this. that’s my requirement. thanks for your support.

@maheswararao44,

Thanks for the additional information. We have logged this problem in our issue tracking system. Your ticket number is WORDSNET-20312 . We will further look into the details of this problem and will keep you updated on the status of the linked issue. Sorry for the inconvenience.

@maheswararao44,

Regarding WORDSNET-20312, it is to update you that we have completed the work on this issue and concluded to close this issue with “Not a Bug” status. Please see the following analysis details:

Aspose.Words exports text runs to HTML spans with the Left property.

<div>
    <span style="left:398.02pt;">Tampa, FL</span>
    <span style="left:447.96pt;">33607</span>
</div>

It means that span of text has the absolute positioning inside the parent DIV. So, if we add the text to the first span content, then it will overlap the second span.

So, you should use flow-format HTML instead of HtmlFixed. The HtmlFixed format is not suited for editing because changed text won’t re-flow correctly.