Why VSTO Returns DocumentImpl for a Word Document
Question details
The user wants to understand why a VSTO Word document has a DocumentImpl runtime type when its variable is declared as Document.

- Product
- Microsoft Visual Studio Tools for Office (VSTO) for Word
- Device & OS
- not provided
- Scenario
- A developer uses GetVstoObject to obtain a VSTO document object for a Word document.
- Observed behavior
- The returned object's runtime type is Microsoft.Office.Tools.Word.DocumentImpl, while the variable is declared as Microsoft.Office.Tools.Word.Document.
Check the declared type of the variable and the runtime type shown in the Visual Studio debugger. Distinguish Microsoft.Office.Tools.Word.Document from the native Microsoft.Office.Interop.Word.Document type.
Use the public VSTO Document interface
Use this approach when GetVstoObject returns DocumentImpl at runtime; the internal implementation type is expected.
DocumentImpl is an internal implementation of the public Microsoft.Office.Tools.Word.Document interface. The runtime type can differ from the variable's declared type without indicating an error.
In your VSTO project, inspect the variable receiving the result of GetVstoObject and declare it as Microsoft.Office.Tools.Word.Document.
Access the document through the members exposed by Microsoft.Office.Tools.Word.Document instead of referencing or casting to DocumentImpl.
If needed, inspect the object in the Visual Studio debugger or call GetType() on it. Seeing DocumentImpl is expected and does not require a fix.

Edit Word documents with WPS Writer
WPS Office is a free, lightweight alternative for everyday document work, with a familiar interface and Microsoft Office format compatibility that makes moving documents straightforward. It does not fix VSTO runtime behavior.

Frequently Asked Questions
Is DocumentImpl an error when using GetVstoObject?
No. GetVstoObject can return a DocumentImpl instance that implements the public Microsoft.Office.Tools.Word.Document interface.
Should I cast the returned object to DocumentImpl?
No. Declare and use the object as Microsoft.Office.Tools.Word.Document and access its public members. DocumentImpl is an internal implementation class.
How can I see the object's actual runtime type?
Inspect the object in the Visual Studio debugger or call GetType() on it. Its runtime type may be DocumentImpl even when its declared type is Document.
Is the VSTO Document the same as the Word Interop Document?
No. Microsoft.Office.Tools.Word.Document is the VSTO document interface, while Microsoft.Office.Interop.Word.Document represents the native Word Interop document. Check the fully qualified type in your code.




