I am generating reports that require headers so I am setting up the headers
per http://msdn2.microsoft.com/library/ms178795.aspx.
I generate a string that contains my header data:
String strTest = “This is my Header”;
I then use the procedure shown in
http://msdn2.microsoft.com/library/ms178795.aspx to apply the header to the
document
foreach (Microsoft.Office.Interop.Word.Section wordSection in oDoc.Sections)
{
wordSection.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary]
.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.
wdAlignParagraphLeft;
wordSection.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary]
.Range.Text = strTest;
}
The question I have revolves around selecting text in the header. If I
wanted to change the header to be:
This is my Header
How would I go about selecting the words “is my” for bolding? I know that
for a document I can chose a range(ref ostart,ref ostop) and range.select()
to select the text that I want. But range(ref ostart,ref ostop) does not
seem to be available to me in
wordSection.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary]. There
is a Range.SetRange(int start,int stop) but after I use this command and then
a Range.Select() the entire header has been selected. Any help would be
appreciated.