This gist explains the steps and code snippet on how to convert Excel workbook 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 Excel workbook to PDF format using Aspose.Cells Cloud SDK for .NET.
For more information, please visit
This gist contains code snippets related to conversion of Excel workbook 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 = "Book1.xlsx"; | |
// format of resultant file | |
string format = "PDF"; | |
// name of resultant file | |
string resultantFile = "Converted.pdf"; | |
try | |
{ | |
// load the file from local drive | |
using (var file = System.IO.File.OpenRead(@"C:\Users\shahbnay\Downloads\" + name)) | |
{ | |
// initialize the conversion operation | |
var response = instance.CellsWorkbookPutConvertWorkbook(file, format: format, outPath: resultantFile); | |
// print success message if conversion is successful | |
if (response != null && response.Equals("OK")) | |
{ | |
Console.WriteLine("Successfully converted Excel workbook to PDF format !"); | |
Console.ReadKey(); | |
} | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); | |
} |