Excel.Application excel=new Excel.Application();
Excel.Workbooks workbooks = excel.Workbooks; 
Excel._Workbook workbook1=excel.Workbooks.Add(XlWBATemplate.xlWBATWorksheet); 
Sheets sheets = workbook1.Worksheets; 
_Worksheet worksheet = (_Worksheet) sheets.get_Item(1);   int rowIndex=1; 
int colIndex=0;  //循环读取生成新表格 
excel.Application.Workbooks.Add(true);              //生成EXCEL的格式设定 
excel.Cells.Font.Bold = false; 
excel.Cells.FillLeft(); 
excel.Cells.Font.Size = "9"; 

//引用函数GetData中所取出的数据,得到数据源 
System.Data.DataTable  table =dt;
      
//将所得到的表的列名,赋值给单元格 
foreach(DataColumn col in table.Columns) 

colIndex++;  
excel.Cells[1,colIndex]=col.ColumnName; 

//同样方法处理数据  foreach(DataRow row in table.Rows) 

rowIndex++; 
colIndex=0; 
//处理各列的数据 
foreach(DataColumn col in table.Columns) 

colIndex++; 
excel.Cells[rowIndex,colIndex]= "'" + row[col.ColumnName].ToString(); 
}

//不可见,即后台处理 
excel.Visible=true;
//友好界面提示 

Excel.XlSaveAsAccessMode asm=Excel.XlSaveAsAccessMode.xlShared;  
object Nothing=System.Reflection.Missing.Value; 
string FileNameString =System.DateTime.Now.ToString("yyyyMMddhhmmss");
string s_FullPath=s_Path + FileNameString+".xls";
excel.ActiveWorkbook.SaveAs( s_FullPath,Nothing,Nothing,Nothing,Nothing,Nothing,asm,Nothing,Nothing,Nothing,Nothing,Nothing);      
excel.Workbooks.Close();
excel.Quit(); 
excel=null; 
表格的边框只有你自己先做个模板,然后录制个宏,在数据充填完毕再调用了