Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello All. I'd like to ask in a console application I want to get the content of a word, that has for example two field (name and Family) and show it to User(showing the word file to User). And let user to fill in the word file and then save it in a directory :
I have write something like this, but it can only copy the content in other word document. How can I show the file to User? And ultimately save it in the other document?

XML
string docTemplatePath = @"E:m.docx";
           string docOutputPath = @"E:mm.docx";


           File.Copy(docTemplatePath, docOutputPath);



           using (WordprocessingDocument doc = WordprocessingDocument.Open(docOutputPath, true))
           {

               string newXml = "<root>"+
                               "<MatterNumber>00011111</MatterNumber>" +
                               "<DocType>Contract</DocType>"
                               "<root>";

               MainDocumentPart main = doc.MainDocumentPart;
               main.DeleteParts<CustomXmlPart>(main.CustomXmlParts);


               CustomXmlPart customXml = main.AddCustomXmlPart(CustomXmlPartType.CustomXml);
               using (StreamWriter ts = new StreamWriter(customXml.GetStream()))
               {

                   ts.Write(newXml);
               }


           }

           Console.WriteLine("Done");
           Console.ReadLine();
Posted
Updated 7-Mar-12 18:17pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900