Dah Sra
Dah Sra

Reputation: 4445

while reading the word document,need to add invisible text into it

I am developing a word add-in, for some purpose i need to read a word document.So according to my business purpose am reading the document by each paragraph and storing each paragraph from the word into a data table and i need to add a text "VERIFIED" into that paragraph for some purpose. My problem is how to store that word "VERIFIED" in a paragraph. I have treied adding in two manner

Upvotes: 0

Views: 330

Answers (1)

Kazimierz Jawor
Kazimierz Jawor

Reputation: 19077

I would suggest to use ContentControl (CC) in your situation. There are few possibilities how you could take advantage of CC but, in my opinion, best option is to wrap each verified paragraph into CC.

The following code is written in Word-VBA which you can easily convert into C# code:

Dim par As Paragraph

'set reference to appropriate paragraph
Set par = ActiveDocument.Paragraphs(2)

Dim cc As ContentControl
Set cc = ActiveDocument.ContentControls.Add( _
            wdContentControlRichText, par.Range)

cc.Tag = "VERIFIED"

'options
'disable deletion of CC
cc.LockContentControl = True

'disable edition of CC
cc.LockContents = True

Upvotes: 1

Related Questions