+ 3
I download epplus library to use it in visual studio.How to add it to visual studio?
I download EPPlus.dll then copy it to the project solution folder and make it as a reference in the project, then writing using (OfficeOpenXml; using OfficeOpenXml.Style;), but still donot create the excel file. I use console application
2 Answers
+ 1
U need to access the root directory of visual studio to add the library file by using the console application.
0
I found the excel sheet in the folder of project after writing this code
StringBuilder sb = new StringBuilder();
IEnumerable<string> columnNames = stat.Columns.Cast<DataColumn>().
Select(column => column.ColumnName);
sb.AppendLine(string.Join(",", columnNames));
foreach (DataRow row in stat.Rows)
{
IEnumerable<string> fields = row.ItemArray.Select(field => field.ToString());
sb.AppendLine(string.Join(",", fields));
}
File.WriteAllText("pre.csv", sb.ToString());
}