Unhide Hidden Text and Section Breaks in Microsoft Word
Question details
Unhide hidden text and hidden section breaks in Word documents that are not fully handled by existing C# code.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- C# automation processes DOC and DOCX documents containing hidden formatting across different document ranges.
- Observed behavior
- The code handles hidden text in some files but leaves hidden content or section breaks in others.
Open an affected document in desktop Word and check whether editing or macros are restricted. The methods below remove the Hidden formatting rather than delete content or section breaks.
Unhide section breaks with a Word VBA macro
Use this targeted approach when hidden section breaks remain after your existing code processes ordinary text.
The macro searches the main document story for section breaks marked as hidden and clears their Hidden formatting. It does not delete the breaks or process ordinary hidden text in other stories.
In desktop Word, open the affected document, then use View > Macros to access the VBA editor and insert a module.
Paste this code into the module: Sub UnhideSectionBreaks() Dim r As Range Set r = ActiveDocument.Content Do With r.Find .ClearFormatting .Text = "^b" .Font.Hidden = True .Forward = True .Wrap = wdFindStop .Format = True .MatchWildcards = False If Not .Execute Then Exit Do End With r.Font.Hidden = False If r.End >= ActiveDocument.Content.End Then Exit Do r.SetRange Start:=r.End, End:=ActiveDocument.Content.End Loop End Sub
Use View > Macros to run UnhideSectionBreaks. Inspect the document around its section boundaries, then check other hidden text separately.

Unhide ordinary text with Find and Replace
Use formatting-only replacement to clear Hidden formatting from text in a document range.
Edit Word documents with WPS Writer
WPS Office is a free, lightweight alternative with a familiar interface for working with Microsoft Word documents. Open existing files in WPS Writer for an easy transition; use Microsoft Word when you need to run the VBA fix described above.

Frequently Asked Questions
Does unhiding a section break remove it?
No. Setting its Hidden formatting to false makes the break unhidden but leaves the section boundary in place.
Why does my C# code miss hidden text in some documents?
Code that uses only Selection or the main document range may miss content in other stories, such as headers, footers, text boxes, and footnotes. Loop through the relevant Word story ranges and handle section breaks explicitly.
What does ^b find in Word?
In Word Find and Replace, ^b represents a section break. Combine it with the Hidden font criterion to target hidden section breaks.
Should I set Word's Hidden property to 1 to unhide text?
No. In Word automation, use false or 0 to clear Hidden formatting. Setting it to a true value applies hidden formatting instead.




