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

Export numbers from GridHyperLinkColumn to Excel

5 Answers 141 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Elena
Top achievements
Rank 1
Elena asked on 18 Jun 2013, 06:00 PM

Dear Telerik,

We have a problem with exporting numbers from GridHyperLinkColumn to Excel (Biff). They do get transferred to Excel but are stored as Text.
How can I make sure the values are converted to numbers (column.DataType is Int32)?

Thanks,
Elena.

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Jun 2013, 05:36 AM
Hi,

I tried to export numbers from GridHyperlinkcolum in excel and it worked as expected at my end. To make sure whether the data is number just take the sum of values/check the alignment (number:right aligned and text:left aligned) in xls sheet.

Hope this will help you.
Thanks,
Shinu.
0
Shinu
Top achievements
Rank 2
answered on 19 Jun 2013, 05:39 AM
Hi,

I tried to export numbers from GridHyperlinkcolum in excel and it worked as expected at my end. To make sure whether the data is number just take the sum of values/check the alignment (number:right aligned and text:left aligned) in xls sheet.
Also please have a look into Number formats / Formulas portion in the following help documentation.
Excel Format

Hope this will help you.
Thanks,
Shinu.
0
Elena
Top achievements
Rank 1
answered on 19 Jun 2013, 02:43 PM

Hi Shinu,

The sum of the values work and they are formatted correctly, but if I enable filtering, I see the green triangle to the left of each number with warning that 'number is stored as text' and only text sort/filters can be applied to the column.
I could not find anything in GridBiffExportingEventArgs to convert values to numbers.
Please let me know how I can do it.

Thanks,
Elena.

0
Accepted
Kostadin
Telerik team
answered on 21 Jun 2013, 01:09 PM
Hello Elena,

You could hook OnBiffExporting event handler and modify the cells values. Check out the following help article.
protected void RadGrid1_BiffExporting(object sender, Telerik.Web.UI.GridBiffExportingEventArgs e)
{
    xls.Table table = e.ExportStructure.Tables[0] as xls.Table;
    for (int i = 2; i <= table.Rows.Count; i++)
    {
        table.Cells[4, i].Value = Int32.Parse(table.Cells[4, i].Text);
    }
}

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Elena
Top achievements
Rank 1
answered on 21 Jun 2013, 04:58 PM
Thank you Kostadin, now it works correctly!
Tags
Grid
Asked by
Elena
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Elena
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or