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

radgrid export to excel bot accepting double white space

5 Answers 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raja Rajeswari Mohan Venkataraman
Top achievements
Rank 1
Raja Rajeswari Mohan Venkataraman asked on 20 Dec 2011, 10:25 PM
Hi,

I have a radgrid in which I'm binding the data. For instance I have the column "SER" in the grid. The value of "SER" in the grid is
"NG  101101". The length is fixed i.e 10.

When i export the above data using export to excel, the radgrid exports the above data to "NG 101101".  It removes one space. I don't want the excel to remove the space. I need to maintain the data as such.

Could you please help me achieve what I want.

Thanks,
Raji

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Dec 2011, 06:09 AM
Hello Raji,

Try setting mso-number format as explained in this documentation.
Word/Excel export (HTML-based).

-Shinu.
0
Daniel
Telerik team
answered on 26 Dec 2011, 08:31 AM
Hi Raji,

I suppose that you are using the HTML format. In this case, Excel will display the whitespaces in the exported file in the way they are presented in RadGrid.
Under normal circumstances, two or more whitespaces will be merged into one, single character. You could work around this if you disable the HtmlEncoding property for the given column and then use & nbsp ; as empty characters.

Kind regards,
Daniel
the Telerik team
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 their blog feed now
0
Raja Rajeswari Mohan Venkataraman
Top achievements
Rank 1
answered on 27 Dec 2011, 10:29 PM
Hi Daniel,

The "SER" column that I have in the radgrid is an autogenerated column. The value of "SER" in the grid is "NG  101101". The length is fixed i.e 10.

When i export the above data using export to excel, the radgrid exports the above data to "NG 101101".  It removes one space. I don't want the excel to remove the space. I need to maintain the data as such.

Could you please help me to achieve what I want?

Thanks,
Raji
0
Daniel
Telerik team
answered on 28 Dec 2011, 02:31 PM
Hi Raji,

You could set the HtmlEncoding property of your autogenerated columns in the ColumnCreated event handler.
Give it a try and let me know what happens.

Regards,
Daniel
the Telerik team
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 their blog feed now
0
Raja Rajeswari Mohan Venkataraman
Top achievements
Rank 1
answered on 29 Dec 2011, 08:33 PM
Hi Daniel,

Could you please give me an example of how to disable the HTML encoding for the autogenerated column.

Thanks,
Raji
Tags
Grid
Asked by
Raja Rajeswari Mohan Venkataraman
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Daniel
Telerik team
Raja Rajeswari Mohan Venkataraman
Top achievements
Rank 1
Share this question
or