Thursday, 29 December 2011

creation of word document using openXML concept

        //******************************creation of word document using openXML concept**************************

        string fileName = @"D:\rentformat1.docx";
        using (WordprocessingDocument myDocument = WordprocessingDocument.Create(fileName, WordprocessingDocumentType.Document))
            MainDocumentPart mainPart = myDocument.AddMainDocumentPart();
            mainPart.Document = new Document();
            Body body = mainPart.Document.AppendChild(new Body());
            Paragraph para = body.AppendChild(new Paragraph());
            Run run = para.AppendChild(new Run());

            run.AppendChild(new Text("hello, world"));

No comments:

Post a Comment

Please Give Your Valuable Comments on this Topic