Auto Printing

NeilMFC

New Member
Hi everyone

My Company is changing over from our old case management system and requires a command for auto printing.

Currently our old system one we call a document it will open in word and print. However we cannot find a way for progress to do this.

This would be brilliant if we could do this and would love to know how.

However if possible we would like to go one step further, we currently also have 2 check boxes whilst in the file before calling a document, this is set to print however and be changed to Word so the document only opens in word and does not print

Any help, be so kindly appreciated

Thanks in advance

Neil

 

leowie

New Member
hi neil,
try things like the following ...

--- Rep2Word ---

DEFINE VARIABLE hWord AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE hDoc AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE cRepFile AS CHARACTER NO-UNDO.


/* MS Word starten */
CREATE "Word.Application" hWord. /* Create new Word Application object */

/* Launch Word so it is visible to the user */
/*0 = WinWord unsichtbar, 1 = Winword sichtbar */
ASSIGN hWord:VISIBLE = 0 .

hWord:Documents:Add(cRepFile).
hDoc = hWord:ActiveDocument.

/* MS-Word Formatierung Courier New 8 Punkt A4 quer/hoch */
RUN reports/Word-C8-A4h.p (hWord, hDoc).


/*
IF SSofortDru:checked IN FRAME {&FRAME-NAME} THEN
DO:
hWord:Application:printOut(no). /* Print NOW */
hWord:Quit(No,,).

MESSAGE "Es wurde soeben gedruckt."
VIEW-AS ALERT-BOX INFORMATION.

END.
else
*/

ASSIGN hWord:Visible = 1.
RELEASE OBJECT hWord.
RELEASE OBJECT hDoc.


Word-C8-A4h.p (like a Word-Macro ...):
/*-------------------------------------------------------------------------------*/
/* File: Word-C8-A4h.p */
/* Description: MS-Word Formatierung Courier New 8 Punkt A4 hoch */
/* Breite: max. 116 Zeichen bei L: 0.8 R: 0.5 cm */
/* (Breite: max. 112 Zeichen bei L: 1.5 R: 0.5 cm) */
/* Hoehe : max. 81 Zeilen bei O: 2.0 U: 1.5 cm */
/*-------------------------------------------------------------------------------*/
/* History: */
/* 2002.11.04 ... Erstellung */
/*-------------------------------------------------------------------------------*/

DEFINE INPUT PARAMETER hWord AS COM-HANDLE NO-UNDO.
DEFINE INPUT PARAMETER hDoc AS COM-HANDLE NO-UNDO.

DEFINE VARIABLE cm2pt AS DECIMAL NO-UNDO INIT 28.3286119 /* 100 / 3,53 */.
hDoc:SELECT. /* alles selektieren */
hWord:Selection:Font:Name = "Courier New". /* Font */
hWord:Selection:Font:Size = 8. /* Size */

hWord:ActiveDocument:pageSetup:LineNumbering:Active = False.
hWord:ActiveDocument:pageSetup:Orientation = 0. /* 0 = wdOrientPortrait*/
hWord:ActiveDocument:pageSetup:TopMargin = 2.0 * cm2pt. /*CentimetersToPoints(2)*/
hWord:ActiveDocument:pageSetup:BottomMargin = 1.5 * cm2pt. /*CentimetersToPoints(1.5)*/
hWord:ActiveDocument:pageSetup:LeftMargin = 0.8 * cm2pt. /*CentimetersToPoints(0.5)*/
hWord:ActiveDocument:pageSetup:RightMargin = 0.5 * cm2pt. /*CentimetersToPoints(0.5)*/
hWord:ActiveDocument:pageSetup:Gutter = 0 * cm2pt. /*CentimetersToPoints(0)*/
hWord:ActiveDocument:pageSetup:HeaderDistance = 1.5 * cm2pt. /*CentimetersToPoints(1.5)*/
hWord:ActiveDocument:pageSetup:FooterDistance = 1 * cm2pt. /*CentimetersToPoints(1)*/
hWord:ActiveDocument:pageSetup:pageWidth = 21 * cm2pt. /*CentimetersToPoints(21)*/
hWord:ActiveDocument:pageSetup:pageHeight = 29.7 * cm2pt. /*CentimetersToPoints(29,7)*/

/* 2003.01.28 Test
Auszug aus Macro:
ActiveWindow.ActivePane.View.Zoom.Percentage = 100
ActiveWindow.ActivePane.View.Zoom.PageFit = wdPageFitBestFit
tut leider nicht
hWord:ActiveWindow:ActivePane:View:Zoom:pageFit = wdPageFitBestFit.
*/

/*
hWord:ActiveDocument:pageSetup:FirstPageTray = wdPrinterDefaultBin
hWord:ActiveDocument:pageSetup:OtherPagesTray = wdPrinterDefaultBin
hWord:ActiveDocument:pageSetup:SectionStart = wdSectionNewPage
hWord:ActiveDocument:pageSetup:OddAndEvenPagesHeaderFooter = False
hWord:ActiveDocument:pageSetup:DifferentFirstPageHeaderFooter = False
hWord:ActiveDocument:pageSetup:VerticalAlignment = wdAlignVerticalTop
hWord:ActiveDocument:pageSetup:SuppressEndnotes = False
hWord:ActiveDocument:pageSetup:MirrorMargins = False
*/

/* Oben Positionieren */
/* Selection.HomeKey Unit:=wdStory */
hWord:Selection:HomeKey().
 

M.Fondacci

New Member
automation.i

Hello,

Download automation.i available at www.4GL.fr.
You will find a lot of ms-Word functions to help using an OLE automation.

Best regards,

Marcel.
 
Top