I am trying to get text from .docx
file and when use this code in visual studio it's working well but when uploading to server I get the error:
Error: Could not load file or assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(document, true)) {
DocumentFormat.OpenXml.Wordprocessing.Body body
= wordDoc.MainDocumentPart.Document.Body;
totaltext = body.InnerText;
}
You must register the dll "DocumentFormat.OpenXml.dll" on each machine you want to use your code.
Register the dll on the server and it should works just fine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With