Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Sep 30, 2026 9:12 am

Product:
Spire.Office for .NET Standard

Version:
10.2.0

License Type:
SITE OEM

Description:

We encountered a NullReferenceException when calling UpdateTableOfContents on a document.

The issue occurs when we generate a document with a large amount of content and then update the table of contents.

We have also upgraded to the latest version, but the issue still occurs.

Exception details:

System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Spire.Doc

StackTrace:
at spr㘚.춷(spr尝 A_0)

Additional Information:

Due to our company's security policy, we are unable to share the source document, document content, or any customer data as attachments.

Please let us know what information would be most helpful for troubleshooting this issue.

Questions:

1. Is there any limitation on document size or the amount of content when using UpdateTableOfContents?
2. Are there any known scenarios that could cause this exception?
3. What information or debugging steps would you recommend so that we can identify the root cause in our code?
4. Since we cannot provide the affected document, could you advise what additional information would help narrow down the root cause?

zhangluyanslb
 
Posts: 1
Joined: Wed Sep 30, 2026 8:54 am

Wed Sep 30, 2026 10:22 am

Hello,

Thank you for reaching out.

There is no document size limitation when using the UpdateTableOfContents method. This NullReferenceException typically occurs when an error is encountered during the content height calculation for pagination.

We recommend that you try removing some of the content to isolate which specific part is causing the issue. Once you have identified the problematic section, please share your findings with us so that we can create a task for further investigation. Thank you for your assistance.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc