calling excel macro from C#  
Author Message
rufusf





PostPosted: Tue Oct 30 00:44:59 PDT 2007 Top

ASP.Net >> calling excel macro from C#

Hello Everyone,

I exported a gridview to excel spreadsheet. I want to adjust the column
width of the excel spreadsheet.
Is it possible to create Excel macro from C# to adjust the column width of
the spreadsheet. Below is my code for exporting to excel

string attachment = "attachment; filename=Contacts.xls";
Response.ClearContent();

Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
HtmlForm frm = new HtmlForm();

dgAgentActivity.Parent.Controls.Add(frm);
frm.Attributes["runat"] = "server";
frm.Controls.Add(dgAgentActivity);
frm.RenderControl(htw);

Any help will be greatly appreciated.

Thanks.

Web Programming44  
 
 
Mark





PostPosted: Tue Oct 30 00:44:59 PDT 2007 Top

ASP.Net >> calling excel macro from C#


> Is it possible to create Excel macro from C#

Not natively...

> Any help will be greatly appreciated.

Use this: http://www.aspose.com/Products/Aspose.Cells/Default.aspx


--
Mark Rae
ASP.NET MVP
http://www.markrae.net