Juan Carlos Torres
Juan Carlos Torres

Reputation: 1

How to remove extra spacing between lines using NPOI

I'm a new developer and need your help

I'm using NPOI to create word documents based on txt files. Already have an word example and the format is ok.

As you can see in this image, the space between lines is narrow :

Image without spacing

After I created the Word document using NPOI, the new file has more spacing between paragraphs:

Image with Spacing

Every time I added a new text into the word document, I set this :

     private static void SetParagraphRunSettings(XWPFRun paragraphRun)
        {
            paragraphRun.FontSize = 7;
            paragraphRun.FontFamily = "Courier New";
            paragraphRun.IsBold = true;
        }
        
        private static void SetParagraphSettings(XWPFParagraph paragraph, string stepComment)
        {
            if (stepComment.Contains("Landscate -"))
            {
                paragraph.IndentationFirstLine = 0;
                paragraph.FirstLineIndent = 0;
                paragraph.IndentationLeft = 1; //(int)(0.002 * 20); // 0.64 Cm = 0.002 inches
                paragraph.IndentationHanging = 1;  //(int)(0.002 * 20); // 0.64 Cm = 0.002 inches
            }
            paragraph.Alignment = ParagraphAlignment.LEFT;
            paragraph.IndentationRight = 0;
            paragraph.SpacingBefore = 0;
            paragraph.SpacingAfter = 0;
            // Line Spcing = Sigle 
            paragraph.setSpacingBetween(1, LineSpacingRule.AUTO);
        }

Upvotes: 0

Views: 463

Answers (1)

Tony Qu
Tony Qu

Reputation: 756

Can you create an issue in https://github.com/nissl-lab/npoi-examples/issues? I'd like to check if this is a bug of the latest NPOI.

Upvotes: 1

Related Questions