从列表视图写Excel是非常缓慢的

我正在导出一个列表视图,它有六列和大约50个项目。 当试图导出到Excel文件大约需要2到3分钟。 码:

linkLabel2.Text = "Please Wait..."; Excel.Application app = new Excel.Application(); app.Visible = false; Excel.Workbook wb = app.Workbooks.Add(1); Excel.Worksheet ws = (Excel.Worksheet)wb.Worksheets[1]; Excel.Range cells = wb.Worksheets[1].cells; cells.NumberFormat = "@"; int i = 1; int i2 = 2; int x = 1; int x2 = 1; foreach (ColumnHeader ch in listView1.Columns) { ws.Cells[x2, x] = ch.Text; x++; } foreach (ListViewItem lvi in listView1.Items) { i = 1; foreach (ListViewItem.ListViewSubItem lvs in lvi.SubItems) { cells[i2, i] = lvs.Text; ws.Columns.AutoFit(); if (lvs.Text.Contains(">")) { cells[i2, i].Font.Color = Color.CornflowerBlue; } if (lvs.ForeColor == Color.Firebrick) { cells[i2, i].Font.Color = Color.Firebrick; } else if (lvs.ForeColor == Color.Olive) { cells[i2, i].Font.Color = Color.Olive; } else if (lvs.ForeColor == Color.LimeGreen) { cells[i2, i].Font.Color = Color.LimeGreen; } else if (lvs.ForeColor == Color.Orange) { cells[i2, i].Font.Color = Color.Orange; } i++; } i2++; } saveFileDialog1.ShowDialog(); wb.SaveAs(saveFileDialog1.FileName); wb.Close(); linkLabel2.Text = "Export"; } 

有谁知道我怎么能使这个更快?