【Stimulsoft Reports PHP教程】在服务器端保存报表

下载Stimulsoft Reports PHP最新版本

此示例显示如何在HTML Designer中的PHP服务器端保存报表模板。为此,您需要添加onSaveReport事件处理程序:

designer.onSaveReport = function (event) {
    <?php StiHelper::createHandler(); ?>
}

在PHP服务器端,您需要保存从Designer传递的JSON报表模板对象。这应该在做$ handler-> onSaveReport事件handler.php文件。例如,此代码将报表模板保存到“reports”文件夹中的JSON文本文件:

$handler->onSaveReport = function ($event) {
    $report = $event->report; // Report JSON object
    $fileName = $event->fileName; // Report file name
 
    file_put_contents('reports/'.$fileName.".mrt",json_encode($report));
 
    return StiResult::success("Save Report OK: ".$fileName);
};

下面的屏幕截图中,您可以看到示例代码的结果。

Stimulsoft

下载示例

猜你喜欢

转载自blog.csdn.net/xiaochuachua/article/details/84562591
今日推荐