Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Dec 28, 2017 12:00 pm

Is there any way to set this property using Spire.Doc?

SVictor
 
Posts: 2
Joined: Sat Nov 18, 2017 4:12 pm

Fri Dec 29, 2017 6:41 am

Hello,

Thanks for your inquiry. Spire.Doc supports to set the space between paragraphs. Please refer to the below code snippet.
Code: Select all
//create a new word document and load the sample from file
Document document = new Document();
document.LoadFromFile("sample.docx", FileFormat.Docx);

//Add the text strings to the paragraph and set the style
Paragraph para = new Paragraph(document);       
TextRange textRange1 = para.AppendText("This is a inserted paragraph.");
textRange1.CharacterFormat.TextColor = Color.Blue;
textRange1.CharacterFormat.FontSize = 15;

//set the spacing before and after
para.Format.BeforeAutoSpacing = false;
para.Format.BeforeSpacing = 10;
para.Format.AfterAutoSpacing = false;
para.Format.AfterSpacing = 10;

//insert the added paragraph to the word document
document.Sections[0].Paragraphs.Insert(1, para);

//save the document to file
document.SaveToFile("Result2.docx",FileFormat.Docx2010);


Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Tue Jan 02, 2018 9:17 am

Hello,

Greeting from E-iceblue.
How is the issue going?
Your feedback will be greatly appreciated.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Thu Jan 04, 2018 11:57 am

Thank you, this is exactly what I needed.

SVictor
 
Posts: 2
Joined: Sat Nov 18, 2017 4:12 pm

Fri Jan 05, 2018 2:13 am

Hello,

Thanks for your feedback and time. If there is any other query, welcome to contact us.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Return to Spire.Doc