note 98035 added to ref.com

From: Date: Fri, 21 May 2010 16:22:26 +0000
Subject: note 98035 added to ref.com
Groups: php.notes 
Request: Send a blank email to php-notes+get-169505@lists.php.net to get a copy of this message
This snippet loads a Crystal Report file, assigns the content of the variable 'dateCT' to an empty formula field in the said report and outputs everything in a PDF... took me forever to find how to do it so I figured I'd share. $COM_Object = "CrystalRunTime.Application.10"; $my_report = getcwd() . "\\rapports\\report.rpt"; $my_pdf = getcwd() . "\\rapports\\test.pdf"; $crapp= New COM($COM_Object) or die("Unable to Create Object"); //$test = New COM("CrystalDecisions.CrystalReports.Engine"); try { $creport = $crapp->OpenReport($my_report, 1); $creport->DiscardSavedData; if (!empty($_POST['dateCT'])) { if (!$estPremier) { $formuleSelection .= " AND "; } $formuleSelection .= "("; $formuleSelection .= "{tblcartetempsmain.Date} >= #" . formaterDate($_POST['dateCT']) . "# "; $formuleSelection .= ")"; $estPremier = false; //Don't forget the damn single brackets to wrap the //string!!! $creport->FormulaFields->GetItemByName('txtDateDebut')->Text = "'" . $_POST['dateCT'] . "'"; } $creport->RecordSelectionFormula = $formuleSelection; $creport->ReadRecords(); $creport->ExportOptions->DiskFileName=$my_pdf; $creport->ExportOptions->PDFExportAllPages=true; $creport->ExportOptions->DestinationType=1; // Export to File $creport->ExportOptions->FormatType=31; // Type: PDF $creport->Export(false); header("Location: rapports/test.pdf"); } catch (com_exception $error) { echo $error->getMessage(); } ---- Server IP: 64.71.164.2 Probable Submitter: 69.70.63.186 ---- Manual Page -- http://www.php.net/manual/en/ref.com.php Edit -- https://master.php.net/note/edit/98035 Del: integrated -- https://master.php.net/note/delete/98035/integrated Del: useless -- https://master.php.net/note/delete/98035/useless Del: bad code -- https://master.php.net/note/delete/98035/bad+code Del: spam -- https://master.php.net/note/delete/98035/spam Del: non-english -- https://master.php.net/note/delete/98035/non-english Del: in docs -- https://master.php.net/note/delete/98035/in+docs Del: other reasons-- https://master.php.net/note/delete/98035 Reject -- https://master.php.net/note/reject/98035 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#169505) next »