I'm successfully exporting a griview on an ASP.Net web form to an Excel file. My problem is that the resulting new Excel file doesn't have the 'gridlines' option checked, so there are not gridlines showing on the newly-created file! I don't want to use the gidlines from the gridview, mainly because they're just not Excel's real gridlines.
In code - as I'm creating the stringwriter and rendering the HTML to export the gridview - how can I tell Excel to check the checkbox for 'Gridlines' in its Options, or more accurately, how can I set that option for the newly-created Excel file from within code? Perhaps I need to export this as a CSV instead or something. I'd hate to have to save the file on the server and then open it back up for the user. Right now it just asks them if they want to open or save the file. Either way, no gridlines.
I've seen this question out there a fair amount of times. I've even asked before last February on the ASP.Net forums, but never got an answer. So, if we can come up with an answer that would be great.
Oh, I'm using VB.Net, VS 2005, and Office 2003, if that helps. All I'm looking for are the few lines of code that I can place into the 'on click' event of the Export button that contains the code that actually exports the gridview to Excel, that will allow the file to be opened up with gridlines displaying.
Please let me know!