How can I speed-up creating excel Excel spreadsheets from C#?
问题 I am currently writing around 200 Excel spreadsheets using Excel 2007 with C# COM Interop. Unfortunately I need about 4 minutes to write these 200 sheets - each sheet has around 1000 rows with 8- 10 columns. How can I speed up things? My code looks like this basically: var xlApp = new Excel.Application(); xlApp.DisplayAlerts=false; foreach (x in z) { var wb = xlApp.Workbooks.add(XLWBATemplae.xlWBATWorksheet); var ws = (Worksheet)wb.Worksheets[1]; //fill data into sheet wb.SaveAs(fileName);