日期:2014-05-18 浏览次数:20461 次
public void ToExcel() { AppLibrary.WriteExcel.XlsDocument doc = new AppLibrary.WriteExcel.XlsDocument(); doc.FileName = "Report.xls"; string SheetName = string.Empty; //记录条数 int mCount = 55; //每个SHEET的数量 int inv = 10; //计算当前多少个SHEET int k = Convert.ToInt32(Math.Round(Convert.ToDouble(mCount / inv))) + 1; for (int i = 0; i < k; i++) { SheetName = "当前是SHEET" + i.ToString(); AppLibrary.WriteExcel.Worksheet sheet = doc.Workbook.Worksheets.Add(SheetName); AppLibrary.WriteExcel.Cells cells = sheet.Cells; //第一行表头 cells.Add(1, 1, "序号"); cells.Add(1, 2, "准考证号"); cells.Add(1, 3, "考生姓名"); cells.Add(1, 4, "性别"); cells.Add(1, 5, "报考专业"); int f = 1; for (int m = i * inv; m < mCount && m < (i + 1) * inv; m++) { f++; cells.Add(f, 1, f - 1); cells.Add(f, 2, f); cells.Add(f, 3, "woody.wu"); cells.Add(f, 4, "男"); cells.Add(f, 5, "经济学"); } } doc.Send(); Response.Flush(); Response.End(); } 网上能查到的就这点介绍! 如果合并列后怎么给列赋值! 有谁用过? 能否发些例子来看下! 还怎么赋颜色值!