web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

export ListView data to excel

(0) ShareShare
ReportReport
Posted on by 35

i have problem, need to export ListView data to excel, can anyone help me?

*This post is locked for comments

I have the same question (0)
  • Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    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.

  • Amir Nazim Profile Picture
    5,994 on at

    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. 

  • Suggested answer
    Roshan N Profile Picture
    190 on at

    Take a look into this.....

    shekhardiptiman.wordpress.com/.../dynamics-ax-2009-exporting-data-to-excel-part1

  • Suggested answer
    Community Member Profile Picture
    on at

    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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans