日期:2014-05-17 浏览次数:20598 次
SqlParameter[] parameters = {
new SqlParameter("@StoresId", SqlDbType.Int),
};
parameters[0].Value = admin.RoleID.Value;
DataSet ds = DbHelperSQL.RunProcedure("P_GetStoresNum", parameters, "ds");
//这个是导出的内容集合
DataTable dt = ds.Tables[0];
NPOI.HSSF.UserModel.HSSFWorkbook book = new NPOI.HSSF.UserModel.HSSFWorkbook();
NPOI.SS.UserModel.Sheet sheet = book.CreateSheet("门店库存信息");
NPOI.SS.UserModel.Row row = sheet.CreateRow(0);
//标题
string[] title = { "产品", "总个数(个)", "销售总数量(个)", "剩余总数量(个)", "配送到其他门店(个)", " 向其他门店索要(个)" };
for (int i = 0; i < title.Length; i++)
{
row.CreateCell(i).SetCellValue(title[i].ToString());
}
//内容
for (int i = 0; i < dt.Rows.Count; i++)
{
NPOI.SS.UserModel.Row row2 = sheet.CreateRow(i + 1);
row2.CreateCell(0).SetCellValue(dt.Rows[i