Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue May 17, 2016 2:12 am

Hi Guys,

I'm currently using Spire.Doc in combination with a HTML WYSIWYG editor to allow our customers to create letter templates.
Unfortunately, we've found that when converting these HTML templates to Docx files the image alignment is lost.

I've attached an example HTML template with an image that should be right-aligned.

Any help you guys can provide would be very much appreciated :)

rmsdev
 
Posts: 5
Joined: Wed May 20, 2015 1:02 am

Tue May 17, 2016 6:06 am

Hi,

Thanks for your posting.
Please kindly note that the image in word document itself doesn't have alignment property. Its alignment style according to its paragraph's alignment setting. The image in word document should be left alighed because its paragraph is left alighed in html file.
image.png


Please feel free to contact us if you have further inquiry.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Wed May 18, 2016 2:53 am

Hi Amy,

Images in word can be aligned separately to the paragraph by setting the image layout to be floating instead of inline with text (eg behind text or in front of text)
This then allows the horizontal alignment of the image to be set to Left, Center, Right or Other.

How can I replicate this formatting in HTML such that when I convert my HTML to Word it is retained?

I have attached a word document with an example of a right-aligned image in a left-aligned paragraph, please let me know if I can provide any additional information.

Regards,
Tom Clare

rmsdev
 
Posts: 5
Joined: Wed May 20, 2015 1:02 am

Wed May 18, 2016 6:21 am

Hello,

You can change the alignment of the paragraph includes the image to right like as below.
Code: Select all
<p class="Normal--Web-" style=
            "text-align:right;page-break-inside:auto;page-break-after:auto;page-break-before:auto;margin-top:0pt;margin-bottom:0pt;margin-left:0pt;text-indent:0pt;border-top-style: none;border-left-style: none;border-right-style: none;border-bottom-style: none;">
            <img align="right" alt="img0" border="0" height="305" hspace="0"
            src=
            ".."
            style=
            "width:229px;height:305px;margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;float:right;border:0px solid black;"
            vspace="0" width="229"><br>
            <br>
            <span style="font-size:12pt;">&nbsp;</span></p>

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed May 18, 2016 8:22 am

Hi Gary,

I'm sorry for the confusion, but the issue is I need to have left-aligned text with a right-aligned image.
right-aligning the paragraph will cause the text also become right aligned.

This can be done in Word by setting the image format to float and the horizontal alignment to right.
Unfortunately, it seems to be ignoring the HTML equivalent to this (float:right and/or align:right) on the image.

rmsdev
 
Posts: 5
Joined: Wed May 20, 2015 1:02 am

Wed May 18, 2016 8:44 am

Hello,

Ok, I have transferred the issue to our Dev team to investigate further, once it is resolved, or we have some other update for you, we will let you know ASAP.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri Jun 03, 2016 7:46 am

Hello,

The issue has been resolved, and you can download the latest hotfix from the following link and have a try.
http://www.e-iceblue.com/Download/downl ... t-now.html

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Thu Jun 09, 2016 8:22 am

Hi,

Does the new hotfix resolve your issue?
Thanks for your feedback in advance.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc