Class TableGenerator

信息

表示 Documentize.TableGenerator 插件。用于向 PDF 文档添加表格。

public sealed class TableGenerator

继承

objectTableGenerator

继承成员

示例

该示例演示了如何向 PDF 文件添加表格。

// 初始化 TableGenerator
var plugin = new TableGenerator();
// 配置表格选项
var options = new TableOptions().InsertPageBefore(1)
   .AddTable()
        .AddRow()
            .AddCell().AddParagraph("姓名")
            .AddCell().AddParagraph("年龄")
        .AddRow()
            .AddCell().AddParagraph("Bob")
            .AddCell().AddParagraph("12")
        .AddRow()
            .AddCell().AddParagraph("Sam")
            .AddCell().AddParagraph("20")
        .AddRow()
            .AddCell().AddParagraph("Sandy")
            .AddCell().AddParagraph("26")
        .AddRow()
            .AddCell().AddParagraph("Tom")
            .AddCell().AddParagraph("12")
        .AddRow()
            .AddCell().AddParagraph("Jim")
            .AddCell().AddParagraph("27");
// 添加输入文件路径
options.AddInput(new FileDataSource("path_to_input.pdf"));
// 设置输出文件路径
options.AddOutput(new FileDataSource("path_to_output.pdf"));
// 执行该过程
plugin.Process(options);

构造函数

TableGenerator()

public TableGenerator()

方法

Process(TableOptions)

向 PDF 文档添加表格。

public ResultContainer Process(TableOptions options)

参数

返回

ResultContainer : 包含操作结果的对象。

异常

ArgumentException

如果未设置选项。

命名空间: Documentize 程序集: Documentize.dll

 中文