C#或.net中用NPIO要怎样才能导出2007以上的Excel(.xlsx)?

2022-03-17 教育 97阅读
publicstaticvoidDownData(DataViewdvData,stringfileName)
{
StringBuilderstrBd=newStringBuilder(EXCELHTMLHEAD+"");
intcols=dvData.Table.Columns.Count;
for(intj=0;jstrBd.Append(""+dvData.Table.Columns[j].Caption+"");
strBd.Append("");

for(inti=0;i{
strBd.Append("");
for(intj=0;jstrBd.Append(""+Lixiang.Common.HtmlToTxt(Convert.ToString(dvData[i][j]))+"");
strBd.Append("");
}
strBd.Append("");

DownData(strBd.ToString(),fileName);
}

publicconststringEXCELHTMLHEAD=@"xmlns:x='urn:schemas-microsoft-com:office:excel'xmlns='http://www.w3.org/TR/REC-html40'>

";
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com