0

I am exporting a grid from my ASP.NET application. One of the columns in the grid (called Notes) has string that has html in it. For example, the Notes column can contain <Head> html tag. However when I export it to excel, I am not being able to see the string <Head>.

5
  • The browser did not like the html head tag that I wrote. Again, for example the Notes column can contian "< HEAD>" (space in the tag has been purposly added so it can render on this question) Commented Mar 16, 2012 at 18:03
  • Can you confirm that the column is filled by saving the excel sheet as .csv file and open it with a text editor? Commented Mar 16, 2012 at 18:05
  • No, it is being exported as html like <tr> <td> <span> Hello </span> </td> </tr>. It is not seperated by comma Commented Mar 16, 2012 at 18:09
  • Of course I didn't expect your html column being csv-ed. I wanted to know if you can "see" your html when converting your excel file to a csv text file. The whole problem seems to be the way excel formats your Notes column. Commented Mar 16, 2012 at 18:21
  • Yes, I can see the html after saving it as .csv file Commented Mar 16, 2012 at 18:27

1 Answer 1

1

Tehnically speaking this is not export to excel, but you send a html with a wrong headers to trick browser to open this content with excel, among the other things downside of this approach is that you don't have control over process of exporting.

Use proper exporting and export data, not some UI view. There is a excellent and free .NET solutions for creating excel files :

NPOI (xls) or / and EPPlus (xlsx)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.