Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 21st, 2004, 11:26 AM
Friend of Wrox
Join Date: Sep 2003
Location: Whitstable, , United Kingdom.
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
Default printing a word doc from

    can anyone point me to an example of how i can print off
    a word document from server side vb/asp.net code ?

    i want to be able to edit the word.doc (eg set name & address
    details) and then printit off.

any and all help muchly appreciated


  #2 (permalink)  
Old December 28th, 2004, 06:03 AM
Registered User
Join Date: Dec 2004
Location: Salamanca, Castilla y Leon, Spain.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts


I have to do the same process. I have been able to open, edit and close a word document. But, when I want to print it from a web project, i can't do it. I have tried to do it from a Windows project and I have done it.
This is the code:

Public Sub SendToPrinter()
            Dim oEnum1 As New Word.WdPrintOutPages
            Dim oEnum2 As New Word.WdPrintOutItem
            Dim oEnum3 As New Word.WdPrintOutRange

            Dim oWordApp As Word.ApplicationClass

                oWordApp = New Word.ApplicationClass

                oWordApp.ActivePrinter = Me.LocalPrinterName

                _word = oWordApp.Documents.Open(CObj(Me.WordPath))

                _word.PrintOut(Background:=False, Append:=False, Range:=oEnum3.wdPrintAllDocument, Item:=oEnum2.wdPrintDocumentContent, Copies:=1, PageType:=oEnum1.wdPrintAllPages, PrintToFIle:=False)

            Catch ex As Exception
                If Not Me._word Is Nothing Then
                End If
                If Not oWordApp Is Nothing Then
                End If

            End Try
        End Sub

It works in windows project but not in web project. why???

Julián Sanz
Microsoft Technology Group
GPM Factoría Internet
(923) 100 300
  #3 (permalink)  
Old December 13th, 2013, 07:06 AM
Registered User
Points: 21, Level: 1
Points: 21, Level: 1 Points: 21, Level: 1 Points: 21, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Dec 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: printing a word doc from

Hi jsanzg, well the problem is that you are trying to use .NETs Word Interop on server side and I believe that the server you are using does not have MS Word installed. So unfortunately you will have to change your approach or install Office on server, but note that Microsoft does not recommend, and does not support, Automation of Microsoft Office applications on server side.

I would recommend you to try some approach that does not have any dependecy to MS Word, for example I used this VB.NET Word component.
You can easily open, edit and save your word document and also you can print word files in .NET like the following:
' Print Word file (DOCX or DOC) to the default printer.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating word doc - word behaviour mat41 Classic ASP Professional 2 April 29th, 2007 06:46 PM
Printing .doc file in asp automatically vishalres Classic ASP Professional 3 April 9th, 2007 05:56 PM
Copy text from 1 doc to other doc thru vba in word itchock Word VBA 2 December 29th, 2006 02:47 AM
Printing To Word Doc kekohchaa VS.NET 2002/2003 0 May 7th, 2004 03:35 AM
Copy word to word doc. in VB vamshi Pro VB 6 1 March 24th, 2004 06:25 PM

All times are GMT -4. The time now is 07:49 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.