Check route.docx from the zip for missing alt text (image descriptions).
dotnet add package RecursiveAI.OneDocument.DocumentsRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
using RecursiveAI.OneDocument.Documents; using var doc = Document.Open("route.docx"); var report = doc.CheckAccessibility(); foreach (var issue in report.ForRule( "alt-text.missing")) { Console.WriteLine(issue.ObjectName); Console.WriteLine(issue.Location.Description); }
Prints:
Picture 1 body, paragraph 3, run 1
Unzip the example, then dotnet run.
The checker also looks at table headers, heading structure, link text, and some text contrast cases. report.Issues lists all findings, not just missing alt text.
The full program
The sample contains the heading “Route map” and a blue path from Depot to Park, with no alt text. The download prints the rule ID alongside the picture name. Use the paragraph and run (a piece of content within a paragraph) to locate the picture, especially when several pictures have generic names.
using RecursiveAI.OneDocument.Documents; using var doc = Document.Open("route.docx"); var report = doc.CheckAccessibility(); foreach (var issue in report.ForRule("alt-text.missing")) { Console.WriteLine($"{issue.RuleId}: {issue.ObjectName}"); Console.WriteLine(issue.Location.Description); }
dotnet run prints:
alt-text.missing: Picture 1 body, paragraph 3, run 1
The check reads the document and doesn’t edit it. If the main XML part is damaged, the check can raise OfficeFormatException instead of returning findings.
Variations
Read the suggested fix. In the snippet at the top, replace the two Console.WriteLine calls inside the loop with:
Console.WriteLine(issue.Suggestion);Describe what the picture shows or says, or mark it as decorative if it adds no information.Related recipes
The short answer
Use Document.CheckAccessibility() to check a Word DOCX in C#. Filter the report with ForRule("alt-text.missing") to find images without alt text. Each finding identifies the object by name when available and reports its location in the document. No Word installation or automation is required.
How do I check a Word document for accessibility issues?
Each issue has a category and a suggested action. The Word location includes the story (body, header, footer, footnotes or endnotes) and, where available, the paragraph and run. Paragraphs are counted from 1 in document order, including paragraphs in table cells.
Separate findings from checks that could not be made. report.Skipped records those checks and their reasons; for instance, a drawing part that can’t be parsed. OneDocument implements rules from published Office guidance, but the accessibility docs don’t claim identical results. As Section508.gov explains, automated checks can miss issues or flag false positives. An empty findings list doesn’t establish that the DOCX is accessible.
What does “missing alt text” mean in a Word document?
The picture has neither alternative text nor a decorative marker. For a picture that conveys information, write a description that gives the reader what they need in context. In this sample, “Blue path from Depot to Park” conveys more than the generic name “Picture 1.” If a picture really serves only as decoration, mark it as decorative instead. Don’t mark an informative image as decorative just to clear a finding.
The checker can tell you that a description is missing; it can’t decide what a useful description should say. Read the text alongside the image and ask what a reader who can’t see it would miss. Check the DOCX again after you make changes, and review the meaning of the text by hand.