Reputation: 1
How to get xml from .docx
with Open XML SDK?
My code
WordprocessingDocument wordprocessingDocument = WordprocessingDocument.Open(filepath, true);
Body body = wordprocessingDocument.MainDocumentPart.Document.Body;
Upvotes: 0
Views: 2402
Reputation: 348
its very simple to get xml from word document.
I am copying your code with an extra line of codes
WordprocessingDocument wordprocessingDocument = WordprocessingDocument.Open(filepath, true);
Body body = wordprocessingDocument.MainDocumentPart.Document.Body;
var xml = body.OuterXml;
I hope this helps!!
Upvotes: 1