哪位大哥能帮忙把程序给优化一下阿????现在这种循环速度慢的要死了......private void button1_Click(object sender, System.EventArgs e)
{
Excel.ApplicationClass excel = new Excel.ApplicationClass();
_Workbook workbook=null;
try
{
workbook=excel.Workbooks._Open(txtExcelFile.Text,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);
_Worksheet worksheet=(_Worksheet)workbook.Worksheets.get_Item(1);
string curCell = Combine2Int(1,1);
string curCell2= Combine2Int(worksheet.UsedRange.Rows.Count,worksheet.UsedRange.Columns.Count);
Excel.Range rg=worksheet.get_Range(curCell,curCell2);
OWC10.Range rg2 = axSpreadsheet1.ActiveSheet.get_Range(curCell,curCell2);
rg2.Value2=rg.Value2;
/**样式*/

for(int i=1;i<=worksheet.UsedRange.Rows.Count;i++)
{
for(int j=1;j<=worksheet.UsedRange.Columns.Count;j++)
{
curCell=Combine2Int(i,j);
rg=worksheet.get_Range(curCell,curCell);
rg2 = axSpreadsheet1.ActiveSheet.get_Range(curCell,curCell);
rg2.set_ColumnWidth((double)rg.ColumnWidth);
rg2.set_RowHeight((double)rg.RowHeight);
rg2.Font.set_Underline((OWC10.XlUnderlineStyle)rg.Font.Underline);
rg2.Font.set_Bold((bool)rg.Font.Bold);
rg2.Font.set_Italic((bool)rg.Font.Italic);
rg2.Font.set_Name((string)rg.Font.Name);
rg2.Font.set_Size((double)rg.Font.Size);
object fontColor =rg.Font.Color; 
rg2.Font.set_Color(ref fontColor);
object color = rg.Interior.Color;
rg2.Interior.set_Color(ref color);
rg2.Borders[OWC10.XlBordersIndex.xlEdgeBottom].set_LineStyle((OWC10.XlLineStyle)rg.Borders[Excel.XlBordersIndex.xlEdgeBottom].LineStyle);
color=rg.Borders[Excel.XlBordersIndex.xlEdgeBottom].Color;
rg2.Borders[OWC10.XlBordersIndex.xlEdgeBottom].set_Color(ref color);
rg2.Borders[OWC10.XlBordersIndex.xlEdgeBottom].set_Weight((OWC10.XlBorderWeight)rg.Borders[Excel.XlBordersIndex.xlEdgeBottom].Weight); rg2.Borders[OWC10.XlBordersIndex.xlEdgeLeft].set_LineStyle((OWC10.XlLineStyle)rg.Borders[Excel.XlBordersIndex.xlEdgeLeft].LineStyle);
color=rg.Borders[Excel.XlBordersIndex.xlEdgeLeft].Color;
rg2.Borders[OWC10.XlBordersIndex.xlEdgeLeft].set_Color(ref color);
rg2.Borders[OWC10.XlBordersIndex.xlEdgeLeft].set_Weight((OWC10.XlBorderWeight)rg.Borders[Excel.XlBordersIndex.xlEdgeLeft].Weight); rg2.Borders[OWC10.XlBordersIndex.xlEdgeRight].set_LineStyle((OWC10.XlLineStyle)rg.Borders[Excel.XlBordersIndex.xlEdgeRight].LineStyle);
color=rg.Borders[Excel.XlBordersIndex.xlEdgeRight].Color;
rg2.Borders[OWC10.XlBordersIndex.xlEdgeRight].set_Color(ref color);
rg2.Borders[OWC10.XlBordersIndex.xlEdgeRight].set_Weight((OWC10.XlBorderWeight)rg.Borders[Excel.XlBordersIndex.xlEdgeRight].Weight); rg2.Borders[OWC10.XlBordersIndex.xlEdgeTop].set_LineStyle((OWC10.XlLineStyle)rg.Borders[Excel.XlBordersIndex.xlEdgeTop].LineStyle);
color=rg.Borders[Excel.XlBordersIndex.xlEdgeTop].Color;
rg2.Borders[OWC10.XlBordersIndex.xlEdgeTop].set_Color(ref color);
rg2.Borders[OWC10.XlBordersIndex.xlEdgeTop].set_Weight((OWC10.XlBorderWeight)rg.Borders[Excel.XlBordersIndex.xlEdgeTop].Weight); rg2.set_VerticalAlignment((OWC10.XlVAlign)rg.VerticalAlignment);
rg2.set_HorizontalAlignment((OWC10.XlHAlign)rg.HorizontalAlignment);
rg2.set_NumberFormat((string)rg.NumberFormat); }
}
                
}
catch(Exception ex)
{
MessageBox.Show(ex.Source);
}
finally
{
workbook.Close(false,Type.Missing,Type.Missing);
excel.Quit();
KillProcess();
}
}
private void KillProcess()
{
System.Diagnostics.Process[] myProcess;
myProcess=System.Diagnostics.Process.GetProcessesByName("EXCEL");
foreach(System.Diagnostics.Process process in myProcess)
{
process.Kill();
}
}
public string Combine2Int(int row ,int col)
{
char [] colArr = {' ','a','b','c','d','e','f','g','h','i','j','k','l'
 ,'m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; int a ,b ;
string sTemp ; if ( col < 27)
sTemp = colArr[col].ToString();
else
{
a =  (col - 1) /26;
b =  col - a * 26;
sTemp = colArr[a].ToString() + (string)colArr[b].ToString();
} return sTemp + row.ToString();
}