导出的excel文件,用excel03打开的时候乱吗,07,10版本都没问题,求助
代码:
public void ExpExcel(C1DataGrid grid,string fileName)
{
var options = new ExcelSaveOptions()
{
FileFormat = ExcelFileFormat.Xlsx,
KeepColumnWidths = true,
KeepRowHeights = true
};
var excelExt = options.FileFormat.ToString();
var dialog = new System.Windows.Controls.SaveFileDialog()
{
DefaultExt = "*." + excelExt,
DefaultFileName = fileName+"_"+DateTime.Now.ToString("yyyyMMdd"),
//Filter = "Excel " + excelExt + " (*." + excelExt + ")|*." + excelExt + "|All files (*.*)|*.*",
Filter = "Execl2003 files (*.xls)|*.xls|Execl2007 files (*.xlsx)|*.xlsx",
};
if (dialog.ShowDialog() == false) return;
using (var stream = dialog.OpenFile())
{
grid.Save(stream, options);
}
} |
|