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
235
Keep Row/Field Styles When Exporting to Excel
posted

Hi,

We are trying to enhance our product already using Infragistics Controls.

At the moment we are trying to export our grids to Excel or Word but the styles we have defined in the XAML are not being kept/applied when the export happens.

From the help files here http://help.infragistics.com/help/doc/wpf/2012.1/clr4.0/html/xamDataPresenter_Apply_Formats_for_Exporting.html we understood that as the settings where defined in the FieldSettings of the DataPresenter, they should have been applied.

Another issue we are seeing is that the first column is not being exported to excel or word.

I have added a zip file with what we are trying to do and showing the error. Export the tree-grid to excel or word, with the same style.

Hope to hear from you soon.

Thanks

Forecast 5 Dev Team

XamGridWPFReporting_XamTreeGrid.zip
Parents
  • 960
    Offline posted

    Hello Forecast Five,

    As I looked into your sample application, I've found that it retemplates a style targeting TreeCellValuePresenter and uses converters to style each cell. In that case, I'm afraid to say that you cannot use the way described in the document you linked in your post.
    And the reason why the first column is not exported is because the texts on the first column is not a value of that cell, but a value of a TextBlock in the customized control template.

    In order to make what you want to do possible, you may want to use CellExported event of DataPresenterExcelExporter, get the record data from CellExportedEventArgs's Record property, and implement the same logic as you do in the customized retemplated style.

    Similarly, in case of exporting the grid to Word, you should use Infragistics Word library https://es.infragistics.com/help/wpf/word-using-the-ig-word-library instead of DataPresenterWordWriter and manually export values and styles one by one by looping through the bound datasource.


    I hope this will help.


    Best Regards,

    Noriko I.
    Developer Support Engineer,
    Infragistics, Inc.

Reply Children