通过PHP挂起生成Crystal报表

前端之家收集整理的这篇文章主要介绍了通过PHP挂起生成Crystal报表前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用PHP脚本生成水晶报告.该脚本似乎在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;
原文链接:https://www.f2er.com/php/137368.html

猜你在找的PHP相关文章