I am attempting to create a word document where the line spacing is set to "No Spacing", or single spacing. I honestly don't know why this is so difficult.
I have tried all of these examples with no luck:
Paragraph para1 = document.Content.Paragraphs.Add(ref missing);
para1.LineSpacingRule = WdLineSpacing.wdLineSpaceExactly ;
para1.LineSpacing = 1;
para1.Format.SpaceBefore = 5;
para1.Format.SpaceAfter = 0;
para1.Range.Font.Name = "Times New Roman";
para1.Range.Font.Size = 12;
para1.Range.Text = "Mr. John Doe" + Environment.NewLine + "Address" + Environment.NewLine + "Anytown, AnyCity 12345";
Paragraph para1 = document.Content.Paragraphs.Add(ref missing);
para1.LineSpacingRule = WdLineSpacing.wdLineSpaceSingle ;
para1.Format.SpaceBefore = 5;
para1.Format.SpaceAfter = 0;
para1.Range.Font.Name = "Times New Roman";
para1.Range.Font.Size = 12;
para1.Range.Text = "Mr. John Doe" + Environment.NewLine + "Address" + Environment.NewLine + "Anytown, AnyCity 12345";
Paragraph para1 = document.Content.Paragraphs.Add(ref missing);
para1.LineSpacingRule = <tried them all> ;
para1.Format.SpaceBefore = 5;
para1.Format.SpaceAfter = 0;
para1.Range.Font.Name = "Times New Roman";
para1.Range.Font.Size = 12;
para1.Range.Text = "Mr. John Doe\rAddress\rAnytown, AnyCity 12345";
Paragraph para1 = document.Content.Paragraphs.Add(ref missing);
para1.LineSpacingRule = <tried them all> ;
para1.Format.SpaceBefore = 5;
para1.Format.SpaceAfter = 0;
para1.Range.Font.Name = "Times New Roman";
para1.Range.Font.Size = 12;
para1.Range.Text = "Mr. John Doe\rnAddress\rnAnytown, AnyCity 12345";
I am obviously missing something because every example turns out exactly the same. There is extra spacing between each line of the address.
Anyone know how to make this work?