Newsgroup: it.comp.appl.access
Titolo: Stampe solo testo per stampanti ad aghi

Salve,
ho la necessità di creare un report per una stampante ad aghi, gradirei però
che la stampa non sia effettuata in modalità grafica
ma solo testo esiste qualche impostazione per creare stampe del genere?
------------------------------------------------------
Ing. Antonio Ganci
Megattera
Soluzioni Informatiche
Via Acqui, 6c
12051 Alba (CN)
Tel. 0173-36.68.41 Fax 0173-36.52.14
------------------------------------------------------

dall'MSDN
      ACC: Print Text to Default Printer with Access Basic (1.x/2.0)
Q105662
----------------------------------------------------------------------------
----
The information in this article applies to:
  a.. Microsoft Access versions 1.0, 1.1, 2.0
----------------------------------------------------------------------------
----
SUMMARY
Advanced: Requires expert coding, interoperability, and multiuser skills.
In Microsoft Access, there is no standard way of sending text to the default
printer without printing a form or report. This article demonstrates a
method of using Windows API functions to send text to the printer.
This article assumes that you are familiar with Access Basic and with
creating Microsoft Access applications using the programming tools provided
with Microsoft Access. For more information on Access Basic, please refer to
the "Introduction to Programming" manual in Microsoft Access version 1.x, or
the "Building Applications" manual in version 2.0. This article also assumes
that you are familiar with programming in the Windows environment. For more
information on programming in the Windows environment using API functions,
please refer to the Microsoft Windows Software Development Kit manuals.
MORE INFORMATION
Unlike Microsoft Visual Basic, Microsoft Access does not have a printer
object for sending text to the printer. The following example demonstrates
how to use Windows API functions to send text to the printer.
Notes
  a.. This article does not describe the API function arguments. For details
on the API functions, please refer to the Microsoft Windows Software
Development Kit manuals.
  b.. You may have some Microsoft Windows API functions defined in an
existing Microsoft Access library; therefore, your declarations may be
duplicates. If you receive a duplicate procedure name error message, remove
or comment out the declarations statement in your code. You should also
alias any API function declarations. For more information on using aliases,
search for "alias" then "declare statement" using the Microsoft Access Help
menu.
  c.. In the following sample code, an underscore (_) is used as a line-
