Page number in footer for java

Hello,

I would like to add automatic page numbers to the footer of a worksheet. Such can be done in excel by setting the footer text to "&[Page] of &[Pages]". However, when I try this:

outSheet = outBook.getActiveSheet();
outSheet.getPageSetup().setCenterFooter("&[Page] of &[Pages]");

My footer prints out as: "Page] of Pages]"

Is it possible to include automatic page number in the footer of an excel sheet? If so, how?

Thanks!

Hi,

You should use setCenterFooter("&P of &N");

Please check Headers and Footers

Excellent, thank you.

One minor suggestion, It would be nice to include a succinct version of information such as this in the javadocs. Many java devlopers use javadoc as the first place to look for information such as this. Also, copies of javadoc can be stored locally and easily accesible when programming without an internet connection.

I will however, more carefully check the wiki in the future :)

Hi,

You can check declarations of PageSetup.setCenterFooter() method.

There are "See Also" tags which refer to the PageSetup.setCenterFooter() method in all other setting/getting header and footer mathods' doc .