[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: way to output spreadsheets to postscript or PDF programmatically



Kevin Murphy wrote:
I'd like to programmatically produce printable (PDF? Postscript?) spreadsheet-style output of database queries with these characteristics:

* line borders around cells
* customized header and footer
* first row should be repeated on each page
* preferably, auto-sizing of columns, but not required
<snip>

This may be a parochial solution (I'm an html coder), but what you describe is default behavior for html. Write the data to a table.

<table>
  <thead>
    <tr>
      <th>$field-name</th>
      ...
    </tr>
  </thead>
  <tfoot>
    <tr>
      <th>$field-name</th>
      ...
    </tr>
  </tfoot>
  <tbody>
    <tr>
      <td>...</td>
      ...

The thead and tfoot will repeat at the top and bottom of each printed page. From your browser, eg. Firefox, print to file.

Alternatively, run the html through html2ps. I don't believe that will cause headers and footers to be printed on each page, as that is a browser function--not tested.

Not real elegant, but doable if you don't find a suitable report generator.

cheers,

gary

--
Anyone can build a usable web site.  It takes a graphics designer to
make it slow, confusing, and painful to use.



Reply to: