Skip to main content

Excel API library for BIFF7 (Windows only), BIFF8 and OpenXML formats.

Total Downloads
1.8K
1,837
Published
Jun 17, 2026
4mo ago

Get Started

dotnet add package GCCN.ActiveReports.SpreadBuilder --version 3.0.3
ProductVersions
.NET Standard
netstandard2.0
Other
.NETFramework4.7.2

README

简介

ActiveReports 是一款专注于 .NET 和 .NET Core 平台的报表控件。通过拖拽式报表设计器,可以快速地设计 Excel表格、Word文档、图表、数据过滤、数据钻取、精准套打等类型报表

ActiveReports 为开发者和最终用户提供了丰富的报表功能,包括:

  • 集成到 VisualStudio 中便于开发使用;
  • 支持 PaaS 部署方式,例如 Azure Linux App Service;
  • 数据透视和多种聚合方式;
  • 丰富的数据可视化展示方式;
  • 可导出为多种主流文档格式,例如 PDF/Excel/Word;
  • 更多产品特性和资料可访问 https://www.grapecity.com.cn/developer/activereports;

功能说明

该包包含用于读取、操作和写入 Excel 文件的 .NET 和 .NET Core 程序集。

示例代码:

// 创建工作簿并添加一个工作表
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(1, 1);
System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
GrapeCity.SpreadBuilder.Workbook sb = new GrapeCity.SpreadBuilder.Workbook((text, measurementParams) =>
{
    // 为自动行高进行的代码配置
    System.Drawing.FontStyle style = System.Drawing.FontStyle.Regular;
    if (measurementParams.FontBold) style |= System.Drawing.FontStyle.Bold;
    if (measurementParams.FontItalic) style |= System.Drawing.FontStyle.Italic;
    using (System.Drawing.Font gFont = new System.Drawing.Font(measurementParams.FontName, measurementParams.FontSize, style))
    {
        int maxWidth = (int)System.Math.Ceiling(measurementParams.MaxWidth);
        System.Drawing.SizeF size = graphics.MeasureString(text, gFont, maxWidth == 0 ? 999999 : maxWidth);
        return new System.Drawing.SizeF((float)System.Math.Ceiling(size.Width), (float)System.Math.Ceiling(size.Height));
    }
});
sb.Sheets.AddNew();
  
// 为行、列和单元格设置数据
sb.Sheets[0].Name = "Customer Call List";
sb.Sheets[0].Columns(0).Width = 2 * 1440;
sb.Sheets[0].Columns(1).Width = 1440;
sb.Sheets[0].Columns(2).Width = 1440;
sb.Sheets[0].Rows(0).Height = 1440 / 4;
  
// 标题行
sb.Sheets[0].Cell(0,0).SetValue("Company Name");
sb.Sheets[0].Cell(0,0).FontBold = true;
sb.Sheets[0].Cell(0,1).SetValue("Contact Name");
sb.Sheets[0].Cell(0,1).FontBold = true;
sb.Sheets[0].Cell(0,2).SetValue("Phone");
sb.Sheets[0].Cell(0,2).FontBold = true;
  
// 第一个数据行
sb.Sheets[0].Cell(1,0).SetValue("GrapeCity");
sb.Sheets[0].Cell(1,1).SetValue("Mortimer");
sb.Sheets[0].Cell(1,2).SetValue("(425) 880-2601");
  
// 保存为 Excel 文件
sb.Save("test.xls");

查看更多

Downloads by Version

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.