利用NPOI将excel转成PDF导出,实际上也是先生成excel文件,然后将excel文件转成PDF文件,需要先确认已经安装好了office,并且已经在服务器上开通了相应的权限
/// <summary>
/// 转换excel成PDF文档
/// </summary>
/// <param name="_lstrInputFile">原文件路径</param>
/// <param name="_lstrOutFile">pdf文件输出路径</param>
/// <returns>true 成功</returns>
public bool exceltoPDF(string _lstrInputFile, string _lstrOutFile)
{
Microsoft.Office.Interop.Excel.Application lobjExcelApp = null;
Microsoft.Office.Interop.Excel.Workbooks lobjExcelWorkBooks = null;
Microsoft.Office.Interop.Excel.Workbook lobjExcelWorkBook = null;
string lstrTemp = string.Empty;
object lobjMissing = System.Reflection.Missing.Value;
try
{