DEV Community

Oscar Sun(孫守真字任真)
Oscar Sun(孫守真字任真)

Posted on

Answer: How can I get desired range in the protected word document (NetOffice.Word C#)?

It should be that hidden text like Field's code text in it result in this problem. Whatever NetOffice, Microsoft.Office.Interop.Word or VBA, etc You can try my code first. Although it's not a perfect solution so far, notice this block:

if (range.Text != searchText)
                {

                    Console.WriteLine(range.Text);
                    System.Diagnostics.Debugger.Break();
                }

at least it…

Top comments (0)