Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to create a xlsx file in the button click can some one please help me.

ASP.NET
<asp:Button ID="btnGetEmptyTemplate" runat="server" 
              Text="Download Empty template for Import" CssClass="btn btn-default" 
              onclick="btnGetEmptyTemplate_Click"/>

C#
 protected void btnGetEmptyTemplate_Click(object sender, EventArgs e)
        {
            GetTemplate();
        }

private void GetTemplate()
        {
            try
            {   //create new xls file
                string file = "C:\\newdoc.xls";
                Workbook workbook = new Workbook();
                Worksheet worksheet = new Worksheet("First Sheet");
                Workbook wb = excel.Workbooks.Add(System.Reflection.Missing.Value);
                
               
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Posted
Comments
Karthik_Mahalingam 17-Jan-14 8:52am    
what issue you are facing..
check this link create excel
Sibasisjena 17-Jan-14 8:58am    
Ok thanks i will check this.
Karthik_Mahalingam 17-Jan-14 9:03am    
ok sure :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900