I can put out a Word Doc from PHP but if I try and manipulate the font
size in the PHP part it outputs a blank Word Document.
Here is what I have:
<?php
$fname="report. doc";
$handle = fopen( $fname, "rb" );
$buf = fread( $handle, filesize( $fname ));
fclose( $handle );
$len = strlen( $buf );
header( "Pragma: public" );
header( "Cache-Control: private" );
header( "Connection : close" );
header( "Content-Type: application/msword" );
header( "Content-Length: $len" );
header( "Content-Disposition: inline; filename=\"$fna me\"" );
print $buf;
<table border="1">
<tr>
<td>FieldOneHea der</td>
<td>FieldTwoHea der</td>
<td>FieldThreeH eader</td>
....
<td>FieldTenHea der</td>
</tr>
<?php
//Oracle DB Connection username and password etc here
$s = OCIParse($conne ction. "select * from theTable");
OCIExecute($s, OCI_DEFAULT);
while (OCIFetch($s)) {
print '<tr><td><font size="-1">' . ociresult($s, "FIELDONENA ME") .
'</font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDTWONAME") . '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDTHREENAME "). '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDFOURNAME" ). '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDFIVENAME" ). '</
font></td>';
//rest here .......
print '<td><font size="-1">' . ociresult($s, "FIELDNINENAME" ). '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDTENNAME") . '</
font></td></tr>';
}
print '</table>';
?>
The wierd part is if I only put font size in the first 5 fields it
will work:
print '<tr><td><font size="-1">' . ociresult($s, "FIELDONENA ME") .
'</font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDTWONAME") . '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDTHREENAME "). '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDFOURNAME" ). '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDFIVENAME" ). '</
font></td>';
//rest here .......
print '<td>' . ociresult($s, "FIELDNINENAME" ). '</td>';
print '<td>' . ociresult($s, "FIELDTENNAME") . '</td></tr>';
Please advise.
size in the PHP part it outputs a blank Word Document.
Here is what I have:
<?php
$fname="report. doc";
$handle = fopen( $fname, "rb" );
$buf = fread( $handle, filesize( $fname ));
fclose( $handle );
$len = strlen( $buf );
header( "Pragma: public" );
header( "Cache-Control: private" );
header( "Connection : close" );
header( "Content-Type: application/msword" );
header( "Content-Length: $len" );
header( "Content-Disposition: inline; filename=\"$fna me\"" );
print $buf;
>
<tr>
<td>FieldOneHea der</td>
<td>FieldTwoHea der</td>
<td>FieldThreeH eader</td>
....
<td>FieldTenHea der</td>
</tr>
<?php
//Oracle DB Connection username and password etc here
$s = OCIParse($conne ction. "select * from theTable");
OCIExecute($s, OCI_DEFAULT);
while (OCIFetch($s)) {
print '<tr><td><font size="-1">' . ociresult($s, "FIELDONENA ME") .
'</font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDTWONAME") . '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDTHREENAME "). '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDFOURNAME" ). '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDFIVENAME" ). '</
font></td>';
//rest here .......
print '<td><font size="-1">' . ociresult($s, "FIELDNINENAME" ). '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDTENNAME") . '</
font></td></tr>';
}
print '</table>';
?>
The wierd part is if I only put font size in the first 5 fields it
will work:
print '<tr><td><font size="-1">' . ociresult($s, "FIELDONENA ME") .
'</font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDTWONAME") . '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDTHREENAME "). '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDFOURNAME" ). '</
font></td>';
print '<td><font size="-1">' . ociresult($s, "FIELDFIVENAME" ). '</
font></td>';
//rest here .......
print '<td>' . ociresult($s, "FIELDNINENAME" ). '</td>';
print '<td>' . ociresult($s, "FIELDTENNAME") . '</td></tr>';
Please advise.
Comment