Thursday, March 8, 2012

change the sheet name while exporting datagrid data to

Hi,
I am having trouble renaming the excel sheet while exporting to excel.
we have a rdl file that contains some analytical data. I have the name to the
excel file as "temp.xls" inside the code. When the user clicks on the Export
to Excel button next to datagrid, it opens a popup with options Open, Save
and Cancel. When I click open, it opens the excel sheet with the sheet name
as .xls[temp[1] and the excel filename as temp[1].xls. As a result when the
user selects the data and try to use pivot table with that data it is giving
an error. I am thinking if I change the sheetname, then the pivot table would
work. Please let me know.
Thanks,
raj.
EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.comI use xslt to auto name the sheets.
<Worksheet>
<xsl:attribute name="ss:Name">
<xsl:value-of select="yourSheetName"/>
</xsl:attribute>
I export from Gridview to Excel, where I may have 100 sheets in my Excel so each sheet has a unique name.
Also see: george wesolowski's net blog and do a search on "excel" or "xslt".
Lynne
EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com

No comments:

Post a Comment