I am trying to open an HTML document and then save it as a PDF or DOC. I am getting strange formatting in the result. I will admit, my source HTML (that I do not have control of) is doing some things in a weird way.
Essentially, there is a logo and an address that are supposed to be on the same line in the document. After saving to PDF or DOC, the address is pushed to the next line down. I have tested the length of the address and the size of the logo image, changes to these make no difference. Attached is a screen shot of what I would consider “correct”, as well as a screen shot of the “wrong” formatting. Here is the code I am running:
Document _doc = new Document("d:\header.html");
Is there a solution to the formatting problem?
Thank you for your request.
It’s a known issue that align attribute on <img> node is not supported. We’ll notify you when it is fixed.
There is nothing weird since this attribute makes the image float:
Image and text are in two different paragraphs but font size is much smaller than image height. That’s why we see image and text on the same level. I’m afraid that’s difficult to build a programmatic workaround for this case. If you had control over the source files you would be able to fix this manually. Sorry for inconvenience.
Is there any solution for applying a float-like style to images embedded using the .InsertHtml command?
I’ve tried running the following to assign WrapText and alignment properties to all the images (I actually limit it to the sections in added with InsertHtml, but for simplicity…)
Dim shapes As NodeCollection = doc.GetChildNodes(NodeType.Shape, True, False)
Dim imageIndex As Integer = 0
For Each shape As Aspose.Words.Drawing.Shape In shapes
shape.WrapSide = Drawing.WrapSide.Largest
shape.WrapType = Drawing.WrapType.Tight
It helps, but seems to ruin the margins as applied to the content section that the images are part of.
Otherwise, you mentioned it might be possible to address the issue if one had access to the source code? Is the source code included with the license? Can you provide instructions as to how that might be accomplished?
Thank you for your experiments.
Currently there is no way to apply floating styles to images in HTML export. Maybe I would have written this in my first reply but your first question didn’t concern them directly. We’ll notify you when the feature is implemented.
I don’t mean the source code of the library. I expect that if you had control over the source documents we would find a workaround for you.
The issues you have found earlier (filed as WORDSNET-1570) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.