Repeating Headers on PDF- using excel to PDF

Hi All,

I have been using Aspose cell to create a report. When I export data in PDF , I want to repeat some rows as a header on PDF.For example

"Row Header1"

Value1

value2

value3

in PDF I want to show "Row Header1" on every page.

Please let me know there is way to achieve it.

Regards,

Abhinav Singhal

Hi,


I think you may try to use PageSetup options e.g Print title rows/cols before saving to PDF format.
See the document for your reference:
http://www.aspose.com/docs/display/cellsnet/Setting+Print+Options

Sample code:

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Obtaining the reference of the PageSetup of the worksheet
Aspose.Cells.PageSetup pageSetup = workbook.Worksheets[0].PageSetup;

//Defining column numbers A & B as title columns
pageSetup.PrintTitleColumns = “$A:$B”;

//Defining row numbers 1 - 4 as title rows
pageSetup.PrintTitleRows = “$1:$4”;


Hi,

Thanks for the response. I am new to Aspose cells and am not sure if the solution provided above is for Java. I have attached the sample excel report.

All I want to do is repeat the years ( marked in grey color) in PDF, in all pages.

Right now the pdf output is really out of sync as compared to Excel.

Regards,

Abhinav

Hi,


Well, the code shared in the previous post is for .NET.
See the document for your reference in JAVA:

Please see the following sample JAVA code for your needs for your reference:

Sample code:

//Instantiating a Workbook object
Workbook workbook = new Workbook(“ReportResult.xls”);

//Obtaining the reference of the PageSetup of the worksheet
PageSetup pageSetup = workbook.getWorksheets().get(0).getPageSetup();

//Defining row number 2 as title rows
pageSetup.setPrintTitleRows(“$2:$2”);

pageSetup.setFitToPagesTall(0);
pageSetup.setFitToPagesWide(1);

workbook.save(“outputReportResult1.xls”);
workbook.save(“outputReportResult2.pdf”, SaveFormat.PDF);

Thank you.

Thanks Amjad,

This works.

Regards,

Abhinav

Hi,


Good to know that it works for you.

Feel free to contact us any time if you need further help or have some other query/issue, we will be happy to assist you soon.

Thank you.