Welcome to the Xceed Community | Help
Community Search  
More Search Options

Export issue in card view

Sort Posts: Previous Next
  •  05-18-2012, 9:22 AM Post no. 32123

    Export issue in card view

    Attachment: Export_Issue.zip

    Hi,

    In a card view, when we export the card data into Excel format then it shows all the details of the card but card name is not shown.

    Please find the attached screen shot and exported Excel sheet for more clarification. 

    Regards,

    Parthiv 

  •  05-19-2012, 3:07 PM Post no. 32126 in reply to 32123

    Re: Export issue in card view

    Hi Parthiv,

    The reason why the title of the card is not exported is because the ExcelExporter will only export the underlying data source. The title is not part of the underlying collection, but the template for the title can include data from the underlying data source. What you can do is make a property part of the DataContext called Title and have the ExcelExporter export a copy of your current DataGrid with the title. This would give the impression that the title of the card was included in the exporting process.


    Marc

    Developer in Technical Support
    Xceed - Multi-talented components - http://xceed.com
  •  05-21-2012, 10:24 AM Post no. 32133 in reply to 32126

    Re: Export issue in card view

    Attachment: XceedGrid.zip

    Hi Marc,

    I am facing some issues while implementing the above mentioned solution in our application.

    I have attached Sample Application which is prototype of our main application. 

    Can you please make appropriate changes in that sample application so that it wiil be easier for us to replicate it ?

     Thanks in advance.

     

    Regards,

    Parthiv 

  •  05-21-2012, 7:31 PM Post no. 32137 in reply to 32133

    Re: Export issue in card view

    Hi Parthiv,

    I cannot make the changes to the sample application because it is quite large and would require a license to DevExpress to test it out. The only thing you have to do is add another property to your business object, like a ToString property. The ToString property can hold the name of the card, for example, ToString = Title + ", " + Name; 

    When you are ready to export the DataGrid, you can create a copy of the Datagrid and bind it to your source which includes the ToString property and export it. Or you can even include the ToString property in your current datagrid and place the ToString property as the title of your card. Then, when you export, you add the ToString property as a Column and make sure that it is part of the VisibleColumns collection.


    Marc

    Developer in Technical Support
    Xceed - Multi-talented components - http://xceed.com
  •  07-02-2012, 7:01 AM Post no. 32325 in reply to 32137

    Re: Export issue in card view

    Hi,

    Consider a scenario, I have 5 columns in a grid of type card view. Out of 5 columns 3 are visible columns on page and remaining 2 are hidden(i.e not shown on UI ), When I export that grid to Excel format, only visible columns got exported in Excel sheet.

    As per our requirement, we want all the 5 columns(3-Visible + 2-Hidden) to be exported to the Excel. 

    Please suggest how to achieve this ? 

    Thanks,

    Parthiv 

  •  07-03-2012, 11:13 AM Post no. 32332 in reply to 32325

    Re: Export issue in card view

    Hi Parthiv,

    There is no built-in way to include hidden columns in the export, but I can think of two easy workarounds:

    Option 1:

      // Save the original state and force all columns visible
      Dictionary<ColumnBase, bool> savedStates = new Dictionary<ColumnBase, bool>();
      foreach (ColumnBase column in myGrid.Columns)
      {
          savedStates.Add(column, column.Visible);
          column.Visible = true;
      }

      // Export to Excel
      myGrid.ExportToExcel(@"d:\exportTest.xls");

      // Revert the visibility according to the previously saved state
      foreach (ColumnBase column in myGrid.Columns)
          column.Visible = savedStates[column];

     

    Option 2:

    You could use a new DataGridControl that is bound to the Items collection of the original grid. Upon exportation, you should call the ExportToExcel method on the newly identified grid which can be customized to have all the columns you want to export, regardless of what the original grid has.


    Fawzi Bablli
    Developer Technical Support
    Xceed Software Inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.