D
Daniel
Hi I'm creating an application that generates a report in Word 2003. Using C#
My problem is that I need headings to create a table of content, so I search
the web trying to find a way to do this.
My solution was something like this:
using Word = Microsoft.Office.Interop.Word;
using System.Reflection;
object oMissing = System.Reflection.Missing.Value;
Word._Document oDoc;
public void Header1(String s)
{
object oStyle = Word.WdBuiltinStyle.wdStyleHeading1;
Word.Paragraph oPara1;
oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing);
oPara1.set_Style(ref oStyle);
oPara1.Range.Text = s;
oPara1.Range.InsertParagraphAfter();
}
The problem is that is looks like a Heading1 but it isn't a heading.
My problem is that I need headings to create a table of content, so I search
the web trying to find a way to do this.
My solution was something like this:
using Word = Microsoft.Office.Interop.Word;
using System.Reflection;
object oMissing = System.Reflection.Missing.Value;
Word._Document oDoc;
public void Header1(String s)
{
object oStyle = Word.WdBuiltinStyle.wdStyleHeading1;
Word.Paragraph oPara1;
oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing);
oPara1.set_Style(ref oStyle);
oPara1.Range.Text = s;
oPara1.Range.InsertParagraphAfter();
}
The problem is that is looks like a Heading1 but it isn't a heading.