ExecuteVCRDataMergeCurrent
集成与兼容性
需要 Small Business 版。在 Delphi、C++Builder 和 Lazarus 代码中,请将库创建为 TPDFlibSmallBusiness(单元 PDFlibSmallBusiness)或 TPDFlibEnterprise;Small Business 版和 Enterprise 版的 DLL 与 ActiveX 构建原样提供该类。Single 版保留此方法,它返回 0,并将 LastErrorCode 设置为 901 (PDFLIB_ERROR_SMALLBUSINESS_REQUIRED)
描述
把字段值合并进所选 PDF/VCR 模板文档,并把结果加载为新的所选文档,原模板保持打开
JSON 字段名与值使用标准 JSON 字符串转义(含 Unicode 转义);显式空字符串会清空对应占位符,而缺失的字段保持其占位符不变
语法
Delphi
Function TPDFlib.ExecuteVCRDataMergeCurrent(Const FieldValues: WideString;
Options: Integer): Integer; Virtual;ActiveX
Function PDFlib::ExecuteVCRDataMergeCurrent(FieldValues As String, Options As Long) As LongDLL
int DLExecuteVCRDataMergeCurrent(int InstanceID, const wchar_t* FieldValues, int Options);
int DLExecuteVCRDataMergeCurrentA(int InstanceID, const char* FieldValues, int Options);DLExecuteVCRDataMerge 与 DLExecuteVCRDataMergeA 是 Current 这一对的旧版导出别名,参数与行为完全相同
参数
| FieldValues | JSON 对象,或以分号分隔的 name=value 占位值列表 |
|---|---|
| Options | 必须为 0 |
返回值
合并副本被选中时返回 1,失败返回 0;不受支持的 Options 或模板/合并失败会报告 LastErrorCode 608
备注
所选模板先在内存中保存并校验,合并结果只在成功时加载;失败时不会选中一份残缺文档。原模板仍可通过先前的 SelectedDocument 句柄访问
DLL 与 ActiveX 的 ExecuteVCRDataMerge 入口点走的就是这条路线;参见 自动化扩展