Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is is possible to set the border for the cell and width of the column
when the string builder used for export to excel using data set in c#. and How ?
I am using sb.AppendFormat method.
Thanks in advance for quick Response.
Posted

StringBuilder can not export to anything, it is for string building. That's all. AppendFormat[^] is not for cell styling or anything that like.
- If you build a CSV file for example, than you can not add any styling.
- You can use OpenXML format if you have Excel 2007 and above or FileFormatConverters on Excel 2003: http://closedxml.codeplex.com/[^]
- A simple trick is to make a html with a styled table in it and name it xls. Excel will open seamlessly. (You might get a warning, but that's all)
- You can use Excel-XML format also: http://www.openscope.net/2010/02/09/transforming-xml-into-ms-excel-xml/[^]
 
Share this answer
 
v3
Here is the solution for exporting the data displayed in stringbuilder to excel sheet.
This code is working perfectly. I am already integrate and i am using this code also.
It will help you for getting correct output.
Check this link:
http://www.dotnetspider.com/resources/38216-Create-Excel-File-using-ASP-NET-C.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900