Print the grid!
Hi..
I have a Page just with a GRID with 131 Rows.. when i tried to print this page, i had 3 pages (2 emptys page, and the last 36 rows in 1 page)
its there anyway to print all the Grid..
How can I change the number of visible rows in the system and in the printer.
I applied the media argument in the CSS file.. but I dont know why is taking the last rows to print
Thanx inadvanced
Luis Islas
August 17,
I'd also like to know how to print the entire grid.
August 19,
try experimenting with css tyle like
<style>
@media print
{
.active-controls-grid {height: 2000px;}
}
</style>
this will increase the height of grid so that all rows are visible. printing is disturbed whenever some scrollbar appears
grid height = 20px + columnCount x 18px
20px is default header height in XP style
and 18px is height of each row
hope this helps.
cheers,
Sudhaker Raj
August 20,
there should be something very simple to reset the overflow for grid while prinint. that way, no scroll bar and printing will be as expected...
alex - please suggest something.
Sudhaker Raj
August 20,
I don't have a good solution for printing yet, it seems necessary to change the script as well, which I am trying to avoid. Here is CSS which may help (it does not print headers at all and works only in IE):
<style>
@media print
{
.active-scroll-bars,
.active-scroll-left,
.active-scroll-top,
.active-scroll-corner {
display: none;
}
.active-controls-grid {
overflow: visible;
height: auto;
width: auto;
}
.active-scroll-data {
position: relative;
overflow: visible;
width: auto!important;
height: auto!important;
}
}
</style>
Alex (ActiveWidgets)
August 23,
Hi,
Is it possible to print the header too? The print-out doesn't look good without the header.
Thanks,
Monica
January 31,
I found this function, didn't test it in many pages, but seems to print quite good.
HTH
/*
This script is written by Eric (Webcrawl@usa.net)
*/
function printit(){
if (window.print) {
window.print() ;
} else {
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";
}
}
var NS = (navigator.appName == "Netscape");
var VERSION = parseInt(navigator.appVersion);
if (VERSION > 3) {
document.write('<form><input type=button value="Print" name="Print" onClick="printit()"></form>');
}
Carlos
March 6,
Also, didn't test in any browser other than IE, so please send feedback
Thanks
Carlos
March 6,
I have found that the code below seems to work well in I.E. I haven't tried it in any other browser. The only caveat with this is that there can be nothing
below the grid, otherwise whatever's below it will get printed on top of the grid. I haven't found a good way around this other than to set the height manually ("height: 2000px;")
@media print
{
.active-scroll-bars,
.active-scroll-left,
.active-scroll-corner {
display: none;
}
.active-scroll-top {
position: absolute;
overflow: visible;
width: auto!important;
height: auto!important;
}
.active-controls-grid {
overflow: visible;
height: auto;
width: auto;
}
.active-scroll-data {
position: absolute;
overflow: visible;
width: auto!important;
height: auto!important;
}
}
Brian McCrary
July 11,
...And if you want the first column (the line numbers) to display, just leave off the ".active-scroll-left" line above.
Brian McCrary
July 11,
How about making a html view of the page and then printing from that window. Here is the function:
// Print the page to a html view for printing
function printPage(){
var rmax = obj.getRowCount();
var cmax = obj.getColumnCount();
var pagetext = "<html><head><title>HTML View Page</title></head><body>";
pagetext += "<table cellspacing=0 border=1 CELLPADDING=1 ><tr>";
for (var j=0; j<myHeaders.length; j++){
pagetext += "<td>" + myHeaders[j] + "</td>";
}
pagetext += "</tr>";
for (var i=0; i<rmax; i++){
pagetext += "<tr>";
for (var c=0; c<cmax; c++){
var cellStr = obj.getCellValue(c,i); // get the string in the cell
pagetext += "<td>" + cellStr + "</td>";
}
pagetext += "</tr>";
}
pagetext += "</table>";
pagetext += "</body></html>";
var printpop = window.open(
''
,'name'
,'dependent,location=no,toolbar=yes, menubar=yes, resizable=yes,scrollbars=yes,width=600,height=400'
);
var tmp = printpop.document;
tmp.write(pagetext);
tmp.close();
}
ShepherdOwner
March 16,
I need to set a web form into Landscape for printing.So this results doesn't work!
Nthabiseng
April 18,
I need to have an javescript object (array) and covert it in HTML format, to be printed.
Rudins
June 15,
Hi..
I have a Page just with a GRID with 104 Rows.. when i tried to print this page, i had 4 pages, but the title of the Rows appeared in the first page only, i wanna the title appeared in the front of each page, how should i do?
Thanks
jordan
August 19,