To convert an XLSX file to a PDF file in C#, you can use the Excel Interop library to open the XLSX file and print it to a PDF printer (such as the Microsoft Print to PDF driver). Here's an example of how to do this:
main.cs1006 chars32 lines
This code opens the XLSX file using the Excel Interop library, prints it to a PDF file using the ExportAsFixedFormat
method, and then releases all of the resources used by Excel. Note that you will need to add a reference to the Microsoft Excel Object Library in your C# project to use the Excel Interop library.
gistlibby LogSnag