php - 通过 PHP 挂起生成 Crystal Report

标签 php iis crystal-reports

我正在尝试使用 PHP 脚本生成 Crystal 报告。该脚本似乎在 ReadRecords() 之后挂起;日志文件中不会生成错误消息。我做错了什么吗?

$my_report = "C:\\inetpub\\wwwroot\\mamobile\\reports\\invoice.rpt";
$my_pdf = "C:\\inetpub\\wwwroot\\mamobile\\reports\\test.pdf";

$ObjectFactory = new COM("CrystalReports115.ObjectFactory.1");

$crapp = $ObjectFactory->CreateObject("CrystalDesignRuntime.Application.11");

$creport = $crapp->OpenReport($my_report, 1);

$creport->EnableParameterPrompting = 0;

$creport->DiscardSavedData;
$creport->ReadRecords();

$creport->FormulaSyntax = 0;
$creport->RecordSelectionFormula = "{invoice.invoiceid} = 20070128114815";

$creport->ExportOptions->DiskFileName = $my_pdf;
$creport->ExportOptions->FormatType = 31;
$creport->ExportOptions->DestinationType=1;
$creport->Export(false);

$creport = null;
$crapp = null;
$ObjectFactory = null;

此代码的类似版本适用于不同的报告。

$my_report = "C:\\inetpub\\wwwroot\\mamobile\\reports\\" . $name;
$my_pdf = "C:\\inetpub\\wwwroot\\mamobile\\reports\\test.pdf";

$ObjectFactory = new COM("CrystalReports115.ObjectFactory.1");

$crapp = $ObjectFactory->CreateObject("CrystalDesignRuntime.Application.11");

$creport = $crapp->OpenReport($my_report, 1);

$creport->EnableParameterPrompting = 0;

$creport->DiscardSavedData;
$creport->ReadRecords();

$creport->ExportOptions->DiskFileName = $my_pdf;
$creport->ExportOptions->FormatType = 31;
$creport->ExportOptions->DestinationType=1;
$creport->Export(false);

$creport = null;
$crapp = null;
$ObjectFactory = null;

最佳答案

这就是解决我的问题的方法。

$my_report = "C:\\inetpub\\wwwroot\\mamobile\\reports\\invoice.rpt";
$my_pdf = "C:\\inetpub\\wwwroot\\mamobile\\reports\\test.pdf";

$ObjectFactory = new COM("CrystalReports115.ObjectFactory.1");

$crapp = $ObjectFactory->CreateObject("CrystalRuntime.Application.11");

$creport = $crapp->OpenReport($my_report, 1);

$creport->EnableParameterPrompting = 0;
$creport->FormulaSyntax = 0;


$creport->DiscardSavedData();
$creport->RecordSelectionFormula = "{invoice.invoiceid} = 20070128114815";
$creport->ReadRecords();

$creport->ExportOptions->DiskFileName = $my_pdf;
$creport->ExportOptions->FormatType = 31;
$creport->ExportOptions->DestinationType=1;
$creport->Export(false);

$creport = null;
$crapp = null;
$ObjectFactory = null;

关于php - 通过 PHP 挂起生成 Crystal Report,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35141268/

相关文章:

php - SQL 插入语句挂起

crystal-reports - 如何在 Crystal Reports 2008 中正确对齐数字字段?

c# - 在 Crystal Reports 中动态更改数据库类型、源等(适用于 Visual Studio 2012)

php - 删除除最后一个文件之外的旧文件系列

php - 保护 MySQL 密码和管理多个帐户的最佳做法是什么?

php - SQLSTATE[HY000] : OCISessionBegin: ORA-21561: OID generation failed

asp.net - 如何设置通配符 (*) 子域?

http - IIS 6.0 上的设置错误代码

WCF 部署到 IIS 6 导致 403 权限错误

visual-studio - Crystal 报表的HTML文本渲染问题