begin process at 2012 05 24 10:25:29
  Trouver un code source :
 
dans
 
Accueil > Forum > 

Foxpro

 > 

Divers

 > 

Général

 > 

impimer de grid


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

impimer de grid

mercredi 6 mai 2009 à 00:01:05 | impimer de grid

souilahmedali

je veut imprimer une table vfp déjà affichée sur une grid
j'ai trouvé quelque code mais ça se marche pas
mercredi 6 mai 2009 à 00:04:18 | Re : impimer de grid

souilahmedali

exemple de code:

 ************* Beginning of code. ****************

   PUBLIC oWord
    oWord = CREATEOBJECT("Word.Basic")
    WITH oWord
       .AppShow        && Makes Word Visible
       .FileNewDefault && Opens up blank Word document

       * The following Insert commands place the FoxPro fields into
       * the Word document. You can change these commands to place
       * any text in the document.
       * Ensure that the table is already open. If only a portion
       * of records are to be printed, change the EOF() to a certain
       * number so that all of the records do not get processed.
       * Example: DO WHILE RECNO() < 10

       GO TOP

       DO WHILE NOT EOF()
          .Insert("Record: "+ALLTRIM(STR(RECNO())))
            && The above line shows the record number.
          .InsertPara
          .InsertPara
          .Insert(ALLTRIM(nom))   && Field in the table.
          .InsertPara
              .Insert(address)
              .InsertPara
              .Insert(ALLTRIM(city)+", "+state+"  "+zipcode)
              .InsertPara
              .InsertPara
              .Insert("Contents of the General Field:")
              .InsertPara
              .InsertPara
           KEYBOARD "{ctrl+c} {ctrl+w}" && Copies and closes the general
                                        && field to the clipboard.
           MODIFY GENERAL gen           && This has to be after the
                                        && KEYBOARD command.
          .EditPaste
          .WordLeft(1,1)
          .EditObject("0")
          .EditSelectAll
          .Editcopy
          .FileClose
          .EditClear
          .EditPaste
          .InsertPara
          .InsertPara
          .InsertPara
           SKIP                     && Move the record pointer to
                                    && the next record.
       ENDDO
       .FileSaveAs("c:\mydoc.doc")  && Saves the Word document as
                                    && Mydoc.doc.
          .FilePrint
       .AppClose
    ENDWITH
  

**************** End of code. ****************

mercredi 6 mai 2009 à 05:22:49 | Re : impimer de grid

souilahmedali

Réponse acceptée !
je le rouve en fin

#DEFINE wdToggle 9999998
#DEFINE wdTableRight -999996
#DEFINE wdAlignParagraphLeft 0
#DEFINE wdAlignParagraphCenter 1
#DEFINE wdAlignParagraphJustify 3
#DEFINE wdHorizontalPositionMargin 0
#DEFINE wdCollapseEnd 0
#DEFINE wdCollapseStart 1
#DEFINE wdParagraph 4

oWord = CREATEOBJECT("Word.Application")
oWord.Visible = .F.  && Toggle this to True to see if there's
                     && any difference
oDoc = oWord.Documents.Add()
oRange = oDoc.Range()
oRange.Collapse(wdCollapseStart)
*!*    WITH oRange
*!*        .ParagraphFormat.Alignment = wdAlignParagraphCenter
*!*        .Font.Size = 14
*!*        .Font.Name = "Arial Black"
*!*        .InsertAfter("Heading for Sales Report")
*!*        .MoveEnd(wdParagraph,1)

*!*        .Bold = .T.
*!*        .Collapse(wdCollapseEnd)
*!*        .InsertParagraphAfter()
*!*        .MoveEnd(wdParagraph,1)
*!*        .Bold = .F.
*!*        .Collapse(wdCollapseEnd)

*!*        .ParagraphFormat.Alignment = wdAlignParagraphLeft
*!*        .Font.Size = 12
*!*        .Font.Name = "Times New Roman"
*!*        .InsertParagraphAfter()
*!*        .InsertParagraphAfter()
*!*        .ParagraphFormat.Alignment = wdAlignParagraphLeft
*!*        .InsertAfter(REPLICATE("Paragraph #1 is left aligned. "+;
*!*            "Paragraph 2 is justified. ",4))
*!*        .Collapse(wdCollapseEnd)
*!*        .InsertParagraphAfter()
*!*        .InsertParagraphAfter()
*!*        .Collapse(wdCollapseEnd)
*!*        .ParagraphFormat.Alignment = wdAlignParagraphJustify
*!*        .InsertAfter(REPLICATE("This is a long paragraph that "+;
*!*            "needs to wrap around a table that will fit in the "+;
*!*            "paragraph, aligned at the right margin. ", 3))
*!*        .Collapse(wdCollapseEnd)
*!*    ENDwith

