Document Editing Problems

Unhide Hidden Text and Section Breaks in Microsoft Word

Rana GarciaRana Garcia Nov 14, 2026 868 views

Question details

Unhide hidden text and hidden section breaks in Word documents that are not fully handled by existing C# code.

Unhide Hidden Text and Section Breaks in Microsoft Word
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the macro editor

In desktop Word, open the affected document, then use View > Macros to access the VBA editor and insert a module.

2
Add the macro

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

3
Run and verify

Use View > Macros to run UnhideSectionBreaks. Inspect the document around its section boundaries, then check other hidden text separately.

Unhide section breaks with a Word VBA macro
Keep section breaks intact: Unhiding a section break preserves it. Deleting one can merge sections and change layout or header and footer settings.
Free Microsoft Office alternative

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.

Edit documents in a familiar word-processing interfaceOpen and save Microsoft Word DOC and DOCX filesReview document text and section layoutsMove existing Office documents into a lightweight workspace
microsoft office alternative - wps office

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.