How to set excel sheet name in generated PDF file


#1

Hi

I want to set the sheet name of excel file in generated pdf. How i can do this.
Thanks in advance.


#2

@sheoran531994,

Thanks for your query.

Do you need to insert Sheet name(s) as header/footer? If this is the case, see the document on how to specify headers/footers for your reference. You may insert sheet name as header/footer before converting the Excel spreadsheets to PDF file format, see the sample code segment for your reference:
e.g
Sample code:

........
// Obtaining the reference of the PageSetup of the worksheet
PageSetup pageSetup = worksheet.getPageSetup();

// Setting worksheet name at the left section of the header
pageSetup.setHeader(0, "&A");

In case, you need something else, kindly provide your sample files (input Excel file and output PDF file, etc.) with complete details, so we could help you accordingly.


#3

Hi

My worksheet already have name. I have to set this name to PDF footer.


#4

@sheoran531994,

See the following lines of code:
e.g
Sample code:

........ 
// Obtaining the reference of the PageSetup of the worksheet 
PageSetup pageSetup = worksheet.getPageSetup(); 

// Setting worksheet name at the left section of the footer
pageSetup.setFooter(0, "&A"); 

Hope, this helps a bit.