留言板
Printing the Report
Hello,
I created a portlet which contains the report. It display the graphical report means contains pie chart and bar chart .
i want to print that report.
so how can i print it???
Thank you.
I created a portlet which contains the report. It display the graphical report means contains pie chart and bar chart .
i want to print that report.
so how can i print it???
Thank you.
Hiten Shah:
Hello,
I created a portlet which contains the report. It display the graphical report means contains pie chart and bar chart .
i want to print that report.
so how can i print it???
Thank you.
Dear Hiten,
You can use jquery to print div. I'll recommend to create div id for graphs and then print that id using jquery or javascript.
Hope below link will help
1. http://www.aspdotnet-suresh.com/2013/08/jquery-print-div-content-with-css-using.html
2. http://stackoverflow.com/questions/2255291/print-the-contents-of-a-div
Kind Regards,
Manish Yadav
Hi Hiten,
Can you please give a try using below code :
Can you please give a try using below code :
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
function printDiv(divID) {
//Get the HTML of div
var divElements = document.getElementById(divID).innerHTML;
//Get the HTML of whole page
var oldPage = document.body.innerHTML;
//Reset the page's HTML with div's HTML only
document.body.innerHTML =
"<html><head><title></title></head><body>" +
divElements + "</body>";
//Print Page
window.print();
//Restore orignal HTML
document.body.innerHTML = oldPage;
}
</script>
<form id="form1" runat="server">
<div id="printablediv" style="width: 100%; background-color: Blue; height: 200px">
Print me I am in 1st Div
</div>
<div id="donotprintdiv" style="width: 100%; background-color: Gray; height: 200px">
I am not going to print
</div>
<input type="button" value="Print 1st Div" onclick="javascript:printDiv('printablediv')">
</form>