Error on Find & Replace in Word Document With Bookmark

0

I use c# project to work with Microsoft.Office.Interop.Word

I added bookmark to one row of my table like this (in word document)

enter image description here

When i want to find and replace {L.Province.Name} (just this word) to anything a exception throw with under message :

The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))

and when delete "row" bookmark the error gone. even a Find (without replace) method throw exception.

I try different method but all of them has same problem - for example:

Word.Range rng = Doc.Content;
Word.Find find = rng.Find;
find.ClearFormatting();

var res = find.Execute(findText, ref Missing, ref Missing, ref Missing, ref Missing,
                ref Missing, ref Missing, ref Missing, ref Missing, ref Missing,
                ref Missing, ref Missing, ref Missing, ref Missing, ref Missing);

How can resolve this problem?

c#
ms-word
office-interop
asked on Stack Overflow Dec 19, 2017 by Mehdi Radi

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0