我想将Execl的表的边框啊,颜色修饰一下,还有有的数据的格式如本来是”0001“的数据却变成了“1”,请大虾位指点指点。
private void Button1_Click(object sender, System.EventArgs e)
{
 
 
ClassUseful  cuf=new ClassUseful();
         string ls_sql="select top 300  MaterialCode,BarCode,NewOld,MaterialName,CardName,ItemName,ModelName,KindName,SeriesName,SeasonName,yearNo,MaterialShortName from dbo.VIEW_Material ";
 
 
    DataTable dt=new DataTable();
dt=cuf.GetRecordsEx(ls_sql,"Initial Catalog=ysff;Data Source=localhost;uid=sa;pwd=sa"); SpreadsheetClass xlsheet = new SpreadsheetClass();
 
xlsheet.ActiveSheet.Cells[1,1]="货号";
xlsheet.ActiveSheet.Cells[1,2]="条码";
xlsheet.ActiveSheet.Cells[1,3]="新旧";
xlsheet.ActiveSheet.Cells[1,4]="货品名称";
xlsheet.ActiveSheet.Cells[1,5]="品牌";
xlsheet.ActiveSheet.Cells[1,6]="项目";
xlsheet.ActiveSheet.Cells[1,7]="款型";
xlsheet.ActiveSheet.Cells[1,8]="类别";
xlsheet.ActiveSheet.Cells[1,9]="系列";
xlsheet.ActiveSheet.Cells[1,10]="季节";
xlsheet.ActiveSheet.Cells[1,11]="年份";
xlsheet.ActiveSheet.Cells[1,12]="货品简称";
 
for (int i=0;i<dt.Rows.Count;i++) 
{
for (int j=0;j<dt.Columns.Count;j++) 
{
if (dt.Rows[i][j].ToString().Trim()!=string.Empty)
{
xlsheet.ActiveSheet.Cells[i+2,j+1] =" "+dt.Rows[i][j].ToString();
}
}
} xlsheet.ActiveSheet.Export(Server.MapPath(".")+"\\excel-file\\79.xls",OWC.SheetExportActionEnum.ssExportActionNone);
            Response.Redirect(Server.MapPath(".")+"\\excel-file\\79.xls",true);
}