473,405 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Printing from ASP .NET page

I have a simple test application (one execute button) that opens an Excel
spreadsheet and then attempts to print the worksheet to a network printer.
When the application attempts to print the worksheet I receive the message:

"No printers are installed. To install a printer, point to Settings..."

Since this application is running on my machine I made sure my machine had a
default printer defined. But this still didn't fix the problem. Has anyone
else seen this problem? I am attaching my code below:

Dim objApp As Excel.Application
Dim objBook As Excel._Workbook
Dim objBooks As Excel.Workbooks
Dim objSheets As Excel.Sheets
Dim objSheet As Excel._Worksheet
Dim range As Excel.Range

objApp = New Excel.Application
'objApp.ActivePrinter = ps.PrinterName
objBooks = objApp.Workbooks
objBook = objBooks.Open("C:\Inetpub\wwwroot\report0.xls")
objSheets = objBook.Worksheets

'objApp.Worksheets.PrintOut()
objSheets.PrintOut()

objBooks.Close()

Thanks for any help.


Nov 19 '05 #1
1 2195
The APIs used by Excel to print depend on registry entries located in
HKEY_CURRENT_USER. Depending on which user context the process is
running under, different information will be loaded into this hive.
ASP.NET pages run with the ASPNET account by default - you've setup
printers for your account.

There are some tricky workarounds (i.e.
http://support.microsoft.com/kb/288367/EN-US/), but are you sure you
want to print from the server side?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 17 Feb 2005 11:02:10 -0600, "Nancy Kafer"
<nk****@homesteaderslife.com> wrote:
I have a simple test application (one execute button) that opens an Excel
spreadsheet and then attempts to print the worksheet to a network printer.
When the application attempts to print the worksheet I receive the message:

"No printers are installed. To install a printer, point to Settings..."

Since this application is running on my machine I made sure my machine had a
default printer defined. But this still didn't fix the problem. Has anyone
else seen this problem? I am attaching my code below:

Dim objApp As Excel.Application
Dim objBook As Excel._Workbook
Dim objBooks As Excel.Workbooks
Dim objSheets As Excel.Sheets
Dim objSheet As Excel._Worksheet
Dim range As Excel.Range

objApp = New Excel.Application
'objApp.ActivePrinter = ps.PrinterName
objBooks = objApp.Workbooks
objBook = objBooks.Open("C:\Inetpub\wwwroot\report0.xls")
objSheets = objBook.Worksheets

'objApp.Worksheets.PrintOut()
objSheets.PrintOut()

objBooks.Close()

Thanks for any help.


Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank pages print for those pages that have not been...
5
by: Patrick De Ridder | last post by:
How can I turn what I want to print 90 degrees using the logic below? Please tell me the code with which to make the modification. Many thanks, Patrick. using System.ComponentModel; using...
0
by: Nigel | last post by:
I successfully create a .NET Component (Visual Basic .NET) that would print, unfortunately when used within a web browser it appears that .NET security doesn't allow you to run code that interacts...
4
by: Rob T | last post by:
I have a small VB program that has a printing module...very simple....and works great. However, If I try to print to a generic printer, I get the following error: "The data area passed to a...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
2
by: Sukh | last post by:
Hi I am stuck with a problem Can anyone help me out from this... I am printing a report on pre-printed continue paper using dot-matrix printer using vb.net. Data is printing on all the...
6
by: Siv | last post by:
Hi, I am getting into printing with VB.NET 2005 and want to implement the usual capability that a user can select a selection of pages. I have a report that is generated by my application that if...
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
0
by: dotnet2005 | last post by:
Hi Toall , I want to explain you clearly , I am having some panels having some controls CheckBox,ComboBox,Datagridview,Hyperlink,label,Listbox,Picturebox,RadioButt­ on ,Textbox)...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.