Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Mail merge crashing with many records
Message
 
À
11/08/2009 15:05:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2000 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01417134
Message ID:
01417469
Vues:
40
>Goes about like this:
THIS.OpenMailMerge ()    && Open the main document and set the datasource
>
>*-- Set the page options
>WITH THIS.oWord.ActiveDocument.PageSetup    && THIS.oWord point to the instance of Word
>    .Orientation = 0	&& wdOrientPortrait
>    .TopMargin = THIS.oWord.CentimetersToPoints (2.5)
>    .BottomMargin = THIS.oWord.CentimetersToPoints (2.5)
>    .LeftMargin = THIS.oWord.CentimetersToPoints (2.5)
>    .RightMargin = THIS.oWord.CentimetersToPoints (2.5)
>    .Gutter = THIS.oWord.CentimetersToPoints (0)
>    .HeaderDistance = THIS.oWord.CentimetersToPoints (0)
>    .FooterDistance = THIS.oWord.CentimetersToPoints (0)
>    .PageWidth = THIS.oWord.CentimetersToPoints (21.59)
>    .PageHeight = THIS.oWord.CentimetersToPoints (27.94)
>    .OtherPagesTray = 0	&& wdPrinterDefaultBin
>    .SectionStart = 2	&& wdSectionNewPage
>    .OddAndEvenPagesHeaderFooter = .T.
>    .DifferentFirstPageHeaderFooter = .F.
>    .VerticalAlignment = 0	&& wdAlignVerticalTop
>    .SuppressEndnotes = .F.
>    .MirrorMargins = .F.
>    THIS.SetTray (THIS.nBac, THIS.oWord.ActiveDocument.PageSetup)    && Set the paper tray
>    .OddAndEvenPagesHeaderFooter = .F.
>    .TwoPagesOnOne = .F.
>    .BookFoldPrinting = .F.
>    .BookFoldRevPrinting = .F.
>    .BookFoldPrintingSheets = 1
>    .GutterPos = 0	&& wdGutterPosLeft
>ENDWITH
>
>*-- Run the mailmerge
>WITH .oWord.ActiveDocument.MailMerge
>    .Destination = 0    && New document
>    .DataSource.FirstRecord = 1
>    .DataSource.LastRecord = RECCOUNT (m.lcData)    && Total number of records of the datasource
>    .SuppressBlankLines = .T.
>    .Execute ()    && Run the mailmerge
>ENDWITH
>					
>THIS.oWord.Documents(THIS.cMMDocument).Close (0)    && Close the main document
>
>*-- Print each page separatly (this goes inside a loop)
>WITH THIS.oWord
>    .Activedocument.Sections(m.tnPageNo).Range.Select ()    && Select the page to print
>    .Selection.End = .Selection.End - 1    && Remove the end of page marker from the selection
>    .ActiveDocument.PrintOut (0, , 1)    && Print the page    <-- THIS IS THE COMMAND THAT SEND WORD IN THE NO MAN LAND
>ENDWITH
>Could you please, post your code for merging and printing (or gave me the link to it)?


From the help I see that PrintOut is a method of the application object not the document one. Could you please try this and tell me if this help:
#define wdGoToPage  1
#define wdGoToFirst 1
#define wdPrintCurrentPage 2

*-- Print each page separatly (this goes inside a loop)
FOR lnPages = 1 TO lnTotalPages
    WITH THIS.oWord
        .Selection.GoTo(wdGoToPage,wdGoToFirst, m.lnPages,"")
        .PrintOut (0, , wdPrintCurrentPage)    
    ENDWITH
NEXT
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform