locked
C# help RRS feed

  • Question

  • hi
    i have created application using gembox
    i create a word file and save data on it
    but i want after saving it itis opened to me using microsoft word directly

    it is the code


                    DocumentModel document1 = new DocumentModel();

                    Section section1 = new Section(document1);
                    document1.Sections.Add(section1);

                    Paragraph paragraph1 = new Paragraph(document1) { ParagraphFormat = { RightToLeft = true } };
                    section1.Blocks.Add(paragraph1);
                    string result = "x  " + " ' " + textBox7.Text + " '  " + textBox3.Text + "    x ";
                    Run run = new Run(document1, result) { CharacterFormat = { RightToLeft = true } };

                    paragraph1.Inlines.Add(run);
                    document1.Save("report1.docx");

    i want report1 be opened after itis being saved
    please help ....

    Wednesday, April 17, 2013 8:18 AM

Answers

  • Hi,

    you can use something like that

    System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
    info.FileName = @"C:\Program Files (x86)\Microsoft Office\Office14\Winword.exe";
    info.Arguments = "report1.docx";
    System.Diagnostics.Process.Start(info);


    Chris
    Code Samples: Code Samples

    • Proposed as answer by Mike Feng Friday, April 19, 2013 1:34 PM
    • Marked as answer by Mike Feng Tuesday, April 23, 2013 3:30 PM
    Wednesday, April 17, 2013 9:30 AM