I am trying to create a large document with Aspose.Words, and I keep getting an InvalidOperationException with the description “There are too many styles in the document.” My code is too long to post here, but basically the process is:
- I have a collection of HTML files to append to a master Document.
- For each HTML file, I create a temp Document. Each file may contain multiple sections, a mixture of text sections and table sections.
- I do some various cleanup, and set some background colors on table cells in the temp document.
- I append the temp document to the master Document. I have tried both Document.AppendDocument and NodeImporter to do this.
- Repeat steps 2-4 for each HTML document.
I have followed the suggestions in the following threads:
Large Scale Documents
I still get the too many styles Exception, regardless of using UseDestinationStyles, or the NodeImporter process. Any suggestions? Is there some way I can directly control the styles added to my document, so they are reused, rather than creating a new one for each style I want to apply to each table cell?