Hi Max,
You might want to take a look at following KB articles:
#How To Export Data in a DataGrid on an ASP . NET WebForm to Microsoft
Excel
http://support.microsoft.com/kb/317719
#How to transform a DataSet to spreadsheet XML for Excel by using Visual
Basic .NET and ASP.NET
http://support.microsoft.com/kb/319180/
However, as I understand from your post, you're using an existing Excel
template to create new excel file, this might not work with using normal
exporting approaches.
Also, as Mark pointed, automation excel at server-side is not supported by
Microsoft:
#Considerations for server-side Automation of Office
http://support.microsoft.com/kb/257757/
Microsoft does not currently recommend, and does not support, Automation of
Microsoft Office applications from any unattended, non-interactive client
application or component (including ASP, DCOM, and NT Services), because
Office may exhibit unstable behavior and/or deadlock when run in this
environment.
Therefore, I'm afraid you either have to use third party components to
generate the excel file or you could use following workaround if the data
needs to be generated isn't complicated:
You can save the template file as xml format, and load it as xml document,
then use XPath expression to find existing cell data or add new cell data.
Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.