我正在尝试另存为 excel 文件,但它给出了一个错误:无法将名称映射到 dispid:FileSaveAs。
private ActiveXComponent objExcel = new ActiveXComponent("Excel.Application");
excelObject = objExcel.getObject();
Dispatch.put(excelObject, "Visible", new Variant(false));
workbook = objExcel.getProperty("Workbooks").toDispatch();
workbook = Dispatch.call(workbook, "Open", filename).toDispatch();
Dispatch oExcel = Dispatch.call(objExcel, "Workbooks").getDispatch();
Dispatch.call(workbook, "FileSaveAs", filename, new Variant(51));
变体的参数取自: http: //msdn.microsoft.com/en-us/library/bb241279 (v=office.12).aspx
谁能告诉我代码中的问题在哪里?谢谢