Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active February 5, 2022 13:24
Show Gist options
  • Save aspose-com-kb/3d7764e4c2249d9f987ffcdb1becaeb9 to your computer and use it in GitHub Desktop.
Save aspose-com-kb/3d7764e4c2249d9f987ffcdb1becaeb9 to your computer and use it in GitHub Desktop.
This code can be used to convert Excel to PDF in C++. For more details, refer to the article https://kb.aspose.com/cells/cpp/how-to-convert-excel-to-pdf-using-cpp/
#pragma once
#include "Aspose.Cells.h"
using namespace std;
class ExcelToPDFEx
{
public:
void ConvertExcelWorkbookToPDF()
{
// Set Aspose.Cells API License
intrusive_ptr<License> LicenseForExcelToPDF = new License();
LicenseForExcelToPDF->SetLicense(new String("Aspose.Cells.NET.lic"));
// Load the sample input Excel
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook(new String("input.xlsx"));
// Save the output Excel Document in PDF format
workbook->Save(new String("OutputExcelToPDF.pdf"), SaveFormat_Pdf);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment