Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

New Post: Word: Reading file and rewriting changes format.

$
0
0
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();

Viewing all articles
Browse latest Browse all 1621

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>