Free Support Forum - aspose.com

I am getting an error when I export a file to PDF that does not have a selected item for a shape

We have a sheet that has a drop down (shape) with 2 items and a blank.
one cell is the index of the selected value. You can type in 0, 1, or 2 to change what is selected
we have a cell that tells us what value you picked from the list of elements.

I have a very abbreviated set of lines of code to exemplify the PDF export I will include here. I will also include the sheet in two conditions. The first is the error condition and the second is the case where an element is selected and no error is thrown.

import com.aspose.cells.SaveFormat;
import com.aspose.cells.ShapeCollection;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;

public class IBM_to_Aspose {

static String badFile  = "C:\\temp\\listStartsBlank.xlsx";
static String goodFile = "C:\\temp\\listStartsSelected.xlsx";

public static void main(String[] args) {
	try {
		// Test against both goodFile and badFile to compare
		saveAsPDF(badFile);
	} catch (Exception e) {
		e.printStackTrace();
	}

}
public static void saveAsPDF(String fileName) throws Exception {
	// Stepping through "same code" as in our real code base leading up to situation
	Workbook workbook = new Workbook(fileName);
	Workbook asposeUpdatedWorkbook = new Workbook();
	asposeUpdatedWorkbook.copy(workbook);
	Worksheet asposeUpdatedSheet;
	
    for (int i=0; i<asposeUpdatedWorkbook.getWorksheets().getCount(); i++) {
		asposeUpdatedSheet = asposeUpdatedWorkbook.getWorksheets().get(i);
		ShapeCollection asposeShapes = asposeUpdatedSheet.getShapes();
		
		// This is where in our code things go amok but we cannot just remove this line to "make it work"
		// as it has purpose in our product.
		asposeShapes.updateSelectedValue();
     }
	
    asposeUpdatedWorkbook.save("IBM_147434.pdf", SaveFormat.PDF);
    System.out.println("Export saved successfully");
}

}IBM_to_Aspose.zip (37.1 KB)

@ibmlittleton,

Please notice, we were able to reproduce the issue as you mentioned by using your sample code with your template file. We found an exception “com.aspose.cells.CellsException: Row or column is out of the range” while exporting the specified file to PDF (that does not have a selected item for a dropdown shape). We have logged a ticket with an id “CELLSJAVA-43343” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

Thank you very much! That is the error we are seeing to in our product when uploading this sheet. I appreciate the confirmation of that.

@ibmlittleton,
You are welcome.

@ibmlittleton,

We are pleased to inform you that your issue has been resolved now. You may expect the fix in the next few days after you have performed QA and included other enhancements and fixes.

1 Like

Thank you. Our dev complete for our release is this week and we look forward to seeing this shortly. I am sorry we found this one little issue at the last minute.

@ibmlittleton,

Please try our latest version/fix: Aspose.Cells for Java v20.11.1 (attached), we managed to compile/ release it today.
aspose-cells-20.11.1-java.zip (7.2 MB)

Your issue should be fixed in it.

Let us know your feedback.

This has been tested and it works. Thank you! Please than the team for us for such a fast fix. They are very much appreciated.

@ibmlittleton,

Thanks for the confirmation on the fix.

We are glad the fix works for your needs. Feel free to contact us for any enhancement request, suggestion or complaint at any time. We will be very pleased to help out in any way.

1 Like