Free Support Forum - aspose.com

Problem when applying header and footer from landscape to portrait mode

Hi,

We are trying to update the header and footer of a document(UM.doc) in portrait from other document(891375_input.docx) which is in landscape mode. The header and footer in landscape mode is applied to the portrait mode. How do we shrink the header and footer to fit in Portrait mode.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Here is the code snippet .

Document FP, Document UM;

UM.getFirstSection().getPageSetup().setSectionStart(SectionStart.NEW_PAGE);

// Restart the page numbering for the document to be appended.

UM.getFirstSection().getPageSetup().setDifferentFirstPageHeaderFooter(false);

UM.getFirstSection().getHeadersFooters().linkToPrevious(true);

FP.appendDocument(UM, ImportFormatMode.KEEP_SOURCE_FORMATTING);

891375_MR.docx is the result from the above code.

We tried the api’s provided in the below link http://www.aspose.com/documentation/java-components/aspose.words-for-java/howto-create-headersfooters-using-documentbuilder.html

But it doesn’t seem to work for our problem.

Thanks

Hi

Thanks for your request. As I can see, it is impossible to achieve even in MS Word. So, you have only one option. Disable inheriting Headers/Footers by the next section, clone headers/footer of previous section, insert them into the next section (replace existing if needed) and adjust width of table to fit window.

Best regards,

Can i get the api code you are referring to for adjusting the table width to fit the window. We tried to fit the cell width, but it was not working. Here is the code snippet we are using

Row rowN = footer.getTables().get.getFirstRow();

regards

Hari

Hi Hari,

Thanks for your request. You can use built-in AutoFit method to achieve this. Please see the following link for more information:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.tables.table.autofit.html

Best regards,