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

Excel doesn't open when data contains HTML tags

4 Answers 432 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Twistur
Top achievements
Rank 1
Twistur asked on 19 Jan 2012, 09:54 PM
Hi guys,

I noticed that when using ExportFormat.ExcelML with columns containg tags, the generated file cannot be opened. I have a column which contains "<" and ">" and this basically breaks the format. I tried intercepting the value in the ElementExporting event but it doesn't look like it's helping me. A sample event log file froom Excel looks like this:

XML PARSE ERROR:  Missing end-tag
  Error occurs at or below this element stack:
    <ss:Workbook>
     <ss:Worksheet>
      <ss:Table>
       <ss:Row>
        <ss:Cell>
         <ss:Data>
          <ss:CompanyName>

The value for column CompanyName would be something like "<Acme Inc>"

How do I go about this? I

4 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 20 Jan 2012, 10:05 AM
Hi Gio ,
Please use
e.ShouldEncodeValue = true;
in the ElementExporting  event handler of RadGridView.

Greetings,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Twistur
Top achievements
Rank 1
answered on 20 Jan 2012, 07:05 PM
Thanks for the reply Pavel.

Problem is still there unfortunately.
0
Oliver
Top achievements
Rank 1
answered on 14 Feb 2012, 07:23 PM
Hi,

I have the same problem, sometimes, we have the following string "<???>" in our columns and my users cannot export their grids content, what is the solution?

Thank's
0
Nayaz
Top achievements
Rank 1
answered on 24 Jan 2013, 08:09 PM
Hello,
I had the same problem and it was due to Encoding, I was using Encoding.Default to write in ExcelML stream and when I try with UTF8 it worked !
Tags
GridView
Asked by
Twistur
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Twistur
Top achievements
Rank 1
Oliver
Top achievements
Rank 1
Nayaz
Top achievements
Rank 1
Share this question
or