Aspose.Words: Insert a lot of documents into another

Hello,

I use the method InserDocument described here to insert documents into another. This method works correctly except when I have a lot of documents to insert, then I have an exception: “There are too many styles in the document.”
What can I do to fix this problem for my insertions?

Best reagards.

Hi Jacques,

Thanks for your inquiry.
MS Word limit is 4079 styles. I will suggest you for reducing number of styles in the document. Please let me know if you would like to know something else.

Follow up the link for more details:
https://learn.microsoft.com/en-US/office/troubleshoot/word/operating-parameter-limitation

As I already mentioned this is not restriction of Aspose.Words, this is restriction of MS Word formats.

Hi there,

Thanks for your inquiry.

If it’s appropriate, you can avoid this issue by using ImportFormatMode.UseDestinationStyles instead of ImportFormatMode.KeepSourceFormatting in the InsertDocument method. This will copy content over to the base document and format using the styles already inside the base document.

Thanks,

Thank you for your answer I think I will be able to fix my problem this way.

Best regards.