我是先用Gridview导出,然后再转换格式,部分代码如下
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GV.RenderControl(htw);
File.WriteAllText(path+"temp", sw,System.Text.Encoding.UTF7);
Excel.Application excelApp = new Excel.ApplicationClass();
Excel.Workbooks wbs = excelApp.Workbooks;
Excel.Workbook wb = wbs.Open(path + "temp", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);//创建WorkBook
wb.SaveAs(path, Excel.XlFileFormat.xlExcel7, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing, Type.Missing, System.Text.Encoding.UTF7, Type.Missing, Type.Missing);
系统为英文的Windows 2003,Office也是2003英文版
已在Regional and Language Options中选择了Chinese (PRC)
GV导出的文件中文显示正确,转换格式后中文变为乱码
Cats萌萌
莫回无
绝地无双
眼眸繁星
SMILET
慕神8447489
30秒到达战场
ITMISS
隔江千里