Create an Excel file and save it as a PDF.

I have an Xlsx file that I want to open, fill it with data from the database, and then save it as a PDF on the client. The process will create about 100 files at a time.

I searched the net and realized that Excel Interop should no longer be used. Should I use the XML SDK?

I cannot use third-party products or APIs. This is either using Interop or XML, but just looking for coding suggestions. I have an Adobe pro license and they are used by Office Automation to save Excel files in PDF format.

What are my options? Any recommendation would be greatly appreciated.

+4
source share
1 answer

: " Excel Interop"?

2013 Interop, .NET 4.5.1 Microsoft.Office.Interop.Excel , .

using System;
using Microsoft.Office.Interop.Excel;

namespace officeInterop
{
    class Program
    {
        static void Main(string[] args)
        {
            Application app = new Application();
            Workbook wkb = app.Workbooks.Open("d:\\x.xlsx");
            wkb.ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, "d:\\x.pdf");
        }
    }
}
+14

All Articles