Print Preview ActiveX Active Users: 19 / Visits Today: 576
Highest Active Users: 81
Print Preview ActiveX
Home | Profile | Register | Active Topics | Members | Search | FAQ | RSS
 All Forums
 Print Preview
 Tips & Tricks
 VB Routine: paraTextList

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert Email Insert CodeInsert QuoteInsert List

* Forum Code is ON
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert a File

Check here to subscribe to this topic.

T O P I C    R E V I E W
wbgookin Posted - 11/20/2004 : 21:47:22
I use this routine to make either a numbered or bulleted list out of a paraText. The input is an array with the list items, the x and y coordinates, optionally a width and height to fit the text to, and the type of list. This function requires a couple other's I've posted already. As with the rest, it works for me but your mileage may vary. If you improve it (or any of my routines), please post them here for the rest of us to enjoy!

First is the enum that I use in it:

Public Enum ppListType
    ppLTNumbered = 1
    ppLTBullet = 2
End Enum

And now the routine:

Public Function paraTextList(prn As PrintPreview5.Preview, ByVal valueArray As Variant, xPos As Variant, yPos As Variant, indent As Variant, ByVal listType As ppListType, Optional ByVal fitWidth As Variant, Optional ByVal fitHeight As Variant)
'Function paraTextList (requires paraTextHeight and paraTextFit functions)
'prn is the preview control
'valueArray() is an array filled with the items to be presented in list form
'xPos is the starting x coordinate of the list
'yPos is the starting y coordinate of the list
'listType is of type ppListType (ppLTNumbered or ppLTBullet)
'if supplied, fitWidth and fitHeight are values into which the paratext should be fit.
'paraTextList returns the next y value

Dim i As Integer 'just a counter
Dim txtString As String 'the main string to be printed

txtString = ""
For i = LBound(valueArray) To UBound(valueArray)
    If i > LBound(valueArray) Then txtString = txtString & "<nl>"
    Select Case listType
        Case ppLTNumbered
            txtString = txtString & "<xp -" & prn.C_Twips(indent) & ">" & i & ". <xp 0>" & valueArray(i)
        Case Else 'use a bullet
            txtString = txtString & "<xp -" & prn.C_Twips(indent) & "><ac 149><xp 0>" & valueArray(i)
    End Select
Next i

'if the fitWidth and/or fitHeight variables are missing, use the page width remaining
If IsMissing(fitWidth) Then
    fitWidth = prn.PageWidth - prn.PageMarginLeft - prn.PageMarginRight - prn.C_Twips(xPos)
End If
If IsMissing(fitHeight) Then
    fitHeight = prn.PageHeight - prn.PageMarginTop - prn.PageMarginBottom - prn.C_Twips(yPos)
End If

'use the paratextfit command to fit it into the appropriate area
paraTextList = paraTextFit(prn, txtString, prn.C_Twips(xPos) + prn.C_Twips(indent), yPos, prn.C_Twips(fitWidth) - prn.C_Twips(indent), prn.C_Twips(fitHeight))

End Function

Print Preview ActiveX © Mandix Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000 Version 3.4.02