ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Comment re-dimensionner un controle OLE et du texte RTF avec le reportlistener   



L'auteur

Mike Gagnon
Canada Canada
Membre Simple
# 0000000025
enregistré le 14/10/2004

Gagnon Mike
Pointe Cla H9R 3K8
de la société Carver Technologies Inc.
Fiche personnelle


Note des membres
pas de note

Contributions > 03 - FRX : Etat, impression, Report

Comment re-dimensionner un controle OLE et du texte RTF avec le reportlistener
# 0000000865
ajouté le 07/08/2013 18:53:44 et modifié le 15/08/2013
consulté 15052 fois
Niveau initié

Version(s) Foxpro :
VFP 9.0

Description

Le code suivant fait suite à cet article:

http://www.atoutfox.org/articles.asp?ACTION=FCONSULTER&ID=0000000131

Créer un état FoxPro et y ajouter un ‘Picture/Activex Bound control’ et l’agrandir à la grandeur désiré et l'appeler 'c:\rtfdemo'

Code source :
#Define GDIPLUS_DETAIL_OBJCODE            4
#Define CRLF Chr(13)+Chr(10)
Local lcStr
Public lcReportPath,lcTmpReport
lcStr = "Note that there is a limit of 32 characters total for the sum of text"+CRLF +;
  "before and text after for simple numbering. Multilevel numbering has a limit"+CRLF +;
  "of 64 characters total for the sum of all levels.NOTE: The file must have a"+CRLF +;
  ".RTF extension to work properly.Note that there is a limit of 32 characters total for the sum of text"+CRLF +;
  "before and text after for simple numbering. Multilevel numbering has a limit"+CRLF +;
  "of 64 characters total for the sum of all levels.NOTE: The file must have a"+CRLF +;
  ".RTF extension to work properly.Note that there is a limit of 32 characters total for the sum of text"+CRLF +;
  "before and text after for simple numbering. Multilevel numbering has a limit"+CRLF +;
  "of 64 characters total for the sum of all levels.NOTE: The file must have a"+CRLF +;
  ".RTF extension to work properly.Note that there is a limit of 32 characters total for the sum of text"+CRLF +;
  "before and text after for simple numbering.\b Multilevel numbering has a limit"+CRLF +;
  "of 64 characters total for the sum of all levels.NOTE: The file must have a"+CRLF +;
  ".RTF extension to work properly. \b0 Note that there is a limit of 32 characters total for the sum of text"+CRLF +;
  "before and text after for simple numbering. Multilevel numbering has a limit"+CRLF +;
  "of 64 characters total for the sum of all levels.NOTE: The file must have a"+CRLF +;
  ".RTF extension to work properly." && Fill the variable with Text.
lnCount =Alines(myrray,lcStr)
Create Cursor ctext (lctext m,gText g) &&Create a cursor .
Insert Into ctext (lctext) Values (lcStr) && insert the text in the memo field
_rtfFile = "c:\"+Sys(3)+".rtf"  && Create a temporary rtf file
Scan
  Set Textmerge To &_rtfFile Noshow
  Set Textmerge On
           \\{\rtf1 <<ALLT(cText.lcText)>>}
  Set Textmerge To
  Append General gText From &_rtfFile Class "RICHTEXT.RICHTEXTCTRL.1" &&Class RTF
endscan
loListener = Createobject("AdRTFListener")
lcReportPath='c:\rtfdemo'
lcTmpReport = sys(2023)+'\'+sys(3)+'.frx'
lcTmpReportfrt = sys(2023)+'\'+juststem(lcTmpReport)+'.frt'
copy file lcReportPath+'.frx' TO (lcTmpReport)
lcReportPath2 =  lcReportPath+'.frt'
copy file (lcReportPath2) to (lcTmpReportfrt)
loListener.OutputType = -1  && Generate the correct size without showing the report
&& So the resizing takes place.
loListener.Quietmode = .T.
Report Form (lcTmpReport) Object m.loListener
loListener.OutputType = 1 && Now we show the report resized
loListener.Quietmode = .F.
Report Form (lcTmpReport) Object m.loListener
Erase &_rtfFile

Define Class AdRTFListener As _ReportListener Of ;
    home() + 'ffc\_ReportListener.vcx'
  oGDIGraphics = .Null.
   Function BeforeBand(tnBandObjCode, tnFRXRecNo)
  local lcAlias
  lcAlias = alias()
    With This
    If tnBandObjCode=GDIPLUS_DETAIL_OBJCODE
      Use (lcTmpReport) Shared Again In 0 alias DEMO
      select DEMO
      locate for DEMO.OBJTYPE = 17 and DEMO.OBJCODE = 0
      REPLACE DEMO.HEIGHT with DEMO.HEIGHT*lnCount
      go tnFRXRecNo
      REPLACE DEMO.HEIGHT with DEMO.HEIGHT*lnCount
      use in select('demo')
         select (lcAlias)
     endif
    DoDefault(tnBandObjCode, tnFRXRecNo)
  Endwith
  endfunc
Enddefine

Commentaires
le 15/08/2013, eddymaue a écrit :
t populaire Mike ....

consulté 5112 fois en 7 jours ....

le 15/08/2013, Mike Gagnon a écrit :
woowoo LOL
le 15/08/2013, eddymaue a écrit :
Mike je bloque à cette ligne

copy file lcReportPath+'.frx' TO (lcTmpReport)

fichier pointé par lcReportPath inexisant

le 15/08/2013, Mike Gagnon a écrit :
Tu as cree un rapport 'dummy' appele rtfdemo avec un objet 'ole' dedans? Je fais un suivi de l'autre example.

le 16/08/2013, eddymaue a écrit :
c'est ok Mike ... merci

Publicité

Les pubs en cours :

www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2024.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3