We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Object null reference error while loading a docx file from stream

I can download and open my docx file but can't preview it from browser. I can't find what's wrong. Any help would be much appreciated.

I attached my docx file

Here is where I get the error:

WordDocument doc = WordDocument.Load(stream, FormatType.Docx);

And here is the stack trace:

   at Syncfusion.DocIO.DLS.Convertors.DocxParser.ParseStyleProperties(XmlReader reader, Style style, Dictionary`2 linkStyleNamesReferByCharacterStyle, List`1 paraLinkStyleIndex, String& styleNameId, String localName)
   at Syncfusion.DocIO.DLS.Convertors.DocxParser.ParseStyle(XmlReader reader, Dictionary`2 linkStyleNamesReferByCharacterStyle, List`1 paraLinkStyleIndex)
   at Syncfusion.DocIO.DLS.Convertors.DocxParser.ParseStyles(XmlReader reader)
   at Syncfusion.DocIO.DLS.Convertors.DocxParser.ParseDocument(Package wordPackage)
   at Syncfusion.DocIO.DLS.Convertors.DocxParser.Read(WordDocument document, Boolean isFlatOPC)
   at Syncfusion.DocIO.DLS.Convertors.DocxParser.Read(Stream docStream, WordDocument document)
   at Syncfusion.DocIO.DLS.WordDocument.OpenDocx(Stream stream)
   at Syncfusion.DocIO.DLS.WordDocument.OpenInternal(Stream stream, FormatType formatType, String password)
   at Syncfusion.DocIO.DLS.WordDocument.OpenInternal(Stream stream, FormatType formatType, XHTMLValidationType validationType)

Attachment: report_(19)_e06df00e.zip

4 Replies

AA Akash Arul Syncfusion Team October 14, 2022 04:44 AM

Hi K,

We have reproduced the reported problem with “NullReferenceException is thrown while loading a document” in our end, and we suspect it to be a defect. We will validate this issue and update you with more details on 18th October 2022.

Akash A

K K October 14, 2022 09:11 AM

OK. Thank you.

AA Akash Arul Syncfusion Team October 18, 2022 06:05 AM

Hi K,

We have confirmed that the reported issue NullReferenceException is thrown while opening a DOCX format document” is a defect and we have logged a defect report. We will include the fix for this defect in our weekly NuGet release which is estimated to be available on 01st November 2022.

The status of this bug can be tracked through the below link:

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”

Akash A

AA Akash Arul Syncfusion Team November 9, 2022 02:42 AM

We have included the reported issue with “NullReferenceException is thrown while opening a DOCX format document” in our 2022 Volume 3 Service Pack Release. We are glad to announce that our Essential Studio 2022 Volume 3 Service Pack Release V20.3.0.56 is rolled out and is available for download under the following link.


The status of the issue can be tracked through below feedback link.

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you require any further assistance.

Live Chat Icon For mobile
Up arrow icon