复制代码 代码如下:
string connstr = System.Configuration.ConfigurationManager.ConnectionStrings["DqpiHrConnectionString"].ToString();
SqlConnection conn = new SqlConnection(connstr);
SqlDataAdapter sda = new SqlDataAdapter(sql1.Text, conn);
DataSet ds = new DataSet();
conn.Open();
sda.Fill(ds);
conn.Close();
OWC10.SpreadsheetClass xlsheet;
xlsheet= new OWC10.SpreadsheetClass();
DataRow dr;
int i = 0;
for(int ii=0;ii<ds.Tables[0].Rows.Count;ii++)
{
dr = ds.Tables[0].Rows[ii];
//合并单元格
xlsheet.get_Range(xlsheet.Cells[i+1, 1], xlsheet.Cells[i+1, 8]).set_MergeCells(true);
xlsheet.get_Range(xlsheet.Cells[i + 5, 1], xlsheet.Cells[i + 5, 3]).set_MergeCells(true);
xlsheet.get_Range(xlsheet.Cells[i + 5, 4], xlsheet.Cells[i + 5, 6]).set_MergeCells(true);
xlsheet.get_Range(xlsheet.Cells[i + 5, 7], xlsheet.Cells[i + 5, 8]).set_MergeCells(true);
xlsheet.ActiveSheet.Cells[i + 1, 1] = dr["姓名"].ToString() + "自然情况";
//字体加粗
xlsheet.get_Range(xlsheet.Cells[i + 1, 1], xlsheet.Cells[i + 1, 14]).Font.set_Bold(true);
//单元格文本水平居中对齐
xlsheet.get_Range(xlsheet.Cells[i + 1, 1], xlsheet.Cells[i + 1, 14]).set_HorizontalAlignment(OWC10.XlHAlign.xlHAlignCenter);
//设置字体大小
xlsheet.get_Range(xlsheet.Cells[i + 1, 1], xlsheet.Cells[i + 1, 14]).Font.set_Size(14);
//设置列宽
xlsheet.get_Range(xlsheet.Cells[i + 1, 8], xlsheet.Cells[i + 1, 8]).set_ColumnWidth(20);
//画边框线
xlsheet.get_Range(xlsheet.Cells[i + 1, 1], xlsheet.Cells[i+5, 8]).Borders.set_LineStyle(OWC10.XlLineStyle.xlContinuous);
//写入数据 (这里由DS生成)
xlsheet.ActiveSheet.Cells[i + 2, 1] = "姓名";
xlsheet.ActiveSheet.Cells[i + 2, 2] = dr["姓名"].ToString();
xlsheet.ActiveSheet.Cells[i + 2, 3] = "曾用名";
xlsheet.ActiveSheet.Cells[i + 2, 4] = dr["曾用名"].ToString();
xlsheet.ActiveSheet.Cells[i + 2, 5] = "出生年月";
xlsheet.ActiveSheet.Cells[i + 2, 6] = DateTime.Parse(dr["出生年月"].ToString()).Year.ToString() + "-" + DateTime.Parse(dr["出生年月"].ToString()).Month.ToString();
xlsheet.ActiveSheet.Cells[i + 2, 7] = " 参加工作时间";
xlsheet.ActiveSheet.Cells[i + 2, 8] = DateTime.Parse(dr["参加工作时间"].ToString()).Year.ToString() + "-" + DateTime.Parse(dr["参加工作时间"].ToString()).Month.ToString();
xlsheet.ActiveSheet.Cells[i + 3, 1] = "性别";
xlsheet.ActiveSheet.Cells[i + 3, 2] = dr["性别"].ToString();
xlsheet.ActiveSheet.Cells[i + 3, 3] = "民族";
xlsheet.ActiveSheet.Cells[i + 3, 4] = dr["民族"].ToString();
xlsheet.ActiveSheet.Cells[i + 3, 5] = "政治面貌";
xlsheet.ActiveSheet.Cells[i + 3, 6] = dr["政治面貌"].ToString();
xlsheet.ActiveSheet.Cells[i + 3, 7] = "职称";
xlsheet.ActiveSheet.Cells[i + 3, 8] = dr["职称"].ToString();
xlsheet.ActiveSheet.Cells[i + 4, 1] = "学历";
xlsheet.ActiveSheet.Cells[i + 4, 2] = dr["学历"].ToString();
xlsheet.ActiveSheet.Cells[i + 4, 3] = "学位";
xlsheet.ActiveSheet.Cells[i + 4, 4] = dr["学位"].ToString();
xlsheet.ActiveSheet.Cells[i + 4, 5] = "职务";
xlsheet.ActiveSheet.Cells[i + 4, 6] = dr["职务"].ToString();
xlsheet.ActiveSheet.Cells[i + 4, 7] = "档案号码";
//Excel不支持0开头输入,加上姓氏首字母正好是编号全称
xlsheet.ActiveSheet.Cells[i + 4, 8] = dr["姓氏首字母"].ToString() + dr["档案号码"].ToString();
xlsheet.ActiveSheet.Cells[i + 5, 1] = "现从事专业:" + dr["现从事专业"].ToString();
xlsheet.ActiveSheet.Cells[i + 5, 4] = "工作单位:" + dr["工作单位"].ToString();
xlsheet.ActiveSheet.Cells[i + 5, 7] = "身份证:" + dr["身份证号"].ToString();
i += 6;
}
try
{
string D = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() +
DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString()+
DateTime.Now.Millisecond.ToString();
xlsheet.Export(Server.MapPath("./")+"\\"+D+".xls", OWC10.SheetExportActionEnum.ssExportActionNone, OWC10.SheetExportFormat.ssExportXMLSpreadsheet);
Response.Write("<script>window.open('"+D+".xls')</script>");
}
catch
{
}
}
string connstr = System.Configuration.ConfigurationManager.ConnectionStrings["DqpiHrConnectionString"].ToString();
SqlConnection conn = new SqlConnection(connstr);
SqlDataAdapter sda = new SqlDataAdapter(sql1.Text, conn);
DataSet ds = new DataSet();
conn.Open();
sda.Fill(ds);
conn.Close();
OWC10.SpreadsheetClass xlsheet;
xlsheet= new OWC10.SpreadsheetClass();
DataRow dr;
int i = 0;
for(int ii=0;ii<ds.Tables[0].Rows.Count;ii++)
{
dr = ds.Tables[0].Rows[ii];
//合并单元格
xlsheet.get_Range(xlsheet.Cells[i+1, 1], xlsheet.Cells[i+1, 8]).set_MergeCells(true);
xlsheet.get_Range(xlsheet.Cells[i + 5, 1], xlsheet.Cells[i + 5, 3]).set_MergeCells(true);
xlsheet.get_Range(xlsheet.Cells[i + 5, 4], xlsheet.Cells[i + 5, 6]).set_MergeCells(true);
xlsheet.get_Range(xlsheet.Cells[i + 5, 7], xlsheet.Cells[i + 5, 8]).set_MergeCells(true);
xlsheet.ActiveSheet.Cells[i + 1, 1] = dr["姓名"].ToString() + "自然情况";
//字体加粗
xlsheet.get_Range(xlsheet.Cells[i + 1, 1], xlsheet.Cells[i + 1, 14]).Font.set_Bold(true);
//单元格文本水平居中对齐
xlsheet.get_Range(xlsheet.Cells[i + 1, 1], xlsheet.Cells[i + 1, 14]).set_HorizontalAlignment(OWC10.XlHAlign.xlHAlignCenter);
//设置字体大小
xlsheet.get_Range(xlsheet.Cells[i + 1, 1], xlsheet.Cells[i + 1, 14]).Font.set_Size(14);
//设置列宽
xlsheet.get_Range(xlsheet.Cells[i + 1, 8], xlsheet.Cells[i + 1, 8]).set_ColumnWidth(20);
//画边框线
xlsheet.get_Range(xlsheet.Cells[i + 1, 1], xlsheet.Cells[i+5, 8]).Borders.set_LineStyle(OWC10.XlLineStyle.xlContinuous);
//写入数据 (这里由DS生成)
xlsheet.ActiveSheet.Cells[i + 2, 1] = "姓名";
xlsheet.ActiveSheet.Cells[i + 2, 2] = dr["姓名"].ToString();
xlsheet.ActiveSheet.Cells[i + 2, 3] = "曾用名";
xlsheet.ActiveSheet.Cells[i + 2, 4] = dr["曾用名"].ToString();
xlsheet.ActiveSheet.Cells[i + 2, 5] = "出生年月";
xlsheet.ActiveSheet.Cells[i + 2, 6] = DateTime.Parse(dr["出生年月"].ToString()).Year.ToString() + "-" + DateTime.Parse(dr["出生年月"].ToString()).Month.ToString();
xlsheet.ActiveSheet.Cells[i + 2, 7] = " 参加工作时间";
xlsheet.ActiveSheet.Cells[i + 2, 8] = DateTime.Parse(dr["参加工作时间"].ToString()).Year.ToString() + "-" + DateTime.Parse(dr["参加工作时间"].ToString()).Month.ToString();
xlsheet.ActiveSheet.Cells[i + 3, 1] = "性别";
xlsheet.ActiveSheet.Cells[i + 3, 2] = dr["性别"].ToString();
xlsheet.ActiveSheet.Cells[i + 3, 3] = "民族";
xlsheet.ActiveSheet.Cells[i + 3, 4] = dr["民族"].ToString();
xlsheet.ActiveSheet.Cells[i + 3, 5] = "政治面貌";
xlsheet.ActiveSheet.Cells[i + 3, 6] = dr["政治面貌"].ToString();
xlsheet.ActiveSheet.Cells[i + 3, 7] = "职称";
xlsheet.ActiveSheet.Cells[i + 3, 8] = dr["职称"].ToString();
xlsheet.ActiveSheet.Cells[i + 4, 1] = "学历";
xlsheet.ActiveSheet.Cells[i + 4, 2] = dr["学历"].ToString();
xlsheet.ActiveSheet.Cells[i + 4, 3] = "学位";
xlsheet.ActiveSheet.Cells[i + 4, 4] = dr["学位"].ToString();
xlsheet.ActiveSheet.Cells[i + 4, 5] = "职务";
xlsheet.ActiveSheet.Cells[i + 4, 6] = dr["职务"].ToString();
xlsheet.ActiveSheet.Cells[i + 4, 7] = "档案号码";
//Excel不支持0开头输入,加上姓氏首字母正好是编号全称
xlsheet.ActiveSheet.Cells[i + 4, 8] = dr["姓氏首字母"].ToString() + dr["档案号码"].ToString();
xlsheet.ActiveSheet.Cells[i + 5, 1] = "现从事专业:" + dr["现从事专业"].ToString();
xlsheet.ActiveSheet.Cells[i + 5, 4] = "工作单位:" + dr["工作单位"].ToString();
xlsheet.ActiveSheet.Cells[i + 5, 7] = "身份证:" + dr["身份证号"].ToString();
i += 6;
}
try
{
string D = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() +
DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString()+
DateTime.Now.Millisecond.ToString();
xlsheet.Export(Server.MapPath("./")+"\\"+D+".xls", OWC10.SheetExportActionEnum.ssExportActionNone, OWC10.SheetExportFormat.ssExportXMLSpreadsheet);
Response.Write("<script>window.open('"+D+".xls')</script>");
}
catch
{
}
}
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。
更新日志
2024年11月28日
2024年11月28日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]