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:
Note that we wish the paragraph to have the PictureCaption style.
.PictureCaption{}
Picture Caption
We then create a document and insert the nodes of the temp document:
<cfset docBuilder.moveToBookmark(“bookmark”)>Running this test, we create the attached output file, bookmarkOut.docx.
<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)>
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.