continuation character. Remove the underscore when re-creating this code in
Access Basic.
      '-------------------------------------------------------------------
      'Declarations Section
      '-------------------------------------------------------------------
      Option Compare Database   'Use database order for string comparisons
      Option Explicit
      Type DOCINFO
         cbSize As Integer
         lpszDocname As Long
         lpszOutPut As Long
      End Type
      Declare Function GetProfileString% Lib "Kernel" (ByVal lpAppName$, _
                       ByVal lpkeyname$, ByVal lpDefault$, _
                       ByVal lpReturnedString$, ByVal nsize%)
      Declare Function CreateDC% Lib "GDI" (ByVal lpDriverName$, _
                       ByVal lpDeviceName$, ByVal lpOutput$, _
                       lpInitData As Any)
      Declare Function DeleteDC% Lib "GDI" (ByVal hDC%)
      Declare Function TextOut% Lib "GDI" (ByVal hDC%, ByVal X%, ByVal _
                       Y%, ByVal lpString$, ByVal nCount%)
      Declare Function Mylstrcpy& Lib "Kernel" Alias "lstrcpy" ( _
                       ByVal lpString1 As Any, ByVal lpString2 As Any)
      Declare Function StartDoc% Lib "GDI" (ByVal hDC%, lpdi As DOCINFO)
      Declare Function StartPage% Lib "GDI" (ByVal hDC%)
      Declare Function EndPage% Lib "GDI" (ByVal hDC%)
      Declare Function EndDocAPI% Lib "GDI" Alias "EndDoc" (ByVal hDC%)
      Declare Function Rectangle% Lib "GDI" (ByVal hDC%, ByVal X1%, _
                       ByVal Y1%, ByVal X2%, ByVal Y2%)
      '-------------------------------------------------------------------
      'Start of Function
      '-------------------------------------------------------------------
      Function Printer ()
         Dim lpReturnedString$
         Dim MyDoc As DOCINFO
         Dim MyDocumentname$
         Dim nPrinter, nDriver, nDevice
         Dim szDevice, szDriver, szOutPut
         Dim hDC%, X%, MyString$
         MyDocumentname$ = "My Document"
         '------------------------------------------
         ' Retrieve the currently selected printer as
         ' establish with the Control panel.
         ' Sample string as returned by lpReturnedString$:
         '
         '    HP LaserJet IIISi PostScript,pscript,LPT1:
         '------------------------------------------
         lpReturnedString$ = Space$(128)
         nPrinter = GetProfileString("windows", "device", ",,,", _
                    lpReturnedString$, Len(lpReturnedString$))
         '-----------------------------------------
         ' Parse the string of its three components
         '-----------------------------------------
         nDevice = InStr(lpReturnedString$, ",")
         nDriver = InStr(nDevice + 2, lpReturnedString$, ",")
         szDevice = Mid$(lpReturnedString$, 1, nDevice - 1)
         szDriver = Mid$(lpReturnedString$, nDevice + 1, nDriver - _
                    nDevice - 1)
         szOutPut = Mid$(lpReturnedString$, nDriver + 1)
         '------------------------------------------
         ' Create the DOCINFO structure for StartDoc()
         '  - lpszDocname is name displayed in PRINTMAN
         '  - lpszOutPut is not used and set to NULL
         '------------------------------------------
         MyDoc.cbSize = Len(MyDoc)
         MyDoc.lpszDocname = Mylstrcpy(MyDocumentname$, MyDocumentname$)
         MyDoc.lpszOutPut = 0&
         '------------------------------------------
         ' Create the device context
         '------------------------------------------
         hDC% = CreateDC(szDriver, szDevice, szOutPut, 0&)
         X% = StartDoc(hDC%, MyDoc)
            X% = StartPage(hDC%)
         '------------------------------------------
         ' Rectangle arguments are X, Y, cX, cY
         '------------------------------------------
         X% = Rectangle(hDC%, 10, 10, 1000, 150)
         MyString$ = "Derek and Robyn are brother and sister!"
         '------------------------------------------
         ' Second and third arguments are the X and Y
         ' coordinates on paper.
         '------------------------------------------
         X% = TextOut(hDC%, 30, 20, MyString$, Len(MyString$))
         X% = EndPage(hDC%)
         X% = EndDocAPI(hDC%)
         '------------------------------------------
         ' Release the device context when done
         '------------------------------------------
         hDC% = DeleteDC(hDC%)
      End Function
      '-------------------------------------------------------------------
      'End of Function
      '-------------------------------------------------------------------
REFERENCES
Microsoft Windows Software Development Kit "Guide to Programming," version
3.1, page 254-255
Microsoft Windows Software Development Kit "Programmer's Reference Volume 2:
Functions," version 3.1
Keywords : kbprint
Issue type : kbhowto
Technology :
      Last Reviewed: November 4, 2000
      © 2001 Microsoft Corporation. All rights reserved. Terms of Use.
----------------------------------------------------------------------------
----
Send feedback to MSDN.Look here for MSDN Online resources.

Ho trovato anche questo:
      How to Use WordBasic Print Command to Send Output to Printer
Q93759
----------------------------------------------------------------------------
----
The information in this article applies to:
  a.. Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a,
2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
----------------------------------------------------------------------------
----
SUMMARY
Although the WordBasic Print command is usually used to write output to the
status bar, you can also use this command to write output to the printer.
MORE INFORMATION
The sample macro below sends the text string "This is a test" to the printer
on LPT1.
Note: In this macro, no form feed follows the text sent to the printer. To
actually print the text, you must also send a line feed. This happens
automatically if you send another print job to the printer.
Sub MAIN
Open "lpt1.dos" For Output As #1
Print #1, "This is a test"
End Sub WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT
YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty
of any kind, either express or implied, including but not limited to the
implied warranties of merchantability and/or fitness for a particular
purpose.
REFERENCES
"Using WordBasic," by WexTech Systems and Microsoft, pages 263, 269
"Word for windows 2.0 Macros," Russell Borland, Microsoft Press, 1992, page
363
Additional query words: winword2 1.0 1.10a 2.0 word6 winword
Keywords : kbofficeprog
Issue type :
Technology :
      Last Reviewed: March 28, 2000
