Excel doesn't open when data contains HTML tags

5 posts, 0 answers
  1. Twistur
    Twistur avatar
    28 posts
    Member since:
    Jun 2011

    Posted 19 Jan 2012 Link to this post

    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
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 20 Jan 2012 Link to this post

    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 >>

  3. Twistur
    Twistur avatar
    28 posts
    Member since:
    Jun 2011

    Posted 20 Jan 2012 Link to this post

    Thanks for the reply Pavel.

    Problem is still there unfortunately.
  4. Oliver
    Oliver avatar
    263 posts
    Member since:
    Feb 2011

    Posted 14 Feb 2012 Link to this post

    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
  5. Nayaz
    Nayaz avatar
    2 posts
    Member since:
    Aug 2012

    Posted 24 Jan 2013 Link to this post

    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 !
Back to Top