0

I get that error in the title when saving the excel file to pdf. This is in Android by the way. My code is basically like this:

Workbook workbook = new Workbook(filePath);
workbook.save(“MyPdf.pdf”, SaveFormat.PDF);

The filePath is a string that has a value of the file path of the excel file. I already granted those permissions in the manifest like what others would suggest yet I still have this error. With or without that ".pdf" extension, it will still not work.

  • 1
    `filePath is a string that has a value of the file path of the excel file.` We can imagine that. But you better tell the value. Put it in your post visible for all. Also you did not mention an error in your post. – blackapps Sep 02 '20 at 19:50
  • @blackapps, the value of the filePath is the result coming from a file through a file picker. I feel I did not need to tell the value. The error is in the title itself. – Junn Dobit Paras Sep 04 '20 at 11:47
  • Well you now know that you were wrong looking at the accepted answer. – blackapps Sep 04 '20 at 12:03

1 Answers1

1

Your error denotes an io issue and nothing to do with Aspose.Cells for Android via Java APIs. On Android, you need to specify sd card path for the device (where you will store both input and output files). So, make sure you are doing the right thing. See the sample code for your reference: e.g

Sample code:

//Get the sd card path on the device
String sdCardPath = Environment.getExternalStorageDirectory().getPath() + File.separator;
Workbook workbook = new Workbook(sdCardPath + "Book1.xlsx");
workbook.save(sdCardPath + "MyFile.pdf", SaveFormat.PDF);

Should you have further queries or issue, you may also post in the forums.

PS. I am working as Support developer/ Evangelist at Aspose.

Amjad Sahi
  • 1,813
  • 1
  • 10
  • 15