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
180
Bug with DataPresenterExcelExporter
posted

I am using the new DataPresenterExcelExporter for a client.  Previously I was using the solution from the article here to export to excel so I was excited to see how this new class works.

I am really happy that it respects the users column filters as that was something they brought up to me recently.  I would however like to see some default styles that look good as I am not much of a "designer guy" which would be why I'm using your controls ;-).

Anyways I noticed an issue with the labels when exporting a three-level hierarchy like this:

Level 1 Entity

|__>Level 2 Entity

        |__>Level 3 Entity

The header/labels for level 1 are fine, but at level two and three they only show for every entity after the first one in the list.  So every first entity in level 2 or three is missing it's headers.  This makes it a bit difficult to read unfortunately.

Chris

 

Parents
No Data
Reply
  • 180
    posted

    Sorry i should have included my code:

        private static void ExportDataGridToExcelFile(XamDataGrid dataGrid, string filename) {
          var excelExporter = new DataPresenterExcelExporter();
          var options = new ExportOptions {
            ChildRecordCollectionSpacing = ChildRecordCollectionSpacing.None
          };
          DataPresenterExcelExporter.SetExcelLabelFormatSettings(dataGrid.FieldSettings, new FormatSettings {
            FillPattern = FillPatternStyle.Solid,
            FillPatternForegroundColor = Colors.LightBlue,       
          });
          DataPresenterExcelExporter.SetExcelGroupFormatSettings(dataGrid.FieldSettings, new FormatSettings {
            FillPattern = FillPatternStyle.Solid,
            FillPatternForegroundColor = Colors.LightGreen,       
          });
          DataPresenterExcelExporter.SetExcelSummaryLabelFormatSettings(dataGrid.FieldSettings, new FormatSettings {
            FillPattern = FillPatternStyle.Solid,
            FillPatternForegroundColor = Colors.LightPink,       
          });
          try {
            excelExporter.Export(dataGrid, filename, WorkbookFormat.Excel97To2003, options);
          } catch (IOException) {
            MessageBox.Show("Cannot save excel file, please make sure it is not already open");
          }
        }

Children