我正在尝试使用[Microsoft.Office.Interop.Excel] dll将excel(xxx.xlsm)转换为pdf。转换excel用户表单时显示,无法继续转换过程...
想要从c#代码中禁用宏用户表单。需要指导...
尝试 {
application = new Application();
/*
* application.Workbooks.Open(...は、Workbooksオブジェクトの解放処理ができないので不可。
* 必ず変数経由でComRelease.FinalReleaseComObjectsを呼び出すこと。
*/
workbooks = application.Workbooks;
workbook = workbooks.Open(
excelFilePathName, Type.Missing, Type.Missing, Type.Missing, Type.Missing
, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing
, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
application.AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable;
// http://msdn.microsoft.com/ja-jp/library/microsoft.office.tools.excel.workbook.exportasfixedformat(v=vs.90).aspx
workbook.ExportAsFixedFormat(
XlFixedFormatType.xlTypePDF,
saveAsPathName,
XlFixedFormatQuality.xlQualityStandard,
true,
true,
Type.Missing,
Type.Missing,
false,
Type.Missing);
}
预先感谢