PERL + Repeat header on every page while printing excel

V

venkatasatyasuresh

Hi,
I am working on an application using PERL 5.8.

I have a requirement where i am getting data from Oracle
database & exporting it to an excel. Users will print this excel file.
We are getting bulk data from database & its printing multiple pages.
On every page we want the header to be present.

Printing the excel file is done manually from the exported
excel. But when he prints the excel, header should repeat on each
page.

Somehow we have found doing this in excel. from File -> page set
up -> Sheet tab, we have to select rows to repeat at top.

But we want this to be done programmatically from PERL. I mean
to say when I export the data to excel file, this file should have
this setting (rows to repeat at top i have to set programmatically).

I can't request the end-user to do this manually.

So any input on this would be great help to me.

Thanks
Suresh
 
I

Ivan Novick

Hi,
I am working on an application using PERL 5.8.

I have a requirement where i am getting data from Oracle
database & exporting it to an excel. Users will print this excel file.
We are getting bulk data from database & its printing multiple pages.
On every page we want the header to be present.

I am hoping you are printing to excel in csv plain text format and not
using binary api specifically for excel.

If you are printing in csv format and want to repeat a header on every
page you can use "perl format" to do this:

http://perldoc.perl.org/functions/format.html

Regards,
Ivan Novick
http://www.0x4849.net
 
R

Ron Bergin

I am hoping you are printing to excel in csv plain text format and not
using binary api specifically for excel. Why?

If you are printing in csv format and want to repeat a header on every
page you can use "perl format" to do this:

http://perldoc.perl.org/functions/format.html

Using an api would give you far more control over the spreadsheet
formatting than the "perl format"

Spreadsheet::WriteExcel - Write to a cross-platform Excel binary file.
http://search.cpan.org/~jmcnamara/S...teExcel.pm#repeat_rows($first_row,_$last_row)
 
P

Peter J. Holzer

<mantra>
The language is spelled "Perl", not "PERL".

What is the purpose of the export?

* To get an Excel file, which people can use for further processing of
the data (compute statistics, make graphs, etc.) and incidentally also
print.

* To print the data.

If it is the latter, then creating a "print file" of some sort (e.g.,
Postscript or PDF, or maybe just plain text) may be a better way,
especially if precise control over the layout is necessary.


I was going to ask the same thing. In this case CSV is completely
unsuitable as you have absolutely no control over the layout. A CSV file
contains only the data, nothing else.


How much is "a page" in CSV? You don't know, or rather, you *do* know
that there is no such thing as a "page" in CSV. The first line may be
header line, but all other lines are supposed to contain only data. You
should not repeat header lines periodically in a CSV file.

Also, "format" is intended for fixed width layouts, which CSV isn't.
If you want to write CSV, DBD::CSV or Text::CSV is probably the way to
go (or just use simple print statements).

Using an api would give you far more control over the spreadsheet
formatting than the "perl format"

Spreadsheet::WriteExcel - Write to a cross-platform Excel binary file.

Right. Or - if the real objective is printing instead of creating an
Excel file - PDF::API2.

hp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top