Notifications
Announcements
No record found.
i have problem, need to export ListView data to excel, can anyone help me?
*This post is locked for comments
You have to write the customized code in order to achieve this functionality. I was also looking the same thing for user groups but did not find anything like this.
Hi,
Listview does not bind with the datasource, it is populated through some fill logic, if you know little bit of development, you can dig into the listview to find the source which is filling the listview. Once you know the source table which is filling the listview then you can use the Template wizard in Administration module to create the template of that table and can export data.
Take a look into this.....
shekhardiptiman.wordpress.com/.../dynamics-ax-2009-exporting-data-to-excel-part1
In case someone else is looking for a solution to this.
While there may be a better way to do this, this is the solution I current use.
void function_exportToExcel(int controlId){ formListControl formListControl; formListColumn formListColumn; SysExcelApplication xlsApplication = SysExcelApplication::construct(); SysExcelWorkBooks xlsWorkBookCollection = xlsApplication.workbooks(); SysExcelWorkBook xlsWorkBook = xlsWorkBookCollection.add(); SysExcelWorkSheets xlsWorkSheetCollection = xlsWorkBook.worksheets(); SysExcelWorkSheet xlsWorkSheet = xlsWorkSheetCollection.itemFromNum(1); SysExcelRange xlsRange; CustTable custTable; int row = 3; int rowData; int i, cols, idx; str fileName; formListNext formListNext = formListNext::All; formListItem formListItem; ;
formListControl = formRun.control(controlId); formListControl.lockWindowUpdate(true);
cols = formListControl.getColumnCount(); for (i=0;i<cols;i++) { formListColumn = formListControl.getColumn(0); if (formListColumn) { xlsWorkSheet.cells().item(row,i+1).value(formListColumn.text()); idx = formListControl.getNextItem(formListNext); rowData = row; while(idx != -1) { rowData++;
formListItem = formListControl.getItem(idx); idx = formListControl.getNextItem(formListNext, idx);
xlsWorkSheet.cells().item(rowData,i+1).value(formListItem.text()); } formListControl.deleteColumn(0); } } this.fill(); formListControl.lockWindowUpdate(false); xlsApplication.visible(true);}
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2