Postada em 19/04/2011 08:38 hs
Olá amigos.... Mais abaixo esta um exemplo que peguei em 'Dicas' sobre texto justificado, porém estou tendo um problema com relação as margens. No exemplo o txtbox imprimi assim: 'asasassalk asasaslkas aslkaslkaslkals aslklklkass alsklklas alklklkasasalkas l alskaslaskalskaslakslaskalksa asslaksalskalakslkslaskaslka '
Preciso ajustar as margens esquerda e direita quzando houver salto de linha sem o 'Enter' ter sido usado, ou seja, uma linha longa; Acontece que quando da o salto a megem abaixo fica quase que em 0 left.
grande abraço...
**********segue o codigo******************** Dim look As String Dim x As Long Dim Y As Long Dim eLine() As String Dim tmp As String
eLine = Split(Text, vbCrLf) If LineLength < 10 Then LineLength = 10 For Y = 0 To UBound(eLine) Do While LineLength < Len(eLine(Y)) DoEvents For x = LineLength To 1 Step -1 look = Mid(eLine(Y), x, 1) Select Case look Case " " tmp = tmp & IIf(tmp > "", vbCrLf, "") & Trim(Left(eLine(Y), x)) eLine(Y) = Right(eLine(Y), Len(eLine(Y)) - x) Exit For Case Else If x < (LineLength / 2) Then tmp = tmp & IIf(tmp > "", vbCrLf, "") & Trim(Left(eLine(Y), LineLength - 1)) & "-" eLine(Y) = Right(eLine(Y), Len(eLine(Y)) - (LineLength - 1)) Exit For End If End Select Next x Loop tmp = tmp & IIf(tmp > "", vbCrLf, "") & eLine(Y) Next Y WordWrap = tmp
|