I have several document templates that I am using to generate a complete document packet. Each document is generated separately and then added to the packet using doc.appendDocument()
Each document has a heading style of 7, and it is critical that I keep this style intact for other functions of the document to correctly work. The issue I am having is that after the documents are merged, the headings change to style 7_section. For example, my first style 7 heading becomes 7_1, the heading in the 4th section becomes 7_4 and so on. I need them to remain and just style 7. I cannot figure out how Aspose is creating new styles as it generates the document.
Hi David,
Thanks for your inquiry.
When you use ImportFormatMode.KeepSourceFormatting during appending documents, styles having the same name are duplicated into the destination document. For example, if your source and destination documents have the same style ‘MyStyle’, then there will be two styles named ‘MyStyle’ and ‘MyStyle_0’ in the destination document. This is alright when you have a few documents to join. I think, in case the formatting in your documents looks almost identical, you can use ImportFormatMode.UseDestinationStyles instead (styles will not be duplicated in this case). There shouldn’t be any problem with formatting when the documents are joined.
Please let me know if I can be of any further assistance.
Best Regards,