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

 时间:2026-02-14 01:05:55

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.dll、 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自定义函数教程
  • 热门搜索
    交通安全手抄报内容 护眼手抄报 平安校园手抄报 读书的手抄报 关于节约用水的手抄报 植树节手抄报 廉洁手抄报 祖国在我心中手抄报 禁毒手抄报 四年级手抄报