FUNCTION FdrG( aPrinterPS, aFont, aPaper, aPoSZ, cText, nFont, aSettings, cAusR, nZeiLen ) //Arrayelemente von :paperSize() Element: Bedeutung: // LOCAL nXSize := aPaper[1] // 1 Papierbreite in 1/10 mm (= nXsize) // LOCAL nYSize := aPaper[2] // 2 Papierhöhe in 1/10 mm (= nYsize) // LOCAL nLeftMargin := aPaper[3] // 3 Linker Rand in 1/10 mm (= nLeftMargin) // LOCAL nBottomMargin := aPaper[4] // 4 Unterer Rand in 1/10 mm (= nBottomMargin) // LOCAL nRightMargin := aPaper[5] // 5 Rechter Rand in 1/10 mm (= nRightMargin) // LOCAL nTopMargin := aPaper[6] // 6 Oberer Rand in 1/10 mm (= nTopMargin) //Die Werte fr die nicht bedruckbaren R„nder beziehen sich auf die linke, //untere Ecke des Papiers. Fr das Papierformat A4 (2100, 2970) k”nnten die //R„nder also folgende Koordinaten haben: 50, 50, 2050, 2920. In diesem //Fall w„re der nicht bedruckbare Rand auf dem Papier ringsherum 5 mm breit. LOCAL aTextbox := {}, aPenPos := {} LOCAL nPpSG := IIf(IsMemVar("cPpS").AND.IsMemVar("nPpS"), IIf( !Empty( cPpS ), Val( cPpS ), nPpS ), 25 ) LOCAL nPpZG := IIf(IsMemVar("cPpZ").AND.IsMemVar("nPpZ"), IIf( !Empty( cPpZ ), Val( cPpZ ), nPpZ ), 42 ) ****************************************************************************** // aAttr2 erwies sich als berflssig: 03.05.2007 13:46 LOCAL aAttr1 := aAttr2 := ARRAY( GRA_AS_COUNT ), aLineAttr, aOldLAttr, aBoxAttr, aOldBAttr //03.05.2007 12:05 LOCAL aOldAttr, nOldPoffX := nPoffX, nOldPoffy := nPoffY //29.04.2006 17:51 Drubef-Wert retten PRIVATE nZeiG, nSpaG DEFAULT nZeiLen TO 60 //03.10.2006 10:04 nur fr Memodruck! //////////// IF !IsMemVar("XXXak") // 11/2004 : soll den Aufbau verkrzen (siehe BPreviewP) //////////// RETURN aPenPos //////////// ENDIF aSettings := IIf(nFont>7,aSchArt,aSettings) // 26.9.2004 nFont := IIf(nFont>7,1,nFont) // 26.9.2004 aFont[1]:configure( IIf( !Empty(aSettings), aSettings, ; { "12.COURIER NEW" , ; "10.ARIAL" , ; "10.ARIAL FETT" , ; "12.COURIER NEW FETT" , ; "10.TIMES NEW ROMAN" , ; "10.TIMES NEW ROMAN FETT" , ; "12.TIMES NEW ROMAN FETT KURSIV" ; } )[nFont] ) aFont[2]:configure( IIf( !Empty(aSettings), aSettings, ; { "12.COURIER NEW" , ; FONT_DEFPROP_MEDIUM , ; FONT_DEFPROP_LARGE , ; "12.COURIER NEW FETT" , ; FONT_TIMES_MEDIUM , ; FONT_TIMES_LARGE , ; FONT_TIMES_XLARGE + FONT_STYLE_ITALIC + FONT_STYLE_BOLD ; } )[nFont] ) GraSetFont( aPrinterPS[1], aFont[1] ) GraSetFont( aPrinterPS[2], aFont[2] ) //////#define GRA_HALIGN_LEFT 0 // Auszug aus gra.ch //////#define GRA_HALIGN_CENTER 6 //////#define GRA_HALIGN_RIGHT 2 IF ValType(cAttrib) == "C" .AND. cAttrib != "{{},}" .AND. ValType(&cAttrib)=="A" //21.10.2006 09:56 aAttr1[GRA_AS_COLOR] := GraMakeRGBColor(&cAttrib[1]) aAttr1[GRA_AS_EXTRA] := &cAttrib[2] IF Len(&cAttrib)>2 aPoSZ[2] += &cAttrib[3] //23.10.2006 10:02 Abstand vor dem Textstreifen (spreizt vertikal) cAttrib := Stuff(cAttrib,At(",",cAttrib,At("}",cAttrib)+2)+1,Len(LTrim(Str(&cAttrib[3]))),"0") // damit Abstand nur VOR nicht auch IM Text IF Len(&cAttrib)>3 nZeiLen := &cAttrib[4] //28.10.2006 10:41 indiv. Zeilenl„nge, z.B. fr Blocksatz ENDIF ENDIF // AEval(&cAttrib,{|a,i|IIf(a!=NIL,aAttr1[i]:=IIf(i=1,GraMakeRGBColor(a),a),)}) // AEval(&cAttrib,{|a,i|IIf(a!=NIL,aAttr2[i]:=IIf(i=1,GraMakeRGBColor(a),a),)}) ENDIF aAttr1[GRA_AS_HORIZALIGN] := GRA_HALIGN_LEFT //03.10.2006 11:02 // aAttr2[GRA_AS_HORIZALIGN] := GRA_HALIGN_LEFT //03.10.2006 11:02 IF !Empty(cAusR) .AND. cAusR[1] $ ">^<:" //03.10.2006 11:02 aAttr1[GRA_AS_HORIZALIGN] := IIf(cAusR[1]$"^",GRA_HALIGN_CENTER, ; IIf(cAusR[1]==">",GRA_HALIGN_RIGHT,GRA_HALIGN_LEFT)) // aAttr2[GRA_AS_HORIZALIGN] := IIf(cAusR[1]$"^:",GRA_HALIGN_CENTER, ; // IIf(cAusR[1]==">",GRA_HALIGN_RIGHT,GRA_HALIGN_LEFT)) ENDIF IF !Empty(cText) .AND. cText[1] $ ">^<:" //03.10.2006 11:03 aAttr1[GRA_AS_HORIZALIGN] := IIf(cText[1]$"^",GRA_HALIGN_CENTER, ; IIf(cText[1]==">",GRA_HALIGN_RIGHT,GRA_HALIGN_LEFT)) // aAttr2[GRA_AS_HORIZALIGN] := IIf(cText[1]$"^:",GRA_HALIGN_CENTER, ; // IIf(cText[1]==">",GRA_HALIGN_RIGHT,GRA_HALIGN_LEFT)) cText := SubStr(cText,2) IF !Empty(cText) .AND. cText[1] == "_" //02.01.2007 18:49 klappt noch nicht!! aFont[1]:underscore := .T. aFont[2]:underscore := .T. cText := SubStr(cText,2) ENDIF ENDIF aOldAttr := GraSetAttrString( aPrinterPS[1], aAttr1 ) //03.10.2006 11:03 aOldAttr := GraSetAttrString( aPrinterPS[2], aAttr1 ) //03.10.2006 11:03 ****************************************************************************** // 10.12.2005: nPoffX/Y ergeben sich aus Val(cPoffX/Y), wenn in bl_*p gesetzt: nPoffX := IIf( Val( cPoffX )!=0 .OR. cPoffX="0", Val( cPoffX ), nPoffX ) // nPoffX+Y sind PUBLIC nPoffY := IIf( Val( cPoffY )!=0 .OR. cPoffY="0", Val( cPoffY ), nPoffY ) // 10.12.2005: "IIf( Val(" statt "!Empty(" IF aPoSZ[2] < IIf(!Empty(cPpZ), 2970/Val(cPpZ),80) // 12.6.2005 nZeiG := aPaper[6] - aPaper[4] - nPoffY - Int( aPoSZ[2] * nPpZG ) nSpaG := nPoffX + aPaper[3] + Int( aPoSZ[1] * nPpSG ) ELSE nZeiG := aPoSZ[2] nSpaG := aPoSZ[1] ENDIF IF Len(cText)>1 .AND. cText[1]$"|%_#" //15.06.2006 17:41 cText := cText[1]+IIf(cText[2]="&",&(SubStr(cText,3,Len(cText)-2)),SubStr(cText,2,Len(cText)-1)) ENDIF IF Len(cText)>1 .AND. cText[1] = "%" // waagrechter Strich auf halber Buchstabenh”he GraLine( aPrinterPS[1], {nSpaG, nZeiG+nPpZG/2}, {nSpaG+Val(SubStr(cText,2)), nZeiG+nPpZG/2} ) aPenPos := {0,0} ELSEIF Len(cText)>1 .AND. cText[1] = "_" // waagrechter Unterstrich 1mm unter Basislinie GraLine( aPrinterPS[1], {nSpaG, nZeiG-10}, {nSpaG+Val(SubStr(cText,2)), nZeiG-10} ) aPenPos := {0,0} ELSEIF Len(cText)>1 .AND. cText[1] = "|" // senkrechter Strich mitten durch den Buchstaben GraLine( aPrinterPS[1], {nSpaG+nPpSG/2, nZeiG+nPpZG}, {nSpaG+nPpSG/2, nZeiG+nPpZG-Val(SubStr(cText,2))} ) aPenPos := {0,0} ELSEIF Len(cText)>1 .AND. cText[1] = "#" // 11.10.2005 macht dickere Striche mit Boxen aBoxAttr := Array( GRA_AA_COUNT ) // =5 aLineAttr := Array( GRA_AL_COUNT ) // =5? IF ValType(cAttrib) == "C" .AND. cAttrib != "{{},}" .AND. ValType(&cAttrib)=="A" //01.05.2007 18:44 aBoxAttr[ GRA_AA_COLOR ] := GraMakeRGBColor(&cAttrib[1]) aLineAttr[ GRA_AL_COLOR ] := GraMakeRGBColor(&cAttrib[1]) ELSE aBoxAttr[ GRA_AA_SYMBOL ] := GRA_SYM_DENSE1 ENDIF aOldBAttr := GraSetAttrArea( aPrinterPS[1], aBoxAttr ) aOldLAttr := GraSetAttrLine( aPrinterPS[1], aLineAttr ) aBRO := &(SubStr(cText,2)) GraBox( aPrinterPS[1], {nSpaG, nZeiG}, {nSpaG+aBRO[1], nZeiG+aBRO[2]}, GRA_OUTLINEFILL ) // 1=GRA_FILL GraSetAttrArea( aPrinterPS[1], aOldBAttr ) GraSetAttrLine( aPrinterPS[1], aOldLAttr ) aPenPos := {0,0} // 13.04.2007 21:01 waagrechter Unterstrich 1mm unter Basislinie ELSEIF Len(cText)>1 .AND. Trim(cText)==Replicate("-",Len(Trim(cText))) aBoxAttr := Array( GRA_AA_COUNT ) // =5 aBoxAttr[ GRA_AA_SYMBOL ] := GRA_SYM_DENSE1 GraSetAttrArea( aPrinterPS[1], aBoxAttr ) GraBox( aPrinterPS[1], {nSpaG, nZeiG+nPpZG/2}, {nSpaG+Len(Trim(cText))*nPpSG, nZeiG+nPpZG/2+nFFont}, GRA_OUTLINEFILL ) // 1=GRA_FILL aBoxAttr[ GRA_AA_SYMBOL ] := GRA_SYM_SOLID GraSetAttrArea( aPrinterPS[1], aBoxAttr ) aPenPos := {0,0} // 13.04.2007 21:01 waagrechter Unterstrich 1mm unter Basislinie ELSEIF Len(cText)>1 .AND. Trim(cText)==Replicate("=",Len(Trim(cText))) aBoxAttr := Array( GRA_AA_COUNT ) // =5 aBoxAttr[ GRA_AA_SYMBOL ] := GRA_SYM_DENSE1 GraSetAttrArea( aPrinterPS[1], aBoxAttr ) GraBox( aPrinterPS[1], {nSpaG, nZeiG+nPpZG/2}, {nSpaG+Len(Trim(cText))*nPpSG, nZeiG+nPpZG/2-nFFont}, GRA_OUTLINEFILL ) // 1=GRA_FILL GraBox( aPrinterPS[1], {nSpaG, nZeiG+nPpZG/2+5}, {nSpaG+Len(Trim(cText))*nPpSG, nZeiG+nPpZG/2+5+nFFont}, GRA_OUTLINEFILL ) // 1=GRA_FILL aBoxAttr[ GRA_AA_SYMBOL ] := GRA_SYM_SOLID GraSetAttrArea( aPrinterPS[1], aBoxAttr ) aPenPos := {0,0} ELSE IF cAusR = ":" //03.10.2006 11:04 Blocksatz: Zwischenr„ume berechnen aTextBox := GraQueryTextBox( aPrinterPS[2], cText ) aAttr1[GRA_AS_EXTRA] := Int((nZeiLen*nPpSG-aTextBox[5,1])/Max(Len(cText),1)) nSpacePix := Max((nZeiLen*nPpSG-aTextBox[5,1]) - aAttr1[GRA_AS_EXTRA]*Len(cText),0) // aAttr2[GRA_AS_EXTRA] := Round((nZeiLen*nPpSG-aTextBox[5,1])/Max(Len(cText),1),0) GraSetAttrString( aPrinterPS[1], aAttr1 ) GraSetAttrString( aPrinterPS[2], aAttr1 ) nSpace := 0 FOR i := 1 TO Len(cText) nSpace += IIf(cText[i]=" ", 1, 0 ) NEXT nPpSpace := Round( nSpacePix / Max(nSpace,1), 0 ) DO WHILE Len(cText) > 0 nSpaceLage := At(" ",cText) nSpaceLage := IIf( nSpaceLage>0, nSpaceLage, Len(cText) ) GraStringAt( aPrinterPS[1], {nSpaG, nZeiG}, SubStr(cText,1,nSpaceLage ) ) aTextbox := GraQueryTextBox( aPrinterPS[2], SubStr(cText,1,nSpaceLage ) ) nSpaG += aTextBox[5,1]+nPpSpace+aAttr1[GRA_AS_EXTRA]*Len(SubStr(cText,1,nSpaceLage )) cText := SubStr(cText,nSpaceLage+1) ENDDO ELSEIF ("."$cText.OR.","$cText) .AND. Val(cText)<>0 .AND. nSpalte>0 .AND. ; !(cText[3]==".".AND.cText[6]==".") // nur Zahlen, nicht bei Datum aAttr1[GRA_AS_HORIZALIGN] := GRA_HALIGN_RIGHT GraSetAttrString( aPrinterPS[1], aAttr1 ) GraSetAttrString( aPrinterPS[2], aAttr1 ) nSpaG += IIf(cKomma=",", Len(cText)*nPpSG-nPpSG*IIf(Len(cText)<10,1,2), Len(cText)*nPpSG ) GraStringAt( aPrinterPS[1], {nSpaG, nZeiG}, cText ) aTextbox := GraQueryTextBox( aPrinterPS[2], cText ) ELSE GraStringAt( aPrinterPS[1], {nSpaG, nZeiG}, cText ) aTextbox := GraQueryTextBox( aPrinterPS[2], cText ) ENDIF aPenPos := AClone(aTextbox[5]) ENDIF //? aPenPos[1] := aPenPos[1]/oFontH:width*nPpSG //? aPenPos[2] := aPenPos[2]/oFontH:height*nPpZG // // weil aPoSZ nur elementweise ver„ndert wird, ist die Žnderung in der aufrufenden Ebene sichtbar! aPoSZ[2] := Round( ( aPaper[6] - aPaper[4] - nPoffY - nZeiG - aPenPos[2] ) / nPpZG,1 ) //11.12.2006 13:26 aPoSZ[1] := Round( ( nSpaG + aPenPos[1] - nPoffX - aPaper[3] ) / nPpSG,1 ) nPoffX := nOldPoffX //29.04.2006 17:51 zurck auf den Wert in Drubef.dbf nPoffY := nOldPoffY //29.04.2006 17:51 RETURN aPenPos