Excel to pdf C++

In the world of data and document processing, Excel sheets play a crucial role in organizing and presenting information. Often, you might need to convert Excel spreadsheets into other formats for various purposes, such as sharing reports, archiving data, or ensuring cross-platform compatibility. One common requirement is converting Excel sheets to PDF format. In this blog post, we’ll explore how to convert Excel files to PDF in C++.

C++ Excel to PDF Converter API

Aspose.Cells for C++ is designed to implement Excel automation features within C++ applications. Using the API, you can create new Excel files from scratch as well as manipulate the existing ones. The API’s built-in spreadsheet converter lets you convert Excel files to other formats with high fidelity. You can either download the API package or install it from NuGet.

Install-Package Aspose.Cells.Cpp

Convert an Excel XLS to PDF in C++ {#Convert-Excel-Files-to-PDF-in-C++}

The following are the steps to convert Excel files to PDF using Aspose.Cells.

The following code sample shows how to convert Excel files to PDF using C++.

Convert Excel to PDF with Compliance Level

Aspose.Cells for C++ also allows you to set the compliance level of the converted PDF file such as PDF/A. For this, the API provides an additional class named as IPdfSaveOptions that allows you to customize the Excel to PDF conversion with different options. The following are the steps to convert an Excel file to PDF with PDF/A compliance.

The following code sample shows how to set compliance level in Excel to PDF conversion.

Set Creation Date in Excel to PDF Conversion

You can also set the creation date and time for the converted PDF file. For this, you can simply use IPdfSaveOptions->SetCreatedTime(new Aspose::Cells::Systems::DateTime) method. The following are the steps to perform this operation.

The following code sample shows how to set the creation date and time in Excel to PDF conversion.

C++ Excel Library - Get a Free License

You can get a free temporary license in order to try the API without evaluation limitations.

Conclusion

Converting Excel sheets to PDF in C++ is made easy and efficient with Aspose.Cells for C++. This library provides a seamless way to work with Excel files programmatically and offers extensive features for customization. By following the steps and code examples in this blog post, you can easily convert your Excel files to PDF format, making data sharing and archiving a breeze in your C++ applications. You can explore more about the API using documentation.

See Also