Image alignment issue while converting html to docx using aspose.words java

there is image alignment issue while converting html to docx using aspose.words in java .

Version : 22.11
plat form: java
HTML file and converted docx file enclosed here : html.zip (8.4 KB)

Problem is image not align middle with line text. HTML code working properly on browser. converted word its aligned at bottom of line height. .

HTML Screen short :

Docx Screen short :

Code :

Document convDoc;
try {
    convDoc = new Document(htmlFile.getAbsolutePath());
    convDoc.save( new FileOutputStream(docxfile), SaveFormat.DOCX);
} catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

Please help us to resolve this issue.

From
Nitin Chopkar

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-24835

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.

@nitinchopkar Thank you for reporting the problem to us. For a sake of correction it has been logged as WORDSNET-24835. We will keep you informed and let you know once it is resolved.
The current Aspose.Words behavior matches MS Word behavior. MS Word also ignores value of margin-bottom is images in your HTML document: ms.docx (12.5 KB)

@nitinchopkar We have completed analyzing the issue. The technique used to align images in the source document (display:inline-block , fixed height, and negative margin-bottom ) is non-standard and we’re not going to add support for it. The standard way to align inline images in CSS is by using the vertical-align property: https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align#vertical_alignment_in_a_line_box
And it is supported by Aspose.Words already as illustrated by attached documents in.zip (355 Bytes)
and out.docx (8.8 KB)

thanks its working for us.

1 Like

The issues you have found earlier (filed as WORDSNET-24835) have been fixed in this Aspose.Words for Java 23.2 update.