Print Preview ActiveX Active Users: 26 / Visits Today: 112
Highest Active Users: 26
Print Preview ActiveX
Home | Profile | Register | Active Topics | Members | Search | FAQ | RSS
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Print Preview
 Suggestions & Enhancments
 textline filling
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic: Exit from Preview Window Topic Next Topic: numbertype  

emiel
Administrator

Belgium
327 Posts

Posted - 06/30/2004 :  13:09:03  Show Profile  Reply with Quote
for some reason it should be nice when text(lines) could be filled-out with for instance :

preview.FillLine ("Any text(line) to be filled out", PrintablePageWidth) (total width)

or

preview.FillLine ("Any text(line) to be filled out", XposLeft, XposRight) (between XposLeft and XposRight)

in which case the spaces will increase/decrease so that the line will fit the total printable pagewidth.
This could be handy for especially proportional fonttypes, however for non-porprotional fonttypes like courier it is also useable.

But take in consideration that when .ShowBorder is true the start-Xposition end-Xposition must lay subsequentially after and befor the left- and rightborder.The same for the Yposition for the top- and bottomborder.



Go to Bottom of Page

Waty Thierry
Forum Admin

Belgium
635 Posts

Posted - 06/30/2004 :  15:59:36  Show Profile  Visit Waty Thierry's Homepage  Reply with Quote
I will investigate for such method.
Have you written one in VB?

Come and visit :
www.immoassist.com
www.ppreview.net
www.vbdiamond.com
www.d2dsources.com
www.mandix.com
Go to Bottom of PageGo to Top of Page

emiel
Administrator

Belgium
327 Posts

Posted - 06/30/2004 :  17:21:10  Show Profile  Reply with Quote
yes i have; see following :

Acces2003 VBA

Result is line printing in whole words filled from left- to right margin, with exception of lines shorter printable pagewidth.
if showborder, start-Xpos is leftmargin+1 space and rightmargin - 1 space.



Private Sub Command0_Click()
Dim RegPerPag As Integer, b As Integer, I As Integer, c As Integer, RegelTwip As Long, TxtTwip As Long
Call tekst ' get dummy text p(ublic)Txt , lowercase p I use for public variables
pTxt = Trim(pTxt) & " " ' remove eventual first and last space of the text and add one which is needed
preview.PageSize = pPapFrm
preview.AddFirstPage pMal, pMar, pMat, pMab ' set margins
preview.FontSize = Me!FontBreedte preview.FontName = Me!FontType
preview.FontBold = pFntBld
preview.FontItalic = pFntIta
RegPerPag = (pPapLen - Val(pMat) - Val(pMab)) / (pHgTwip / 56.7) '1 mm = 56.7 twips RegPerPag amount lines per page
Me!RegPp.Caption = Str(RegPerPag) ' show lines on screen form
RegelTwip = ((pPapWid - Val(pMal) - Val(pMar)) * 56.7) - pMinBes ' pMinbes = 2 spaces in twips (Show border true) or 0
For I = 1 To Len(pTxt) ' temporary solution
TxtTwip = TxtTwip + preview.TextWidth(Mid(pTxt, I, 1)) ' return value of textwidth = 0 in case > 78688 twips (bug ??????????)
Next I
If TxtTwip > RegelTwip Then ' regelTwip = twips per line
Call Uitlijnen(TxtTwip, RegelTwip, RegPerPag) ' Txttwip = tot.lenght of text in twips; regeltwip = twips per line
else
.....................
.....................
End If
End Sub
--------------------------------------------------
Private Function Uitlijnen(FeitTwip As Long, BeschTwip As Long, RegPerPag As Integer)
Dim LenTxt As Integer, HlpTxt As String, WordTel As Integer, WordCnt As Long, PgNr As Integer
Dim spNum As Integer, spLen As Integer, Word(100) As String, kad As Integer, RegCnt As Integer
Dim I As Long, II As Integer ' for "for next" loops

If pTkad Then ' is showborder true ?
kad = pSpTwip ' used for adjusting xpos and Ypos when showborder
is true
End If
preview.PageNumberType = prPTArabic
preview.PageSize = pPapFrm ' 8 = a3 9 = a4 11 = a5
preview.Orientation = pOri ' 1 = port 2 = land
preview.ShowBorder = pTkad ' pTkad can be True of False
WordTel = 1 ' counter for words per line
LenTxt = Len(pTxt) ' number of characters in PASSED text

For I = 1 To LenTxt ' line scan on spaces and words
If Mid(pTxt, I, 1) <> " " Then ' if space then end word
Word(WordTel) = Word(WordTel) + Mid(pTxt, I, 1) ' memorise
' words in array word
' (optionbase 0 but not
'used), 100words per line
Else
spNum = spNum + 1 ' counting spaces
WordCnt = WordCnt + preview.TextWidth(Word(WordTel)) '
' counting twips of
'each word
WordTel = WordTel + 1 ' word counter
Word(WordTel) = "" ' word removal from
' the first scan, or befor
End If
HlpTxt = HlpTxt + Mid(pTxt, I, 1) ' keep in mind the last line
' can be shorter
If I = LenTxt And preview.TextWidth(HlpTxt) < BeschTwip Then
' if shorter print it
preview.AddTextAt Trim(HlpTxt), kad, pYpos ' print last line
End If
If WordCnt + spNum * pSpTwip > BeschTwip Then ' are spacetwips +
' wordtwips > twips per line
I = I - Len(Word(WordTel - 1)) - 1 ' if last word is
'not scanned totally
' then skip last
' word and scanned last space
WordCnt = WordCnt - preview.TextWidth(Word(WordTel - 1))
' adjust lenght
WordTel = WordTel - 2 ' skip printing
'last word
spNum = spNum - 2 ' remove two spaces
spLen = (BeschTwip - WordCnt - ((spNum) * pSpTwip)) / spNum + pSpTwip ' calculate length new space
pXpos = kad ' xpos = hor.
' startpos (border bounded)
For II = 1 To WordTel ' printing line
preview.AddTextAt Word(II), pXpos, pYpos
pXpos = pXpos + spLen + preview.TextWidth(Word(II))
' adjust Xpos
Next II
RegCnt = RegCnt + 1 ' increase linecounter
pYpos = pYpos + pHgTwip ' Ypos next line
HlpTxt = "" ' empty help variable for text
WordTel = 1 ' reset word counter
Word(1) = "" ' remove eventual first word
spNum = 0 ' reset space counter
WordCnt = 0 ' reset word twips counter
End If
Next I
pYpos = 0
pXpos = 0

preview.EndDocument prOTScreen

End Function

Edited by - emiel on 07/02/2004 12:52:05
Go to Bottom of PageGo to Top of Page
  Previous Topic: Exit from Preview Window Topic Next Topic: numbertype  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Print Preview ActiveX © Mandix Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000 Version 3.4.02