Great!
I found a bug. Now the text width should be correct (cell margins!).
It's a should be better named 'TruncCell' (truncted cell).
Code: Select all
; works only as PurePDF library (Don't use it direct)
Procedure.s pdf_TruncCell(w.f, h.f=0, Text$="", Border.w=0, Ln.f=0, Align$="", Fill.f=0, Link.w=-1)
Protected wMax.f, TLen.l, trunc$
wMax = w - (2 * pdfCMargin)
If pdf_GetStringWidth(Text$) <= wMax
pdf_Cell(w, h, Text$, Border, Ln, Align$, Fill, Link)
Else
TLen = Len(Text$)
Repeat
TLen - 1
trunc$ = Left(Text$, TLen)+"..."
Until pdf_GetStringWidth(trunc$) <= wMax
pdf_Cell(w, h, trunc$, Border, Ln, Align$, Fill, Link)
ProcedureReturn Right(Text$, Len(Text$)-TLen)
EndIf
EndProcedure