Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@blog-aspose-cloud
Last active June 15, 2022 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blog-aspose-cloud/7ae7f9ed6af915c903a9111681381d88 to your computer and use it in GitHub Desktop.
Save blog-aspose-cloud/7ae7f9ed6af915c903a9111681381d88 to your computer and use it in GitHub Desktop.
Convert Excel to PDF in Java

Convert Excel to PDF in Java


This Gist provides the details on how to convert XLSB to PDF using Aspose.Cells Cloud SDK for Java.
In following code snippet, we are first uploading the XLSB file to cloud storage and then convert it to PDF format. After the conversion, the resultant file is saved in cloud storage. For complete details, please visit Convert XLSB to PDF in Java.

XLSB to PDF

Important Links

Product Page | Docs | Live Demo | Swagger UI | Code Samples | Source Code | New Releases | Blog | Free Support | Free Trial

// for more examples, please visit https://github.com/aspose-cells-cloud/aspose-cells-cloud-java
try
{
// Get ClientID and ClientSecret from https://dashboard.aspose.cloud/
String clientId = "bbf94a2c-6d7e-4020-b4d2-b9809741374e";
String clientSecret = "1c9379bb7d701c26cc87e741a29987bb";
// create an instance of CellsApi using client credentials
CellsApi api = new CellsApi(clientId,clientSecret);
// name of input XLSB workbook
String name = "myDocument.xlsb";
// password details if workbook in encrypted
String password = null;
// Specifies whether set workbook rows to be autofit.
Boolean isAutoFit = true;
// Specifies whether only save table data. Only use pdf to excel.
Boolean onlySaveTable = true;
// resultant file format
String format = "PDF";
// load file from local system
File file = new File("c://Users/shahbnay/Downloads/"+name);
// upload input XLSB to cloud storage
api.uploadFile("input.xlsb", file, "Internal");
// perform document conversion operation
File response = api.cellsWorkbookGetWorkbook(name, password,format,
isAutoFit, onlySaveTable, null,"Internal", "Resultant.pdf","Internal", null);
// print success message
System.out.println("XLSB sucessfully converted to PDF format !");
}catch(Exception ex)
{
System.out.println(ex);
}
How to convert XLSB to PDF in Java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment