Cells 8.0.0
Microsoft Excell 2010
When operating on a single page excel file Aspose does not correctly add a footer.
Create and empty excel file. (xlsx).
Open the file, go to page layout, add a left footer. "First Page Footer"
Make sure different on first page, scale with doc, align with page is selected.
Save the document.
Expand the zip, look at the sheet1.xml file and check out the XML.
You should see
First Page Footer
Now save that file for future ref.
Open the file again. Go to page layout. Put some text in cells B:30 and K:30 (So we have 2 pages).
Make sure different on first page, scale with doc, align with page is selected.
On the first footer make it the same as the above steps.
On the second footer make it "Second Page Footer"
Save the file, extract the sheet1.xml and check out the xml.
You now get.
Second Page Footer
First Page Footer
Aspose in both cases uses firstFooter.
Hi,
Try this. If this is the incorrect way to set the headers on the first page let me know.
public class TestClass {
public static final int LEFT = 0;
public static final int CENTER = 1;
public static final int RIGHT = 2;
public static void main(String[] args) throws Exception{
Workbook workBook = new WorkBook();
WorksheetCollection workSheets = workBook.getWorksheets();
for ( int x = 0 ; x < workSheets.getCount(); x++ ) {
Worksheet wks = workSheets.get(x);
PageSetup pageSetup = wks.getPageSetup();
pageSetup.setHFDiffFirst(true);
pageSetup.setFirstPageHeader(LEFT, “First Page Left Header”);
pageSetup.setFirstPageHeader(CENTER, “First Page Center Header”);
pageSetup.setFirstPageHeader(RIGHT, “First Page RightHeader”);
pageSetup.setFirstPageFooter(LEFT, “First Page Left Footer”);
pageSetup.setFirstPageFooter(CENTER, “First Page Center Footer”);
pageSetup.setFirstPageFooter(RIGHT, “First Page Right Footer”);
}
workBook.save(“TestFileOut.xlsx”);
}
}
Hi,
With a single page excel file the header and footers do not print.
Is there any what to figure out how many pages would be printed? If I could do that, then I could modify the code for the type of headers I need. We usually need the first headers and footers to be different than the rest.
Hi,
Worksheet = workbook.Worksheeets[0];