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.

Mon Sep 25, 2023 7:16 am

Hi Team ,

I have to insert paragraph from particular location ,added below code

section.getPageSetup().getMargins().setLeft(9.0f);
section.getPageSetup().getMargins().setTop(7.0f);

TextRange text = paragraph.appendText("paragraph1");
text.getCharacterFormat().setPosition(5.0f);

But It is not working .Please help us to resolve this issue.

Thanks in advance

pr20080798
 
Posts: 159
Joined: Wed Jan 20, 2021 1:15 pm

Mon Sep 25, 2023 8:18 am

Hello,

Thanks for your inquiry.
Based on the code you provided, I conducted preliminary tests using Spire.Office versions 8.4.5 and 8.9.5, and neither reproduced the issue you mentioned with the code not working. I have attached my test result file, relevant screenshot, and test code. Please test it on your side. If the issue still exists after testing, please provide your complete test code and sample Word document (if available). You could attach them here or send them to us via email (support@e-iceblue.com). Thanks in advance.

Best regards,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Mon Sep 25, 2023 9:00 am

Thank you for your response .

I have tested your code .It creates space between two lines. But my requirement is -

1 . Heading 1
-description of heading1

Note : I have to add some space before description of heading1

pr20080798
 
Posts: 159
Joined: Wed Jan 20, 2021 1:15 pm

Mon Sep 25, 2023 9:53 am

Hello,

Thank you for your feedback.
Based on your description, I assume you want to set the indentation of the paragraph. Please use the following code to set it.
Code: Select all
TextRange text = paragraph.appendText("description of heading1");
paragraph.getFormat().setFirstLineIndent(5.0f);

If this still does not meet your needs, please provide the desired results file for our reference. You could attach it here or send it to us via email (support@e-iceblue.com). Thanks in advance.

Best regards,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.Doc