Free Support Forum - aspose.com

AppendDocument crash with many documents

Hi,


I use method AppendDocument massively and crash when the number of documents is more than 620.

The error is:

InvalidOperationException: There are too many styles in the document.

I use this method with this parameters:

m_oDoc.AppendDocument(oDocAux, Aspose.Words.ImportFormatMode.KeepSourceFormatting)

Thanks for all.

best regards.

Hi

Thanks for your inquiry. The error message clearly describes what the problem is. In MS Word documents number of styles is limited. But when you concatenate multiple documents and use KeepSourceFormating option, all styles from the source document are copied into the destination. If number of documents is quite big, number of styles in the destination document can overflow the limit and in this case you get the error like this.

You can easily resolve the problem by using UseDestinationStyles option when concatenate documents. In this case, only document specific styles will be copied into the destination document.

Best regards,