locked
Create Excel File using c# RRS feed

  • Question

  • User637234440 posted

    how to create a .xlsx file using c#


    Tuesday, September 13, 2011 4:59 AM

Answers

All replies

  • Tuesday, September 13, 2011 5:03 AM
  • User637234440 posted
    Ravi 
    I am using following code for create excel 2007 file which create the file and write in that file but when i open the file but it give me error that
    exel cannot open the file bcz file might be coruupted or extension of the file is not compatible.
    but if i used .xls for file it work fines

    for (int i = 0; i < TotalFile; i++) { Contact.Clear(); if (innerloop == SplitSize) { for (int j = 0; j < SplitSize; j++) { string strContact = DSt.Tables[0].Rows[i * SplitSize + j][0].ToString(); Contact.Add(strContact); } string strExcel = strFileName + "_" + i.ToString() + ".xlsx"; File.WriteAllLines(strExcel, Contact.ToArray()); } }
    Tuesday, September 13, 2011 5:58 AM
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 13, 2011 12:43 AM
  • User1458583585 posted

    Hi you can try this link

    Thursday, October 13, 2011 4:57 AM