Hi Tracy,

All I did was change the datagrid name. (If I can remember correctly)

but here is my code just incase (Hoping that someone will help w/ the headder
and footer adding):

====== Start Code ======
function doPrint() {
var pj : PrintJob = new PrintJob();
// position of currently visible rows stored
var prev_vPosition:Number = historyDg.vPosition;
var prev_width:Number = historyDg.width;
var prev_height:Number = historyDg.height;

if(pj.start() != true)
return;
historyDg.setSize(pj.pageWidth,pj.pageHeight);

// number of rows per view, ignoring fractions (floor)
var rowsPerPage:Number = Math.floor((historyDg.height -
historyDg.rowHeight)/ historyDg.rowHeight);
// number of pages to be printed, if there are any fractions, have
one page for that (ceil)
var pages:Number = Math.ceil(historyDg.dataProvider.length /
rowsPerPage);

for (var i=0;i<pages;i++) {
// move the visible row position.
historyDg.vPosition = i*rowsPerPage;
// size box relative to the grid
var b=
{xMin:0,xMax:historyDg.width,yMin:0,yMax:historyDg.height}
pj.addPage(historyDg,b);
}
pj.send();
delete pj;
// position of currently visible rows restored
historyDg.setSize(prev_width,prev_height);
historyDg.vPosition = prev_vPosition;
}

====== END Code ======
thanks,
-Art



Quoting Tracy Spratt <[EMAIL PROTECTED]>:

Have you run the example as is? Maybe there is something else
necessary?

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 24, 2005 2:01 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] "Sample code for printing from a DataGrid":
doesnot work?


Hi Tracy,

I'm using that same function w/o problems to print the info in the
datagrid BUT
I whish I could figure out how to add a headder and footer to the
printjob. I'm
just too unfamiliar with the print function. I've actually never used
it before
this project.

-Art

Quoting Tracy Spratt <[EMAIL PROTECTED]>:

The "Sample code for printing from a DataGrid" posted on the MM site
under the url below does not work:

http://www.macromedia.com/cfusion/knowledgebase/index.cfm?event=view&id=
KC.tn_19241&extid=tn_19241

It is close, it is actually putting the data into the page, but still
only the visible area prints. If I generate 100 lines, the output is
the correct three pages and each page starts on the correct line, but
only the 8 visible lines print on each page.

Has anyone else tried this and succeeded?

Tracy






Yahoo! Groups Links












Yahoo! Groups Links










Reply via email to