Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word add-in C#: Add label document

Status
Not open for further replies.

BrianWen

Programmer
Jun 8, 2009
102
DK
Hi!

I'm creating a Word 2010 add-in coded in C#.
I stumped a bit here. I want to create a new label document and show it on the screen. I have this so far:

Word.Application wordApp = new Word.Application();
wordApp.MailingLabel.CreateNewDocument("L7163", "Name and address here");
wordApp.Visible = true;

In my mind it shouldn't be harder than that, but nothing pops up on the screen. I think it actually creates the doc, since it takes a second or so, but how can display it?

Any help is greatly appreciated...

 
Hello,

Because I don't install MS Word in my computer. So I use a .NET Word component to create document like this:

Code:
            Document document = new Document();
            Section section = document.Sections[0];
            Paragraph paragraph = section.AddParagraph();
            paragraph.AppendText("Hello");

            document.SaveToFile("New.docx", FileFormat.Docx2010);
            System.Diagnostics.Process.Start("New.docx");

If you have any Word viewer (MS Word or other), you can open and view this document after running.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top