0

I'm trying to export the contents of a datagrid to excel which I have been able to do as long as its to a generic excel workbook. I can't figure out how to direct to open a specific workbook, create a new tab with a name that I create in code, & save the datagrid to that. tab(worksheet).

For example I want it to open C:\mydocuments\myworkbook.xls, create a new worksheet named "0914 to 0920", and export the datgrid to that.

I've been able to designate a file name but no luck with path or worksheet names

Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=" & myfilename)
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "application/vnd.xls"
GridView2.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by kardsen
0

This is an old post but I thought I would bump it as I am having the same issue.

The file to open to post result to a excel tab could be stored on the server in my case though. If that makes it any easier.

Edited by kardsen: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.