This project has moved and is read-only. For the latest updates, please go here.

how do you remove space after paragraph?

Feb 5, 2014 at 6:45 AM
In word, there is an option "remove space after paragraph" which is located under the line spacing button on the Home ribbon.

how do i do this in docx? i tried all variations of table[row].Cells[cell].Paragraph[0].Spacing() or ...SpacingAfter(), but it don't change the line heights.

What is the way to perform this word function?
Feb 5, 2014 at 1:33 PM
If you're using the latest source code, you can use this method to remove line spacing:
   paragraph.SetLineSpacing(LineSpacingTypeAuto.None);
Though I'm not entirely certain if that's what you're looking for?
Feb 6, 2014 at 1:10 AM
Edited Feb 6, 2014 at 1:34 AM
i tried that command.. but didnt seem to do anything..
Originally the code produced this:
Image
but after pressing the aforementioned button, (whilst selecting all the text it produces this:
Image

that is the kind of output i am after
Apr 11, 2014 at 3:56 AM
I accidentally found a solution. Create an Empty docx file, and save it..
then do this:
                    DocX Empty = DocX.Load(emptyname);
                    SourceDocument.InsertDocument(Empty);
Save the Source Document, and then hey presto, all the line spacing is fixed!. Don't know why it does this, but it seems to work..
Also i noticed, for some reason, doing a InserDocument() also changes the font family to time new roman, so if you are using a generated table, you need to define each paragraph with an additional .Font(DesiredFont).