If you have Excel spreadsheets generated from .NET Core applications, you may find it useful to store your files in a PDF format.
Several reasons include:
Alternatively, you may need to create and distribute the following company reports:
GrapeCity Documents for Excel (GcExcel) is a high-speed, small-footprint spreadsheet API that requires no dependencies on Excel. With full .NET Core support, you can generate, load, modify, and convert spreadsheets in .NET Framework, .NET Core, Mono, and Xamarin. Apps using this spreadsheet API can be deployed to the cloud, Windows, Mac, or Linux.
This demo will cover the following how to create an Excel Spreadsheet and save it to PDF and how to load an Excel Spreadsheet and save it to PDF.
Note: When working with GcExcel on MAC, Linux, specify the Workbook.FontFolderPath and place the necessary fonts in it before exporting spreadsheets to PDF.
For more information, visit: Configure Fonts and Set Style.
Step 1: Create an Excel Spreadsheet
Follow this link to create a basic Excel spreadsheet on Windows, MAC, or Linux.
At the end of this tutorial, the spreadsheet will look like this:
Step 2: Convert Excel Spreadsheets to PDF
In Step 1, we created an Excel spreadsheet using the GcExcel workbook and saved it to an Excel file. Instead of saving to Excel, you can directly save the workbook to PDF. Please note, if you need to print the worksheet on a single PDF, you can set additional options through the PageSetup class of the worksheet.
worksheet.PageSetup.Orientation = PageOrientation.Landscape; worksheet.PageSetup.IsPercentScale = false; worksheet.PageSetup.FitToPagesWide = 1; worksheet.PageSetup.FitToPagesTall = 1; workbook.Save(@"SimpleBudget.pdf");
The PDF will look like this:
Step 3: Load Excel Spreadsheet and Save to PDF
If you want to convert any of your Excel files (whether created with GcExcel or from another third-party tool), you can do so in just three steps using GcExcel.
Suppose you want to convert an Excel file that calculates the total account data summary (as per different age groups in a region) to a PDF.
Follow these steps:
var workbook = new GrapeCity.Documents.Excel.Workbook();
Load Excel File into the Workbook
You have easily converted your excel spreadsheet to PDF:
Supported PDF export features include:
Try the demo here.
Visit this help topic for more info on how to convert Excel to PDF in Java.
Please leave a comment below if this feature satisfies your requirement or you are looking for some additional features!