Free Support Forum -

Excel convert to pdf with bookmark

Your Java product is so great.
We are going to buy Java Library soon if my testing is ok.
When I use this command for bookmark:
cellInPage = worksheets.get(i).getCells().get(“A1”);
It is ok except if the Cell A1 is hihden, the bookmark does not work.
How do know the call is hidden or not?
Or get next cell that is not hidden automatically.

Chang Shin


Thanks for considering Aspose.

Well, if a bookmark refers to a hidden cell, it won’t be added to the Bookmarks list. I have tested using the following sample code, I think it works fine. I have also attached the output PDF file here. Moreover, you may use Row.isHidden() and Column.isHidden() methods to get to know if a row or column is hidden or not. I think you may check if a row or column is hidden so you should not refer your bookmark to it.

Sample code:

//Instantiate a new workbook.
Workbook workbook = new Workbook();
//Get the worksheets in the workbook.
WorksheetCollection worksheets = workbook.getWorksheets();
//Add a sheet to the workbook.
//Add 2nd sheet to the workbook.
//Add the third sheet.
//Get cells in different worksheets.
Cell cellInPage1 = worksheets.get(0).getCells().get(“A1”);
Cell cell2InPage1 = worksheets.get(0).getCells().get(“A2”);
Cell cellInPage2 = worksheets.get(1).getCells().get(“A1”);
Cell cellInPage3 = worksheets.get(2).getCells().get(“A1”);

//Add a value to the A1 cell in the first sheet.
//Add a value to the A2 cell in the first sheet.
//Add a value to the A1 cell in the second sheet.
//Add a value to the A1 cell in the third sheet.

//Hiding the first row of the worksheet

System.out.println(worksheets.get(0).getCells().getRows().get(0).isHidden()); //True - OK

//Create the PdfBookmark entry object.
PdfBookmarkEntry pbeRoot = new PdfBookmarkEntry();
//Set its text.
//Set its destination source page.
//Set the bookmark collapsed.
//Add a new PdfBookmark entry object.
PdfBookmarkEntry subPbe1 = new PdfBookmarkEntry();
//Set its text.
//Set its destination source page.

//Add another PdfBookmark entry object.
PdfBookmarkEntry subPbe2 = new PdfBookmarkEntry();
//Set its text.
//Set its destination source page.
//Create an array list.
ArrayList subEntryList = new ArrayList();
//Add the entry objects to it.

//Set the pdf bookmarks, you need to specify the root object here.

//Save the pdf file.“f:\files\out_PdfBookmarks_test.pdf”, SaveFormat.PDF);

If you still have any confusion or issue, kindly give us sample code (runnable), we will check your issue soon. Also provide us your output PDF file here.

Thank you.

After I added this code:
It is ok.
What is the code to loop row and cell?

for ( int j = 0; j < worksheet.getCells().getMaxColumn(); j++ ) {
if ( !worksheet.getCells().isColumnHidden(j) ) {
cellInPage = worksheet.getCells().getCell(0, j);

Chang Shin


It looks and Good to know that you have sorted it out now.

Regarding looping through the rows to get the cell, you may follow your similar approach if it helps, e.g

for ( int i = 0; i < worksheet.getCells().getMaxRow(); i++ ) {
if ( !worksheet.getCells().isRowHidden(i) ) {
cellInPage = worksheet.getCells().getCell(i, 0);


If you still have any confusion or issue, let us know here, we will try to assist you soon.

Thank you.

Thank you so much.
Your product is so great. but document is not enough for developer.
We will buy java full version in two weeks.

Chang Shin


Thanks for your posting and considering Aspose.Cells.

We are pleased to know your issue is resolved. If you encounter any other issue, please feel free to post, we will be happy to help you more.

Here is a link to Aspose.Cells for Java programmers’ Guide for your reference.

We want to email message files that has attached files to convert to one pdf file.
I am testing to convert attached email files in email message file to pdf files.
The email content should be converted to pdf file too.
and I am doing to combine the pdf files to one pdf file with bookmark.
The bookmark should be the attached file name.
but your document is not enough to find the sample code.
I am checking this URL.

Chang Shin


Well, I am afraid, I can only help you regarding Aspose.Cells component here in Aspose.Cells forum. I think for your need, you have to use multiple products. For example, when you want to merge or concatenate different PDFs, you may use Aspose.Pdf.Kit for Java product or Aspose.Pdf for Java product. We recommend you to kindly post your query into Aspose.Pdf.Kit and Aspose.Pdf forums where one of our colleague from Aspose.Pdf teams will help you there:
Thank you.