printing xml in ie
-
Hi. I'm busy with a app that needs to print xml rendered by xslt. Currently I am printing with internet explorer in the following manner <pre> Dim internetExplorer As New SHDocVw.InternetExplorerClass() Dim webBrowser As SHDocVw.IWebBrowser2 = CType(internetExplorer, SHDocVw.IWebBrowser2) 'Make the web browser visible webBrowser.Visible = False 'Display empty page so we have something to manipulate. Dim noValue As Object = System.Reflection.Missing.Value webBrowser.Navigate("file://" + fileName, noValue, noValue, noValue, noValue) While webBrowser.Busy Threading.Thread.Sleep(500) End While 'Get access to the webbrowser's document. internetExplorer.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, noValue, noValue) 'CType(internetExplorer.Document, mshtml.IHTMLDocument2).close() Marshal.ReleaseComObject(internetExplorer) Marshal.ReleaseComObject(webBrowser) </pre> I need to find a different way to do this as the above code gives a com exception. Or I need a workaround for the above code. If anybody can help I would greatly appreaciate it. Stephen
Stephen Lintott Bsc IT (RAU)
-
Hi. I'm busy with a app that needs to print xml rendered by xslt. Currently I am printing with internet explorer in the following manner <pre> Dim internetExplorer As New SHDocVw.InternetExplorerClass() Dim webBrowser As SHDocVw.IWebBrowser2 = CType(internetExplorer, SHDocVw.IWebBrowser2) 'Make the web browser visible webBrowser.Visible = False 'Display empty page so we have something to manipulate. Dim noValue As Object = System.Reflection.Missing.Value webBrowser.Navigate("file://" + fileName, noValue, noValue, noValue, noValue) While webBrowser.Busy Threading.Thread.Sleep(500) End While 'Get access to the webbrowser's document. internetExplorer.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER, noValue, noValue) 'CType(internetExplorer.Document, mshtml.IHTMLDocument2).close() Marshal.ReleaseComObject(internetExplorer) Marshal.ReleaseComObject(webBrowser) </pre> I need to find a different way to do this as the above code gives a com exception. Or I need a workaround for the above code. If anybody can help I would greatly appreaciate it. Stephen
Stephen Lintott Bsc IT (RAU)
Don't repeat the same question again and again in the same day. You just posted this 7 hours ago and haven't waited long enough for a response. I just started playing around with your code, not 2 minutes ago and need time to look it the problem.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Don't repeat the same question again and again in the same day. You just posted this 7 hours ago and haven't waited long enough for a response. I just started playing around with your code, not 2 minutes ago and need time to look it the problem.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Sorry I just under presure to get an answer for this. Any luck so far because I am stuck
Stephen Lintott Bsc IT (RAU)
-
Sorry I just under presure to get an answer for this. Any luck so far because I am stuck
Stephen Lintott Bsc IT (RAU)
Yeah, and I'm under pressure to test 96 applications by the end of this week... CodeProject is supported entirely by people who volunteer their time. We get around to answering questions as much as we can whenever we can, but on our own time. We don't get paid to do this.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008