0
votes

The document body is hardcoded and then inserted into a template document with contains cover, summary, headers and styles. Heading styles are numbered 1, 1.1, 1.2, and so on. But to insert a heading just with 'Heading [n]' style does not work, numbering is lost. I think this happens because numbering is set through a multilevel list with headings attached.

Question: is it possible to use a document as a template without coding any formatting, or it is inevitable to deal with list styles in the code?

1

1 Answers

0
votes

Yes, you can use a document as a template without any formatting. Please note that when you copy nodes from one document to another, this option specifies how formatting is resolved when both documents have a style with the same name, but different formatting.

The formatting is resolved as follows:

  • Built-in styles are matched using their locale independent style identifier. User defined styles are matched using case-sensitive style name.
  • If a matching style is not found in the destination document, the style (and all styles referenced by it) are copied into the destination document and the imported nodes are updated to reference the new style.
  • If a matching style already exists in the destination document, what happens depends on the importFormatMode parameter passed to Document.ImportNode as described below.

When using the UseDestinationStyles option, if a matching style already exists in the destination document, the style is not copied and the imported nodes are updated to reference the existing style.

So, in your case, I suggest you please use UseDestinationStyles option while inserting one document into another.

I work with Aspose as Developer Evangelist.