Posts

Showing posts from July, 2019

Write/ Read to Excel Sheet

File exists in a Directory:  static void FileExists(Args _args) { str filePath = @”C:\\vani.pdf”; ; if(WinAPI::fileExists(filePath)) { WinAPI::copyFile(filePath,”C:\\1.pdf”); } } Dynamics AX X++ code to Read/Write data to excel Writing Data to Excel file   How it works 1. Use SysExcelApplication class to create excel file. 2. Use SysExcelWorkbooks and SysExcelWorkbook to create a blank workbook(by default 3 worksheets will be available). 3. Use SysExcelWorkSheets to select worksheet for writing data. 4. SysExcelCells to select the cells in the excel for writing the data. 5. SysExcelCell to write the data in the selected cells. 6. Once you done with write operation use SysExcelApplication.visible to open file. static void Write2ExcelFile(Args _args) { InventTable inventTable; SysExcelApplication application; SysExcelWorkbooks workbooks; SysExcelWorkbook workbook; SysExcelWorksheets worksheets; SysExcelWorksheet worksheet; SysExcelC