*!* Need a table of 4 rows, 3 columns, plus cells for labels and headings.
oWord.ActiveDocument.Tables.Add(oRange, 5, 3, 1, 0) && Word 2000 syntax
*!* Arguments are Range, #rows, #cols, [DefaultTableBehavior,] [AutoFitBehavior])
*!* Word 97 syntax is oWord.ActiveDocument.Tables.Add(oRange, 5, 4)
oTable = oWord.ActiveDocument.Tables(1) && Assign a table object
WITH oTable
    .Columns.SetWidth(72,0)               && 72 points/inch
    .Rows.WrapAroundText = .T.
    .Rows.RelativeHorizontalPosition = 0  && wdHorizontalPositionMargin
    .Rows.HorizontalPosition = -999996    && wdTableRight
    .Autoformat(2,.T.,.T.,.T.,.T.,.T.,.T.,.T.,.T.,.T.)
*!* (Format,ApplyBorders,ApplyShading,ApplyFont,ApplyColor,ApplyHeadingRows,
*!*         ApplyLastRow,ApplyFirstColumn,ApplyLastColumn,AutoFit)
 *!*================ selectio de table en curseur
SELECT * FROM upcmd INTO CURSOR wd
n=2
    .Cell(1,1).Range.InsertAfter("num ligne")
    .Cell(1,2).Range.InsertAfter("cod articl")
    .Cell(1,3).Range.InsertAfter("nom articl")
 scan
    .Cell(n,1).Range.InsertAfter(STR(wd.cod_ligne))
    .Cell(n,2).Range.InsertAfter(STR(wd.cod_articl))
    .Cell(n,3).Range.InsertAfter(wd.nom_articl)
n=n+1
endscan
ENDwith
oRange = oTable.Range
oRange.Collapse(wdCollapseEnd) && Move insertion point beyond table
*!*    WITH oRange
*!*        .InsertAfter("The table goes before this sentence. ")
*!*        .InsertAfter(REPLICATE("This is a long paragraph that "+;
*!*            "needs to wrap around a table that will fit in the "+;
*!*            "paragraph, aligned at the right margin. ",5))
*!*        .InsertParagraphAfter()
*!*        .InsertParagraphAfter()
*!*        .InsertAfter("A New Paragraph")
*!*    ENDwith

oWord.Visible = .T.  && Inspect the results
MESSAGEBOX("Look at results in Word.")


&&oWord.Quit(.F.) && Don't save changes
ThisForm.Release

mercredi 6 mai 2009 à 07:25:50 | Re : impimer de grid

MichelAtoutFox

Membre Club
Et un report tout simple, ça ne convenait pas?
mercredi 6 mai 2009 à 16:44:40 | Re : impimer de grid

souilahmedali

oui,merçi.


Cette discussion est classée dans : grid, impimer


Répondre à ce message

Sujets en rapport avec ce message

Probleme d'etat et de requete !!! [ par spoutnic_37 ] aloha , Je voudrais savoir si il etait possible de copier les infos d'un grid pour les afficher dans un etat ? En fait pour ceux qui veulent m'aider, URGENT - PB en VFP9 [ par mimyangelworld ] Bonjour a tousvoila j'ai un gros soucy sur vfp9, j'ai cree un formulaire en vfp6 qui regroupe une grid un container et u vfp grid [ par zouheir_ali ] Bonjour à tous,Je voudrais accéder dans une cellule d'une grille dans une colonne bien déterminé même si la grille contient plusieurs colonnes.Soit je GRID + SCROLL [ par fgones ] Bonjour,je rencontre un petit soucis avec un contrôle de type grid.Quand je change de colonne avec la touche tabulation, et que j'arrive complètement grid pb....... [ par rubix2 ] <TD id=HB_Focus_Element vAlign=top width="100%" background="" height=250 UNSELECTAB grid et click [ par rubix2 ] <TD id=HB_Focus_Element vAlign=top width="100%" background="" height=250 UNSELECTAB Grid : ajustement de la hauteur d'une ligne en fonction du nb de lignes du control edit box [ par amalik01 ] Bonsoir,J'ai un problème avec un Grid.Je développe sous VFP8.0J'aimerai faire une Grid dont la hauteur de ligne est ajustée en fonction du control.Mon GRID VFP [ par Imedbenmiled ] bonjour, je voudrai bien savoir comment forcer le curseur à revenir à la colonne précédente dans un contrôle GRID (VFP) grid [ par slimvir ] bonjour j'aimerai bien selectionner une ligne d'un Grid et celle là s'affiche dans un zone text remplir un grid avec des données [ par engelina33 ] salut,je suis une débutante en FoxPro et j'ai une application à développer. j'ai un problème avec mon gridj'essaye de le remplir avec des chaines de c


Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 1,326 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales