Word: Reading file and rewriting changes format.

Aug 26, 2014 at 1:16 PM
I am trying to read a Word document, make some changes and then save it with a different name.

Even when not making any changes the "copy" document changes appearance. The reason is that the "Normal" Style gets a 10pt in Spacing after even if it is 0 in the original document.

Can anyone explain what happens here and how to fix it?

Code supplied below. NPOI version is 2.1.1 (2.0.6 gives same result)

Regards

Anders
        FileStream inputStream = new FileStream(@"D:\work\Original.docx", FileMode.Open);
        XWPFDocument doc = new XWPFDocument(inputStream);

        FileStream outputStream = new FileStream(@"D:\work\Copy.docx", FileMode.Create);
        doc.Write(outputStream);
        outputStream.Close();