When using aspose linq reporting, we insert aspose tag in titles, and insert a table of content. Similarly we do the same for table of figures.
Aspose generates an error saying the table of content has aspose tags. So we have to manually remove aspose tags from table of content. Then generate the report to make it workd.
I dont understand why aspose watch for aspose linq tags in the table of content or table of figures. Is there an option to avoid aspose linq tags in table of content or table of figures ?
To ensure a timely and accurate response, please attach the following resources here for testing:
- Your input Word document.
- Please attach the output Word file that shows the undesired behavior.
- Please attach the expected output Word file that shows the desired behavior.
- Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.
As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.
PS: To attach these resources, please zip and upload them.
AsposeTOC.zip (15.7 KB)
every thing is in the attachment. The application raises an exception because the table of content contains an aspose tag.
as mentionned, here are the different workarounds that we found:
- use ReportBuildOptions.AllowMissingMembers, but i dont want to use it because we miss other errors that are important to raise (if my template contains invalid tags i want to raise error)
- remove manually in the TOC the aspose tag : that works but it would be good that aspose do that automatically.
You are facing the expected behavior of Aspose.Words. You can either use ReportBuildOptions.AllowMissingMembers option or remove the text <<[title.Name]>> from the field codes as shown below. Hope this helps you.
Document doc = new Document("MyTemplate.dotx");
// Create a Reporting Engine.
ReportingEngine engine = new ReportingEngine();
//engine.Options = ReportBuildOptions.AllowMissingMembers;
foreach (Run run in doc.Range.Fields.Start.ParentParagraph.Runs)
if (run.Text.Trim() == "<<[title.Name]>>")
bool isSucess = engine.BuildReport(doc, docData, "Doc");