Please explain me how to create a Excel Worksheet having .xls and .xlsx format in C#. I looked for a good reference, but was not successful. Please help. Thanks in advance.
First add a reference from the right side in Solution Explorer. Right-click on the project then select Add Reference then select Microsoft.Office.Interop.Excel.Add the following namespace to the project.
Comments
stackoverflow.com/questions/151005/create-excel-xls-and-xlsx-file-from-c-sharp
Check this free excel API: http://freenetexcel.codeplex.com
Create excel:
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
sheet.Range["A3"].Text = "Text";
workbook.SaveToFile("Excel.xls/xlsx");
First add a reference from the right side in Solution Explorer. Right-click on the project then select Add Reference then select Microsoft.Office.Interop.Excel.Add the following namespace to the project.
First create a table using a DataGridView in the C# code.Then create an object of Excel Application, Workbook, Worksheet and Range.
For help, visit : http://knowledgetpoint.com/csharp/methods-in-csharp/