我正在尝试使用自定义按钮创建包含页面信息的 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)).
谢谢。
MYYA
相关分类