After inserting some html text into my document I want to set the left indent of all paragraphs. I tried to select the entire document to set all paragraphs at the same time but couldn’t find a way of doing this. Is there a way to select the entire document?
The second way I tried was to iterate through all the paragraphs using the following code but even though the paragraph count returns a value of 40 I get an error at the ‘MoveTo’ statement when the count reaches 1. The error is ‘Specified argument was out of the range of valid values. parameter name: paraidx’.
Could you please explain what I’m doing wrong? Thanks
Dim cnt As Integer
letter.UpdateWordCount()
cnt = letter.BuiltInDocumentProperties.Paragraphs
For cnt = 0 To letter.BuiltInDocumentProperties.Paragraphs - 1
docBuilder.MoveToParagraph(cnt, 0)
docBuilder.ParagraphFormat.LeftIndent = 20
Next
letter.Save("EnquiryLetter.doc", SaveFormat.Doc, SaveType.OpenInWord, Response)