Click here to Skip to main content
15,883,908 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

How to print MS Chart in ASP.Net.
Can anybody give me some idea to do so,I searched alot but all solutions available are for windows application not for Web.

Looking for the valuable solutions of yours,

Thanks in advance
Supriya
Posted

Hi,

try this..

Place Chart in DIV tag.


XML
<script type="text/javascript">
<!--
function printchart(elementId)
{
 var printContent = document.getElementById(elementId);
 var windowUrl = 'about:blank';
 var uniqueName = new Date();
 var windowName = 'Print' + uniqueName.getTime();
 var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');

 printWindow.document.write(printContent.innerHTML);
 printWindow.document.close();
 printWindow.focus();
 printWindow.print();
 printWindow.close();
}
// -->
</script>




Call this printchart(chartDiv) in Print Button onclientclick event.


regards,
Pal
 
Share this answer
 
v2
Comments
palraj001 5-Nov-11 7:44am    
chartDiv is ID of the div tag
Supriya Srivastav 5-Nov-11 9:40am    
Thnx alot for ur solution,it's working but not in Google Chrome.
Supriya Srivastav 5-Nov-11 9:49am    
Page is printed sometimes with chart and sometimes without chart.
 
Share this answer
 
Comments
RaviRanjanKr 5-Nov-11 11:20am    
Nice Link, My 5+
From the below Question-Answer discussion on the same topic, It seems like you will have to output you MS-Chart to PDF format using "iTextSharp".

http://forums.asp.net/t/1600687.aspx/1
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900