C1DataGrid是SL版本
样例: C1DataGrid_Demo2010.5/Merging/HeadersMerging_SL5.xaml
用这种方式导出Excel 表头没有,只有数据, 怎么样实现 合并后的表头 可以导出来。
var options = new ExcelSaveOptions()
{
FileFormat = ExcelFileFormat.Xlsx, // change this to offer a different Excel format
KeepColumnWidths = true,
KeepRowHeights = true
};
var excelExt = options.FileFormat.ToString();
var dialog = new System.Windows.Controls.SaveFileDialog()
{
DefaultExt = "*." + excelExt,
Filter = "Excel " + excelExt + " (*." + excelExt + ")|*." + excelExt + "|All files (*.*)|*.*",
};
if (dialog.ShowDialog() == false) return;
using (var stream = dialog.OpenFile())
{
grid.Save(stream, options);
} |