问题描述
导出的数据文本左对齐数字右对齐怎么统一?谢谢
解决方案
解决方案二:
protectedvoidexcel_Click(objectsender,EventArgse){Response.Clear();SqlDataAdapterda=newSqlDataAdapter("select*fromTEL_ID",conn);DataSetds=newDataSet();da.Fill(ds,"TEL_INFO");DataTabledt=ds.Tables["TEL_INFO"];range.HorizontalAlignment=Excel.XlHAlign.xlHAlignLeft;StringWritersw=newStringWriter();sw.WriteLine("编号"+"t"+"电话号码"+"t"+"主要使用人"+"t"+"次要使用人"+"t"+"次要使用人"+"t"+"电话信息对应情况"+"t"+"电话归属部门");foreach(DataRowdrindt.Rows){sw.WriteLine(dr["Tel_ID"]+"t"+dr["Tel_No"]+"t"+dr["Tel_User1"]+"t"+dr["Tel_User2"]+"t"+dr["Tel_User3"]+"t"+dr["Tel_InfoPoint"]+"t"+dr["Tel_Branch"]);}sw.Close();Response.AddHeader("Content-Disposition","attachment;filename=TelInfo.xls");Response.AddHeader("Content-Length",sw.ToString());Response.ContentType="application/ms-excel";Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");Response.Write(sw);Response.End();}导出的代码。
解决方案三:
莫人关注。郁闷