using MSExcel = Microsoft.Office.Interop.Excel;
private bool exceltoPDF(string sourcePath, string targetPath)
{
bool result;
object missing = Type.Missing;
MSExcel.ApplicationClass application = null;
MSExcel.Workbook workBook = null;
try
{
application = new MSExcel.ApplicationClass();
object target = targetPath;
workBook = application.Workbooks.Open(sourcePath, missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing, missing, missing, missing, missing);
workBook.ExportAsFixedFormat(MSExcel.XlFixedFormatType.xlTypePDF, target, MSExcel.XlFixedFormatQuality.xlQualityStandard
, true, false, missing, missing, missing, missing);
result = true;
}
catch
{
result &#
c# excel 转 pdf
最新推荐文章于 2024-04-25 09:48:39 发布