Hi,
In my project I have one telerik report viewer and two telerik text Editor. Right now for printing the report the user needs to click print button of respective control.
I am using the telerik text editor for printing the data since telerik reporting tool does not supports html.
Now I want to have a common print button . On clicking it I want to print text from report viewer , and text from 2 text Editor.
The user will click on one button and the text from all the controls will get printed.
For this I found the sample code from telerik forum http://www.telerik.com/community/forums/thread/b311D-ctegm.aspx)
which suggests to use the following javascript function on print button:
<form id="Form1" method="post" runat="server">
<script type="text/javascript">
function printRTB()
{
var printIframe = document.createElement("IFRAME");
document.appendChild(printIframe);
var printDocument = printIframe.contentWindow.document;
printDocument.open();
var editorHolderDiv = document.getElementById("editorHolder");
var theEditorContentHoder = editorHolderDiv.childNodes[0];
printDocument.write(theEditorContentHoder.innerHTML);
printDocument.close();
printDocument.execCommand("Print");
document.removeChild(printIframe);
};
</script>
<div id="editorHolder">
<rade:radeditor id="RadEditor1" editable="true" runat="server" saveinfile="false" haspermission="false">test test test</rade:radeditor>
</div>
<input type="button" id="btnPrint" OnClick="printRTB();" value="Print">
</form>
Can I print the data from report viewer using the above code?
Thanks,
Rahul
In my project I have one telerik report viewer and two telerik text Editor. Right now for printing the report the user needs to click print button of respective control.
I am using the telerik text editor for printing the data since telerik reporting tool does not supports html.
Now I want to have a common print button . On clicking it I want to print text from report viewer , and text from 2 text Editor.
The user will click on one button and the text from all the controls will get printed.
For this I found the sample code from telerik forum http://www.telerik.com/community/forums/thread/b311D-ctegm.aspx)
which suggests to use the following javascript function on print button:
<form id="Form1" method="post" runat="server">
<script type="text/javascript">
function printRTB()
{
var printIframe = document.createElement("IFRAME");
document.appendChild(printIframe);
var printDocument = printIframe.contentWindow.document;
printDocument.open();
var editorHolderDiv = document.getElementById("editorHolder");
var theEditorContentHoder = editorHolderDiv.childNodes[0];
printDocument.write(theEditorContentHoder.innerHTML);
printDocument.close();
printDocument.execCommand("Print");
document.removeChild(printIframe);
};
</script>
<div id="editorHolder">
<rade:radeditor id="RadEditor1" editable="true" runat="server" saveinfile="false" haspermission="false">test test test</rade:radeditor>
</div>
<input type="button" id="btnPrint" OnClick="printRTB();" value="Print">
</form>
Can I print the data from report viewer using the above code?
Thanks,
Rahul