- var dlg = new SaveFileDialog();
- dlg.DefaultExt = "xlsx";
- dlg.Filter =
- "Excel Workbook (*.xlsx)|*.xlsx|" +
- "HTML File (*.htm;*.html)|*.htm;*.html|" +
- "Comma Separated Values (*.csv)|*.csv|" +
- "Text File (*.txt)|*.txt|" +
- "PDF (*.pdf)|*.pdf";
- if (dlg.ShowDialog().Value)
- {
- using (var s = dlg.OpenFile())
- {
- var ext = System.IO.Path.GetExtension(dlg.SafeFileName).ToLower();
- switch (ext)
- {
- case ".htm":
- case ".html":
- _flex.Save(s, FileFormat.Html, SaveOptions.Formatted);
- break;
- case ".csv":
- _flex.Save(s, FileFormat.Csv, SaveOptions.Formatted);
- break;
- case ".txt":
- _flex.Save(s, FileFormat.Text, SaveOptions.Formatted);
- break;
- case ".pdf":
- SavePdf(s, " Excel文件");
- break;
- case ".xlsx":
- default:
- _flex.SaveXlsx(s);
- break;
- }
- }
- }
复制代码
ComponentOne Samples\Studio for Silverlight\C1.Silverlight.FlexGrid\CS\ExcelBook 样例中 有个导出Excel 功能,
但是这个功能在xp环境 导出2003格式都是乱码,而且没有文件类型过滤。如何让FlexGrid导出支持 office 03格式文件,不想在额外添加方法或者引第三方控件了。有没有方法 ?
|