I want to use DEE to generate excel data, which package should I import?
Hi Joy,
you can use ClosedXML. It already comes with the MES, so you don’t need to install anything, just import the reference in the DEE code.
As an example, I created a simple demo code to show how it works. Of course you will have to adept according to your needs.
UseReference(“”, “Cmf.Foundation.Common.Exceptions”);
UseReference(“ClosedXML.dll”, “ClosedXML.Excel”);
//Please start code here
var serviceProvider = (IServiceProvider)Input[“ServiceProvider”];
string filePath = @“C:\tmp\Demo.xlsx”; // Assuming we are running on a traditional environment, change that if on container
// Creating a new workbook
var wb = new XLWorkbook();
var worksheet = wb.Worksheets.Add(“DemoName”);
worksheet.Cell(1, 1).Value = “Hello”;
worksheet.Cell(1, 2).Value = “World”;
//Saving the workbook
wb.SaveAs(filePath);
Best regards,
Maximilian
I created the excel file successfully, thank you!
Hi Joy,
I dont know your use case, but often a report within the system might fulfill your needs more effectively. Additionally, in V11.0+, you can leverage OData endpoints to extract data directly from MES, which offers a more integrated and programmatic approach.
Best regards,
João Moreira