We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

InsertDocument throws exception of "too many styles"


I use aspose.words 15.12.0 with license. I tried to insert many documents into one document using InsertDocument method and received the exception saying too many styles when I reached certain number of insertion. When I tried 4000 insertions, it worked. It throws exception when I try 5000 insertions. I wonder if I reach the limit of aspose.word, or there’s another way to insert documents and generate huge document. I attach here the code, the two documents for you to try out.

Thank you

Hi Ha,

Thanks for your inquiry. You can avoid this problem by doing the following change in your code:

bld.InsertDocument(indoc, Aspose.Words.ImportFormatMode.KeepDifferentStyles)

Please see the details about ImportFormatMode below:

ImportFormatMode Enumeration

Hope, this helps.

Best regards,