DevExpress Document Server保存Excel文件
文档操作组件DevExpress Document Server能够实现非可视化,全代码的对电子表格文件,如Excel等的保存,以下为具体方法。
        要将加载到Workbook对象的内容保存到文档中,需要使用Workbook.SaveDocument方法。
操作方法
- 01创建FileStream对象,然后将文件路径指定到需要保存文件处。 
- 02使用流对象通过一个参数引用Workbook.SaveDocument方法。 
- 03使用DocumentFormat枚举指定文件格式作为方法的第二个参数。 
- 04示例代码如下: using System.IO; using DevExpress.Spreadsheet; // ... Workbook workbook = new Workbook(); // ... // Save the modified document to the stream. using (FileStream stream = new FileStream("Documents\\SavedDocument.xlsx", FileMode.Create, FileAccess.ReadWrite)) { workbook.SaveDocument(stream, DocumentFormat.OpenXml); } 
 赞 (0)
                        
