Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1300
WP XamPivotGrid Excel - Export
posted

Hello,

I followed the code provided in infragistic samples, for Excel export functionality of WPF Pivot grid.

Export is  not copying Row header and Column header into excel file.

Kindly provide the solution/code for this.


Thanks,

Rambabu

Parents
  • 34510
    Offline posted

    Hi Rambabu,

    I've attached a sample solution that exports the columns, rows and measures used in the XamPivotGrid.  I took the code from the Infragistics samples and added some extra code to export the required items. 

    // Build the columns list.
    int currentCell = 1;
    XmlaDataSource datasource = (XmlaDataSource)this.pivotGrid.DataSource;
    SetCellValue(sheetOne.Rows[0].Cells[0], "Column Dimensions:", "Columns", "Right");
    foreach (FilterViewModelBase filterVM in datasource.Columns)
        SetCellValue(sheetOne.Rows[0].Cells[currentCell++], filterVM.Caption, "Columns");
    
    // reset;
    currentCell = 1;
    
    // Build the rows list.
    SetCellValue(sheetOne.Rows[1].Cells[0], "Row Dimensions:", "Rows", "Right");
    foreach (FilterViewModelBase filterVM in datasource.Rows)
        SetCellValue(sheetOne.Rows[1].Cells[currentCell++], filterVM.Caption, "Rows");
    
    // reset;
    currentCell = 1;
    
    // Build the measures list.
    SetCellValue(sheetOne.Rows[2].Cells[0], "Measures:", "Measures", "Right");
    foreach (BaseMeasureViewModel measureVM in datasource.Measures)
        SetCellValue(sheetOne.Rows[2].Cells[currentCell++], measureVM.Caption, "Measures");

     

    Let me know if you have any questions on this.

    xamPivotGrid-ExportToExcel.zip
Reply Children
No Data