在VS中添加DevExpress Document Server:[1]

 时间:2024-10-12 00:57:07

1、打开Visual Studio,然后通过选择FILE-New-Project…,创建一个新的Windows Forms Application项目。

在VS中添加DevExpress Document Server:[1]

2、添加以下库为引用:DevExpress.Data.v13.1.dll、 DevExpress.Docs.v13.1.dll、 DevExpress.Office.v13.1.Core.dl造婷用痃l、 DevExpress.Spreadsheet.v13.1.Core.dll和DevExpress.Utils.v13.1.dll。

在VS中添加DevExpress Document Server:[1]

3、其实集成步骤在上一部已经完成了,接下来用个小例子为大家展示下简单的功能。使用以下代码:using 肛舀辨乔DevExpress.Spreadsheet;// ...// Create an instance of a workbook.Workbook workbook = new DevExpress.Spreadsheet.Workbook();// Access the first worksheet in the workbook.Worksheet worksheet = workbook.Worksheets[0];// Access the "A1" cell in the worksheet.Cell cell = worksheet.Cells["A1"];// Specify the "A1" cell value.cell.Value = 1;// Fill cells with sequential numbers by using shared formulas.worksheet.Range["A2:A10"].Formula = "=SUM(A1+1)";worksheet.Range["B1:B10"].Formula = "=A1+2";// Multiply values contained in the cell range A1 through A10// by the corresponding values contained in B1 through B10,// and display the results in cells C1 through C10.worksheet.Cells["C1"].CreateArrayFormula("=A1:A10*B1:B10", 10, 1);// Save the document file under the specified name.workbook.SaveDocument("TestDoc.xlsx", DocumentFormat.OpenXml);// Display gridlines in PDF.worksheet.PrintOptions.PrintGridlines = true;// Export the document to PDF.workbook.ExportToPdf("TestDoc.pdf");// Open the PDF document using the default viewer..System.Diagnostics.Process.Start("TestDoc.pdf");// Open the XLSX document using the default application.System.Diagnostics.Process.Start("TestDoc.xlsx");

4、运行项目,下图就是执行了以上代码后生成的文件。

在VS中添加DevExpress Document Server:[1]
  • 怎样使用VBA单元格链接?
  • Windows PowerShell如何更改窗口大小
  • 如何区别linux中的文件与文件夹?
  • 怎样使用VBA用列表框调用动态数据?
  • VBS自定义函数教程
  • 热门搜索
    龙庆峡旅游 内蒙古的旅游景点 全国旅游景点地图高清 扬州凤凰岛生态旅游区 峨眉山旅游景点 温州附近旅游景点大全 旅游ppt背景图片 四川峨眉山旅游攻略 国庆旅游推荐 travelzoo旅游族