Others

Why VSTO Returns DocumentImpl for a Word Document

Anum MushtaqAnum Mushtaq Nov 25, 2026 868 views

Question details

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

Why VSTO Returns DocumentImpl for a Word 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.
Before you start

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.

Solution 1Recommended

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.

1
Check the declared type

In your VSTO project, inspect the variable receiving the result of GetVstoObject and declare it as Microsoft.Office.Tools.Word.Document.

2
Use the public API

Access the document through the members exposed by Microsoft.Office.Tools.Word.Document instead of referencing or casting to DocumentImpl.

3
Verify the runtime type

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.

Use the public VSTO Document interface
Avoid implementation-specific checks: Do not rely on the internal class name DocumentImpl in application logic. Program against the public Document interface instead.
Free Microsoft Office alternative

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.

Open and edit Word documents in a familiar interfaceCompatible with Microsoft Word DOC and DOCX formatsFree tools for everyday document creationLightweight alternative for working with Office files
microsoft office alternative - wps office

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.