Thursday 29 December 2011

Reading and writing using OpenXML in the word file in c#.net

        //***************reading and writing using OpenXML in the word file***************

        string strFilePath = @"d:\rentFormat1.docx";
        using (WordprocessingDocument myDocument = WordprocessingDocument.Open(strFilePath, true))
        {
            Body body = myDocument.MainDocumentPart.Document.Body;
            Paragraph para = body.AppendChild(new Paragraph());
            Run run = para.AppendChild(new Run());
            run.AppendChild(new Text("this is another paragraph"));
            string content = body.InnerText;
        }

No comments:

Post a Comment

Please Give Your Valuable Comments on this Topic