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 Jan 27, 2022 8:45 am

Hi

I have text in a word document that i am loading with
document.LoadFromFile("Test.docx");

for example “hello world”

is it possible to change the position of that text to the
Bottom of the page?

Thanks for helping

wedew222
 
Posts: 8
Joined: Mon Jan 17, 2022 4:01 pm

Thu Jan 27, 2022 10:16 am

Hello,

Thank you for your inquiry.
Kindly note that the Word file is flow typesetting. If the "HelloWord" in your document is normal text in a paragraph, I am afraid that you can only achieve the desired result by adding an empty paragraph before this paragraph. If the "HelloWord" exists in the textbox or shape, you can achieve your desired result with the following code. Hope you can understand.
Code: Select all
//Normal text in a paragraph
Document document = new Document();
Section section = document.addSection();
Section section = document.getSections().get(0);
Paragraph paragraph = section.getParagraphs().get(0);
int index = section.getIndex(paragraph);
for (int i = 0; i < 54;i++){
    section.getBody().getChildObjects().insert(index,new Paragraph(document
}


//In Textbox
paragraph  = section.addParagraph();
TextBox textBox = paragraph.appendTextBox(300,50);
textBox.setHorizontalPosition(0);
textBox.setVerticalPosition(700);
textBox.setTextWrappingStyle(TextWrappingStyle.In_Front_Of_Text);
Paragraph para = textBox.getBody().addParagraph();
para.appendText("This is Hello Word");
// In shape
paragraph = section.addParagraph();
ShapeObject shape = paragraph.appendShape(100,50, ShapeType.Custom_Shape);
shape.setVerticalPosition(700);
shape.setTextWrappingStyle(TextWrappingStyle.In_Front_Of_Text);

Sincerely,
Annika
E-iceblue support team
User avatar

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

Return to Spire.Doc

cron