This gist explains the steps and code snippet on how to convert XLSB to PDF format using Aspose.Cells Cloud SDK for .NET.
For more information, please visit
This gist explains the steps and code snippet on how to convert XLSB to PDF format using Aspose.Cells Cloud SDK for .NET.
For more information, please visit
This gist contains code snippets related to conversion of XLSB files to PDF format using Aspose.Cells Cloud SDK for .NET |
// For complete examples and data files, please go to | |
https://github.com/aspose-cells-cloud/aspose-cells-cloud-dotnet/ | |
// Get client credentials from https://dashboard.aspose.cloud/ | |
string clientSecret = "d757548a9f2558c39c2feebdf85b4c44"; | |
string clientID = "4db2f826-bf9c-42e7-8b2a-8cbca2d15553"; | |
// create CellsApi instance while passing ClientID and ClientSecret | |
CellsApi instance = new CellsApi(clientID, clientSecret); | |
// name of input Excel file | |
string name = "input.xlsb"; | |
// name of resultant file | |
string resultantFile = "Converted.pdf"; | |
// format of resultant file | |
string format = "PDF"; | |
// name of worksheet to be converted | |
string sheetName = "Sheet2"; | |
try | |
{ | |
// load XLSB file from local drive | |
using (var file = System.IO.File.OpenRead(@"C:\Users\Downloads\" + name)) | |
{ | |
// upload input file to Cloud storage | |
instance.UploadFile(name, file); | |
// initialize the conversion operation | |
var response = instance.CellsWorksheetsGetWorksheet(name, sheetName, format); | |
if (response != null && response.Equals("OK")) | |
{ | |
// display confirmation message in console | |
Console.WriteLine("Worksheet successfully converted to PDF !"); | |
Console.ReadKey(); | |
} | |
// call custom method to save Stream instance to file | |
saveToDisk(response, @"C:\Users\Downloads\" + resultantFile) | |
} | |
}catch (Exception ex) | |
{ | |
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); | |
} | |
// method to save stream instance a file | |
static void saveToDisk(Stream responseStream, String resultantFile) | |
{ | |
var fileStream = File.Create(resultantFile); | |
responseStream.Seek(0, SeekOrigin.Begin); | |
responseStream.CopyTo(fileStream); | |
fileStream.Close(); | |
} |
// For complete examples and data files, please go to | |
https://github.com/aspose-cells-cloud/aspose-cells-cloud-dotnet/ | |
// Get client credentials from https://dashboard.aspose.cloud/ | |
string clientSecret = "d757548a9f2558c39c2feebdf85b4c44"; | |
string clientID = "4db2f826-bf9c-42e7-8b2a-8cbca2d15553"; | |
// create CellsApi instance while passing ClientID and ClientSecret | |
CellsApi instance = new CellsApi(clientID, clientSecret); | |
// name of input Excel file | |
string name = "input.xlsb"; | |
// name of resultant file | |
string resultantFile = "Converted.pdf"; | |
// format of resultant file | |
string format = "PDF"; | |
try | |
{ | |
// load XLSB file from local drive | |
using (var file = System.IO.File.OpenRead(@"C:\Users\Downloads\" + name)) | |
{ | |
// upload input file to Cloud storage | |
instance.UploadFile(name, file); | |
// initialize the conversion operation | |
var response = instance.CellsWorkbookGetWorkbook(name, format: format,outPath:resultantFile); | |
if (response != null && response.Equals("OK")) | |
{ | |
// display confirmation message in console | |
Console.WriteLine("XLSB Successfully converted to PDF !"); | |
Console.ReadKey(); | |
} | |
} | |
}catch (Exception ex) | |
{ | |
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); | |
} |