Headings

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.
 
S

Stefan Blom

You are more likely to get knowledgeable help if you ask the question
in a programming newsgroup, such as microsoft.public.word.vba.general.

--
Stefan Blom
Microsoft Word MVP


in message
news:D[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top