Good day -
We are using a Word template and manipulating it with Aspose.Words.
Attached is the template (testSpaceBefore.docx)
Note that there is bookmark at the text “.” The text is set to the Normal style, and the Normal style has a Spacing Before value of 12pt.
We then generate the following HTML to insert at the “” text:
.Normal{}
-
Here is a test bullet
-
Here is another test bullet
We use the following code to insert the HTML into the document at the bookmark location:
<cfif templateDocBuilder.moveToBookmark("options")>
<cfset charset=createObject("java","java.nio.charset.Charset")>
<cfset charset=charset.forName("UTF-8")>
<cfset loadOptions=createObject("java","com.aspose.words.LoadOptions").init()>
<cfset loadOptions.setEncoding(charset)>
<cfset bytestream=createObject("java","java.io.ByteArrayInputStream").init(toBinary(toBase64(testHTMLContent)))>
<cfset tempDoc=createObject("java","com.aspose.words.Document").init(bytestream,loadOptions)>
<cfset ni=createObject("java","com.aspose.words.NodeImporter").init(tempDoc,doc,importFormatMode.USE_DESTINATION_STYLES)>
<cfset cnode.getParentNode().insertAfter(importNode,cnode)>
Note that the NodeImporter is set to USE_DESTINATION_STYLES. We would expect that the inserted HTML would insert the paragraphs as Normal style, and that the Normal style properties are unaffected.
The output document is attached (testSpaceBefore_After.docx). The text is inserted; however, two things have happened:
- The inserted text is defined as Normal_0, which I think should not have happened, since we indicated to USE_DESTINATION_STYLES.
- The document’s Normal style no longer has a property of Space Before: 12pt. It is now at 0pt. The insertion seems to have changed the original Normal style, but not applied it.
We are using aspose 15.7.0. Please advise. Thank you.