Closed dkddkk closed 5 years ago
i suggest before you call search and replace , put a break point and check if your inputDoc has MainDocumentPart or not? you dont want this to be null before you calling textreplacer. and what is it that you are trying to achieve here?
Closing all issues as this repo is being archived and will no longer be maintained by Microsoft. The project is licensed for continued use and development by forking to your own repo.
using (WordprocessingDocument xxDoc = WordprocessingDocument.Create(dstPath, WordprocessingDocumentType.Document)) { MainDocumentPart objMainDocumentPart = xxDoc.AddMainDocumentPart(); objMainDocumentPart.Document = new Document(new Body());
}
SearchAndReplace will throw an exception. _exceptionMethod = {System.Xml.Linq.XDocument GetXDocument(DocumentFormat.OpenXml.Packaging.OpenXmlPart)}
It should be xxDoc cannot build the OpenXmlPart, what should I do? Please give me a method.
ps: for example: var inputDoc = WordprocessingDocument.Create("ttt.docx", WordprocessingDocumentType.Document);
I got a null exception, whenever I save it then open the doc or I create it in memory like above.
Please tell me what should I do?
The word is here: <?xml version="1.0" encoding="utf-8"?>Hello,world.</w:t></w:r></w:p>xxxx.</w:t></w:r></w:p></w:body></w:document>