R
Richard
in a previous aspx page i got a few records printed throu window.print()
function in javascript.
but now i have the records in a to RTF and i want to run the same function
print, which ofcourse wont work
since the page isnt HTML anymore. Is there some other way to print
automaticly.
i used to have this function to print automaticly from a browser to client.
------------------
<BODY onload="doPrint()">
<object id="WBControl" width="0" height="0"
classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
<script language="VBScript"><!--
Sub VBPrint() On Error Resume Next
WBControl.ExecWB 6,1
End Sub
//--></script>
<script language=JavaScript><!--
function doPrint()
{
if(self.print)
{
self.print();
self.close();
return false;
}
else if (navigator.appName.indexOf('Microsoft') != -1)
{
VBPrint();
self.close();
}
else
{
alert("To print this document, you will need to\nclick the Right Mouse
Button and select\n'Print'");
}
}
//-->
</script>
--------------
which made sure the page is printed without having a user asked for a
confirmation but i want the same this but for an RTF document.
my code is:
-------------------
Dim myConnection As OleDBConnection = New
OleDBConnection(AppSettings("DigifanDatabaseCon"))
myConnection.Open()
Dim ds As DataSet
Dim sXSL As String
ds = New DataSet("klantenkaart")
Dim ContactsDA As OleDBDataAdapter = New OleDBDataAdapter("SELECT *
FROM Klantenbestand WHERE klantnummer="& Request.QueryString("ID") & "",
myConnection)
ContactsDA.Fill(ds, "Klantenbestand")
' XSLT to use for transforming this dataset.
sXSL = "klantenkaart.xslt"
' Close the connection to the data source.
myConnection.Close()
' Transform the dataset by using the appropriate stylesheet.
Dim xmlDoc As XmlDataDocument = New XmlDataDocument(ds)
Dim xslTran As XslTransform = New XslTransform
xslTran.Load(Server.MapPath(sXSL))
' Stream the results of the transformation to Word.
Response.ContentType = "application/msword"
Response.Charset = ""
Response.ContentEncoding = System.Text.Encoding.Default
xslTran.Transform(xmlDoc, Nothing, Response.Output)
-------------------
and i want to print it then but how. I am kinda stuck.
i hope it makes sence to the person reading it and thx in advance if you can
help me out.
Richard
function in javascript.
but now i have the records in a to RTF and i want to run the same function
print, which ofcourse wont work
since the page isnt HTML anymore. Is there some other way to print
automaticly.
i used to have this function to print automaticly from a browser to client.
------------------
<BODY onload="doPrint()">
<object id="WBControl" width="0" height="0"
classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
<script language="VBScript"><!--
Sub VBPrint() On Error Resume Next
WBControl.ExecWB 6,1
End Sub
//--></script>
<script language=JavaScript><!--
function doPrint()
{
if(self.print)
{
self.print();
self.close();
return false;
}
else if (navigator.appName.indexOf('Microsoft') != -1)
{
VBPrint();
self.close();
}
else
{
alert("To print this document, you will need to\nclick the Right Mouse
Button and select\n'Print'");
}
}
//-->
</script>
--------------
which made sure the page is printed without having a user asked for a
confirmation but i want the same this but for an RTF document.
my code is:
-------------------
Dim myConnection As OleDBConnection = New
OleDBConnection(AppSettings("DigifanDatabaseCon"))
myConnection.Open()
Dim ds As DataSet
Dim sXSL As String
ds = New DataSet("klantenkaart")
Dim ContactsDA As OleDBDataAdapter = New OleDBDataAdapter("SELECT *
FROM Klantenbestand WHERE klantnummer="& Request.QueryString("ID") & "",
myConnection)
ContactsDA.Fill(ds, "Klantenbestand")
' XSLT to use for transforming this dataset.
sXSL = "klantenkaart.xslt"
' Close the connection to the data source.
myConnection.Close()
' Transform the dataset by using the appropriate stylesheet.
Dim xmlDoc As XmlDataDocument = New XmlDataDocument(ds)
Dim xslTran As XslTransform = New XslTransform
xslTran.Load(Server.MapPath(sXSL))
' Stream the results of the transformation to Word.
Response.ContentType = "application/msword"
Response.Charset = ""
Response.ContentEncoding = System.Text.Encoding.Default
xslTran.Transform(xmlDoc, Nothing, Response.Output)
-------------------
and i want to print it then but how. I am kinda stuck.
i hope it makes sence to the person reading it and thx in advance if you can
help me out.
Richard