Using EPPlus in AX 2012 as an Excel writer
Запись от AnGor размещена 04.04.2018 в 18:04
EPPlus is extremely fast! I will never work again with COM if I want to make deal with Excel!
Here you can get the newest version of EPPlus: https://github.com/JanKallman/EPPlus
As usual before work with new dll you should add it to the References.
Here you can get the newest version of EPPlus: https://github.com/JanKallman/EPPlus
As usual before work with new dll you should add it to the References.
X++:
static void GOA_EPPlus(Args _args) { System.IO.FileInfo newFileInfo; System.IO.FileInfo tmpFileInfo; Filename newFileName = WinAPI::getTempPath() + "GOA_InvoiceProposalAnalysis.xlsm"; Filename tmpFileName = TemplateProvider_RU::getFor(_args).get(resourceStr(GOA_InvoiceProposalAnalysis)); OfficeOpenXml.ExcelPackage ExcelPkg; OfficeOpenXml.ExcelWorkbook ExcelWorkbook; OfficeOpenXml.ExcelWorksheets ExcelWorksheets; OfficeOpenXml.ExcelWorksheet ExcelWorksheet; OfficeOpenXml.ExcelRange ExcelRange; OfficeOpenXml.ExcelRange Cell; Bookmark bookmark; int i; int row = 2; GOA_ViewInvoiceProposal viewInvoiceProposal ; newFileInfo = new System.IO.FileInfo(newFileName); tmpFileInfo = new System.IO.FileInfo(tmpFileName); ExcelPkg = new OfficeOpenXml.ExcelPackage(newFileInfo, tmpFileInfo); ExcelWorkbook = ExcelPkg.get_Workbook(); ExcelWorksheets = ExcelWorkbook.get_Worksheets(); ExcelWorksheet = ExcelWorksheets.get_Item("Data"); ExcelRange = ExcelWorksheet.get_Cells(); while select viewInvoiceProposal { i = 1; bookmark = ComExcelDocument_RU::numToNameCell(i,row); Cell = ExcelRange.get_Item(bookmark); Cell.set_Value(viewInvoiceProposal.TypeView); i++; bookmark = ComExcelDocument_RU::numToNameCell(i,row); Cell = ExcelRange.get_Item(bookmark); Cell.set_Value(viewInvoiceProposal.TypeView); i++; bookmark = ComExcelDocument_RU::numToNameCell(i,row); Cell = ExcelRange.get_Item(bookmark); Cell.set_Value(viewInvoiceProposal.CustAccount); row++; } ExcelPkg.Save(); }
Всего комментариев 1
Комментарии
-
Приветствую коллега. Теперь я тоже балдею от EPPPlus ))).
Запись от Zick-Zibn размещена 30.07.2020 в 23:51