C# – Programmatically convert Excel to XPS


I am looking for a way to programmatically convert Excel reports to XPS format. Is this supported anywhere in the Microsoft framework, or should we look for a third party tool?

Yes currently we are programmatically creating Excel reports using ExcelWriter and need to produce XPS reports for a client. So we either go direct to XPS which seems to be a larger learning curve, or convert the Excel report to XPS.

Best Solution

There is an add on for Office 2007 that gives you the ability to export to XPS or PDF. Invoke Excel via Microsoft.Office.interop.Excel and export to XPS.

From my own code (Workbook is an instance but providing full namespace instead):

    pdfpath, Excel.XlFixedFormatQuality.xlQualityStandard,
    true, true,
    fpage, tpage,

There is an MSDN article on how to do this.