Header/Footer alignment problem- Texts are sticking together inspite of giving right/left alignments

Hi

I have an issue while adding Header/footer in the word document(simultaneously converting to pdf also) , where the text content is supposed to be in the right and left side of the page. I use the coding procedure in the header-primary/first section as this:

---------------------------------------------------------------------------------------------------------------

builder.getFont().setSize(9);

builder.getFont().setName("Arial");

builder.getFont().setColor(java.awt.Color.decode("#38ACEC"));

builder.write("XYZ-LEFT");

// Align this text to the left.

builder.getCurrentParagraph().getParagraphFormat().setAlignment(com.aspose.words.ParagraphAlignment.LEFT);

builder.insertBreak(com.aspose.words.BreakType.LINE_BREAK);

builder.getFont().setSize(9);

builder.getFont().setName("Arial");

builder.getFont().setColor(java.awt.Color.BLACK);

builder.write("ABC-LEFT");

// Align this text to the left.

builder.getCurrentParagraph().getParagraphFormat().setAlignment(com.aspose.words.ParagraphAlignment.LEFT);

builder.getFont().setSize(9);

builder.getFont().setName("Arial");

builder.getFont().setColor(java.awt.Color.decode("#38ACEC"));

builder.write("XYZ-RIGHT");

// Align this text to the right.

builder.getCurrentParagraph().getParagraphFormat().setAlignment(com.aspose.words.ParagraphAlignment.RIGHT);

builder.insertBreak(com.aspose.words.BreakType.LINE_BREAK);

builder.getFont().setSize(9);

builder.getFont().setName("Arial");

builder.getFont().setColor(java.awt.Color.BLACK);

builder.write("ABC-RIGHT");

// Align this text to the right.

builder.getCurrentParagraph().getParagraphFormat().setAlignment(com.aspose.words.ParagraphAlignment.RIGHT);

---------------------------------------------------------------------------------------------------------------------------------------------------------------

When i do this...the header texts are not on the respective edges of the page...rather aligned left and sticking together...as one single word.

Pls help me out finding a solution. I need them at the edges of the pages...aligned RIGHT n LEFT respectively...(Not stuck together in the left.)

Hi Anu,


Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Aspose.Words generated output document which shows the undesired behavior.
  • Your expected document which shows the correct output. Please create this document using Microsoft Word.
  • Please create a standalone (runnable) console application that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information.

Best regards,