I am editing doc file using openxml in c# and want to save it. Changes is made but the file could not be save. when I open the file it doesn't show any changes made. I did it with follow code.
using (WordprocessingDocument doc = WordprocessingDocument.Open(source, true))
{
using (StreamReader reader = new StreamReader(doc.MainDocumentPart.GetStream()))
{
documentText = reader.ReadToEnd();
}
Body body = doc.MainDocumentPart.Document.Body;
documentText = documentText.Replace("##date##", "02/02/2014");
documentText = documentText.Replace("##saleno##", "2014");
documentText = documentText.Replace("##Email##", "abc");
documentText = documentText.Replace("##PhoneNo##", "9856321404");
doc.MainDocumentPart.Document.Save();
doc.Close();
}
Please help. Thanks.