Iam trying to pass in a MemoryStream
(not a Filestream
).
This is what I did:
XWPFDocument w2 = new XWPFDocument(memoryStream);
This is what I get:
EOF in header
Updated my post:
var m_a = new MemoryStream(File.ReadAllBytes(path_docx));
// this works:
//byte[] tempDatei = m_a.ToArray();
//XWPFDocument m_w1 = new XWPFDocument(new MemoryStream(tempDatei));
XWPFDocument m_w1 = new XWPFDocument(m_a);
// ... do something with the document
m_w1.Write(m_a);
// Actually, I want to use the same MemoryStream
XWPFDocument m_w2 = new XWPFDocument(m_a);
m_a.Position = 0;
// ... do something with the document
m_w2.Write(m_a);
// Dispose later
if (m_a != null)
{
m_a.Close();
m_a.Dispose();
}
The main goal is to use the same MemoryStream, dispose later