After installing Aspose.words 9.0, I modified the the code displayed in the following post : https://reference.aspose.com/words/net/aspose.words/documentbuilder/inserttableofcontents/ to update the fields prior to saving the document as follows:
builder.UpdateFields();
builder.UpdatePageLayout();
and received the following error:
{"Exception of type 'System.OutOfMemoryException' was thrown."}
[System.OutOfMemoryException]: {"Exception of type 'System.OutOfMemoryException' was thrown."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: null
Message: "Exception of type 'System.OutOfMemoryException' was thrown."
Source: "Aspose.Words"
StackTrace: " at ..()\r\n at ..Clone()\r\n at Aspose.Words.Inline.Clone(Boolean isCloneChildren)\r\n at ..( )\r\n at ..()\r\n at ..()\r\n at ..OnChildNode()\r\n at ..()\r\n at ..( , Node , )\r\n at ..()\r\n at Aspose.Words.Fields.Field.( )\r\n at Aspose.Words.Fields.Field.Update()\r\n at Aspose.Words.Range.UpdateFields()\r\n at Aspose.Words.Document.UpdateFields()\r\n at SandBox_WindowsApp.AsposeTesting.TableOfContents.BuildAsposeTOC() in C:\\DEV\\SandBox\\WindowsApp_SandBox\\AsposeTesting\\TableOfContents.cs:line 72"
TargetSite: {. ()}
when that didn’t work, i also tried saving the doc and re-opening, updating and saving again… with the same result. Any ideas?
Thanks, mlb