Insert HTML- preserve style

Good day again-

I am inserting HTML into a document using the procedure you have previously discussed on this forum, to preserve style information.

Please note the attached document, bookmark.docx.

In it, there is a paragraph style called PictureCaption. The style is set up to have several characteristics: it is orange text, 8 point font, and (for demonstration purposes), has After: 120pt as the paragraph spacing.

We are inserting the following HTML:



.PictureCaption{}


Picture Caption





Note that we wish the paragraph to have the PictureCaption style.

We then create a document and insert the nodes of the temp document:

<cfset docBuilder.moveToBookmark(“bookmark”)>
<cfset bytestream=createObject(“java”,“java.io.ByteArrayInputStream”).init(toBinary(toBase64(myhtml)))>
<cfset tempDoc=createObject(“java”,“com.aspose.words.Document”).init(bytestream)>
<cfset ni=createObject(“java”,“com.aspose.words.NodeImporter”).init(tempDoc,doc,importFormatMode.USE_DESTINATION_STYLES)>







<cfset cnode.getParentNode().insertAfter(importNode,cnode)>



<cfset doc.save(outputFile)>

Running this test, we create the attached output file, bookmarkOut.docx.

Note that the inserted text appears almost correctly - It shows up as having PictureCaption style, it is orange, and it is the proper font size. But, the spacing after has not been preserved.

If you use Word to “re-apply” the PictureCaption style, you can see the spacing appear after the paragraph.

So it appears that inserting this node does not preserve the Spacing: after characteristic. Do you have any suggestions?

Thank you.
Hi Chris,

Thanks for your inquiry. I have tested the scenario and have managed to reproduce the same problem on my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-8284. Our development team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

The issues you have found earlier (filed as WORDSNET-8284) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.