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-07-22 17:07:05 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)