Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Export to Excel, CSV, etc View modes: 
User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 9/12/2013 3:59:37 PM
   
Export to Excel, CSV, etc
I'm using the API to export data and all is working fine. Although the user doesn't want all the data in the columns to be converted to text. For instance I export a list of transactions that have numeric values, I want the user to be able to export the list and sum the rows without having to select the columns and format to numeric values. Is there an override to get this to work? Or is it something within the dataset/datatable that I need to specify? Maybe a column datatype?

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 9/19/2013 8:39:23 AM
   
RE:Export to Excel, CSV, etc
Hi Brenden,

Unfortunately because of the design this can not be modified. The main problem here is that the Export functionality is getting data from the (Uni)Grid, not directly from the database and Grid is able to transform these data in any way, so it won't be clear in which form or datatype every column should be exported.
Maybe you can create some Excel script which will convert these values automatically for the users.

However, I've already discussed this with our development team and a new requirement for UniGrid was created (we agree, that it will be practical for users too), so maybe it will be implemented in the next version of Kentico.

Best Regards,
Martin Danko

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 9/19/2013 11:40:24 AM
   
RE:Export to Excel, CSV, etc
Thanks Martin. So here is the catch, I an not using the UniGrid to perform the export, I'm simply making an API call and passing my dataset into it.
    private void ExportData(DataExportFormatEnum format)
{
DataSet ds = MyProvider.GetAllTransactions(StartDate, EndDate).DataSetResults;
foreach (DataColumn dc in ds.Tables[0].Columns)
{
dc.ColumnName = dc.ColumnName.Replace("RS_", "").Replace("#", "");
}
ds.AcceptChanges();
DataExportHelper eh = new DataExportHelper(ds);
eh.ExportData(format, Page.Response);
}
I have a link button on a page the user clicks and depending on the link button clicked, it calls this method and performs the export. What I've done is simply remove the Excel export option and allow them to export to CSV and XML as CSV doesn't format the data to text.

Ideally I'd like to export to QIF (Quicken) or some other formats money management software format.

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 9/26/2013 9:07:05 AM
   
RE:Export to Excel, CSV, etc
Hi Brenden,

I'm afraid you will need to implement this functionality from the scratch as there is a problem with the whole DataExportHelper implementation in this scenario.

By the design it's working with the text format only. But we really appreacite your point here, I believe this will be changed in the next version of Kentico!

Best regards,
Martin Danko