473,385 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

javaScript window.print only printing portion from view

gchq
96
Hi there

I have a Table nested in a Div that in turn is nested in panel (with scrollbars) in turn nested in a multiview..

The table has the class set as 'print' - that points to a css file via the link
Expand|Select|Wrap|Line Numbers
  1. <link href="../../../../Styles/Print.css" rel="stylesheet" type="text/css" media="print" />
  2.  
The CSS being quite simple -

Expand|Select|Wrap|Line Numbers
  1. body 
  2. {
  3.     visibility:hidden;
  4. }
  5. .print 
  6. {
  7. visibility:visible;
  8. overflow:visible;
  9.  
  10. }  
  11.  

and a button with the following code in the Page_Load event

Expand|Select|Wrap|Line Numbers
  1. If not page.IsPostBack then
  2. PrintBalanceSheet.Attributes("onClick") = "javascript:window.print();"
  3.  
  4.  
I've tried altering the length of both the Div and the table - there cannot be any 'overflow' and set, in turn, both the div and table class to print - but still it only prints a third of the total - this is probably due to the fact it sits within a panel with a scrollbar

Soooo the question - is there any way (by changing the CSS) to make the whole table visible for printing?
Mar 16 '08 #1
1 2255
gchq
96
Solved it!

Expand|Select|Wrap|Line Numbers
  1. Dim PBS As String
  2.             PBS = "function printContent() { "
  3.             PBS += "var documentContainer = document.getElementById('printDiv'); "
  4.             PBS += "var windowObject = window.open('', 'BalanceSheetData', 'width=740, height=400, toolbars=no, "
  5.             PBS += "scrollbars=yes, status=no, resizable=no'); "
  6.             PBS += "windowObject.document.writeln(documentContainer.innerHTML); "
  7.             PBS += "windowObject.document.close(); "
  8.             PBS += "windowObject.focus(); "
  9.             PBS += "windowObject.print(); "
  10.             PBS += "windowObject.close(); }"
  11.  
  12.             ScriptManager.RegisterStartupScript(PrintBalanceSheet, GetType(Page), "PrintBalanceSheet", PBS, True)
  13.             Me.PrintBalanceSheet.Attributes.Add("onclick", "printContent();")
  14.  
Mar 16 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: TrvlOrm | last post by:
Can any one please help me...I am new to JavaScript and I have been struggling with this code for days now and can't figure it out. I would like to get the Buttons to correspond with the action...
2
by: Asad | last post by:
I have a main window that creates a new window called printWin (which contains the printable format of the page). From the main window I embed a javascript in the printWin window that calls the...
2
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display...
0
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
7
by: e | last post by:
I've been having an extremely difficult time finding an answer to this in IE / js groups, so I thought I'd try here. I've got an aspx page that delivers loads of report data into custom-named...
2
by: rrabinowitz | last post by:
I have a printing problem that I'm hoping someone can solve. I have a small company website that uses javacript under IE5.5. For web pages that display large lists I used a div to build a...
1
by: KRISHNA PRAVI | last post by:
the error is "runtime error object expected" here is the code....................................................................................... <script language="javascript"...
11
by: Gord | last post by:
When I open a certain report, it runs some code that generates the records that will be displayed in that report. This works fine. When I go to print preview the report it appears that the code...
4
by: maminx | last post by:
hello all. i have html page to be printed out..it's generated by the button print like below <input type="button" name="btn_print" value="Print Invoice" onClick="javascript:window.print();"> of...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.