我正在嘗試使用自定義按鈕創建包含頁面信息的 Excel 文檔。Excel 文檔應該是打開的,然后由用戶來保存它 - 與嵌入在一些 Acumatica 網格中的“導出到 Excel”按鈕完成的操作類似。我閱讀了這篇文章,其中要求類似的內容。但是,new PX.Export.Excel.Core.Package() 由于無法識別庫,因此添加對象 失敗。也許這在最新版本中已被棄用?我創建了這個控制臺項目using Excel = Microsoft.Office.Interop.Excel;namespace ConsoleApp1{ class Program { static void Main(string[] args) { var excelApp = new Excel.Application(); // Make the object visible. excelApp.Visible = true; ; // Create a new, empty workbook and add it to the collection returned // by property Workbooks. The new workbook becomes the active workbook. // Add has an optional parameter for specifying a praticular template. // Because no argument is sent in this example, Add creates a new workbook. excelApp.Workbooks.Add(); excelApp.Cells[1, "A"] = "SNO"; excelApp.Cells[2, "B"] = "A"; excelApp.Cells[2, "C"] = "1122"; Excel._Worksheet workSheet = (Excel.Worksheet)excelApp.ActiveSheet; } }}并正常工作。但是在 Acumatica 中我收到以下錯誤Retrieving the COM class factory for component with CLSID{00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied.(Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).謝謝。
1 回答

MYYA
TA貢獻1868條經驗 獲得超4個贊
您需要在擴展庫中添加 PX.Export.dll 的引用(來自 AcumaticaSite -> Bin 文件夾)以使用PX.Export.Excel.Core.Package()
.
- 1 回答
- 0 關注
- 189 瀏覽
添加回答
舉報
0/150
提交
取消