This is a migrated thread and some comments may be shown as answers.

Grid Export To Excel and other issues

4 Answers 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
devoas
Top achievements
Rank 1
devoas asked on 08 Apr 2016, 04:41 PM

Hi, 

We found few issues related to Export to Excel ...

1. Group Totals are not appearing in Excel output. We have tested both ExcelML and BIff... Group Header and Grand total row appear in Excel but Group totals not appear. We have not set any GroupFooter template and expect simple total should appear.

2. We are getting Excel Sheets without formatting. Is there any easy way that Excel should get same formatting as it view like Winform grid.

     If not then what is the generic way to format it, as we are creating single Viewer for different grid based report - generated dynamically thru code and placed on Asp form.  

3.While adding Java script for handling Double click Event, we found a solution to use Client Side Event RowDbClick ... which pass args..
    in that ars._datakeyvalues.Id    (ClientKeyName)  ... now the problem is that we have same asp page used as viewer for different kind of grid based reports.
    each have different fields .... We can set ClientKeyNames thru code but how to make this Java script dynamic... 
    In one Report we have Id field, in Second report we have ProductId .... This makes difficult to pass different key thru clientside event..

 

 

 

 

4 Answers, 1 is accepted

Sort by
0
devoas
Top achievements
Rank 1
answered on 08 Apr 2016, 04:44 PM

Is there any way to make the Java script dynamic ... Means we can tell which field it has to pass... Or if we can pass the entire datakeyvalues to backend where thru reflection we can extract required fields ... I tried to pass datakeyvalues but could not extract the required columns...

 

0
Kostadin
Telerik team
answered on 13 Apr 2016, 09:52 AM
Hi,

Strait to your questions.
  1. I am afraid both export format does not export the footer group item. Nevertheless, you can manually create the Excel file by using the Export Infrastructure and add the footer item as well. Please check out the following code library which demonstrates that.
  2. Please check out the following help article which elaborates more on styling the Excel document.
  3. Regards your second question you can hook the RowDbClick event programmatically and pass the data field name as an additional parameter. Please check out the following code snippet.
    C#:
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string fieldValue = "Column1";
            RadGrid1.ClientSettings.ClientEvents.OnRowDblClick = "function(s,a){ OnRowDblClick(s,a, '" + fieldValue + "')}";
        }
    }

    JavaScript:
    <script type="text/javascript">
        function OnRowDblClick(sender, args, fieldValue) {
            var value = args.getDataKeyValue(fieldValue);
        }
    </script>

Regards,
Kostadin
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
devoas
Top achievements
Rank 1
answered on 14 Apr 2016, 11:49 AM

Thanks ...  Dynamic Java script issue resolved... 

But Excel Rendering have issue... Tried your code sample.. Having following issues. We are using Q2015.1.25.35

1. We cannot find xls.XlsxRenderer(structure);  this method.

2. If using xls.XlsBiffRenderer(structure); ...... Then it has following issues

     It is not allowing leading spaces.

 

 

0
devoas
Top achievements
Rank 1
answered on 14 Apr 2016, 11:50 AM

2. If using xls.XlsBiffRenderer(structure); ...... Then it has following issues
     It is not allowing leading spaces.

      And it is not creating Total Rows.... Can you pls share any code sample where Grid with Groupings & Total is exported to Excel properly having some leading spaces columns ... it will be really helpful.

Thanks.

Tags
Grid
Asked by
devoas
Top achievements
Rank 1
Answers by
devoas
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or