Text formatting - start text where last text left off?

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Text formatting - start text where last text left off?

Postby Patrick » Fri Mar 27, 2009 8:37 pm

Greetings,

I'm trying to print text of various length in 1 paragraph. I can't figure out how to make the next line of text start where the last line left off? Each line of text can be from 1 to 255 chars in length.

Using VPE4 Pro, XP, and Visual Lansa (it's like VB), and the Active X control.

Sample code:


SELECTLIST NAMED(#memos) /* This is a loop */
INVOKE METHOD(#VPE.Print) LEFT(#vpe.nRight) TOP(#vpe.nTop) TEXT(#text3)
ENDSELECT

Also tried:
INVOKE METHOD(#VPE.RenderWrite) LEFT(0) TOP(0) RIGHT(0) BOTTOM(0) TEXT(#text3)
#height := #vpe.nRenderHeight
#width := #vpe.nRenderWidth
INVOKE METHOD(#VPE.Write) LEFT(#vpe.nRight) TOP(#vpe.nTop) RIGHT(#width) BOTTOM(#height) TEXT(#text3)

All to no avail - most times when I print out the variables (height, width) it has zeroes for most. Visual Lansa does not recognise the V flags (IE VFREE - is there a numeric value I can use instead of VFREE?)

Can you please give me an example of how to print multiple lines of text concurrently? IE - Line 1 ends with "li" and Line 2 starts with "ke" and I'd like it to come out as "like"!

Thank you,
Pat
Patrick
 
Posts: 23
Joined: Thu Mar 12, 2009 5:44 pm

Postby IDEAL Software Support » Mon Mar 30, 2009 9:52 am

SELECTLIST NAMED(#memos) /* This is a loop */
INVOKE METHOD(#VPE.Print) LEFT(#vpe.nRight) TOP(#vpe.nTop) TEXT(#text3)
ENDSELECT


Without being familiar with this programming language, the code looks correct. Note that you can only assemble a single line of text with this method. It won't break to the next line. To do so, you must build internally the complete string and provide it as a whole to the Print() method.

INVOKE METHOD(#VPE.RenderWrite) LEFT(0) TOP(0) RIGHT(0) BOTTOM(0) TEXT(#text3)
#height := #vpe.nRenderHeight
#width := #vpe.nRenderWidth
INVOKE METHOD(#VPE.Write) LEFT(#vpe.nRight) TOP(#vpe.nTop) RIGHT(#width) BOTTOM(#height) TEXT(#text3)


This can not work. You must set right and/or/xor bottom to VFREE. The value for VFREE can be found in vpecomon.h in the C++ directory.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Postby Patrick » Mon Mar 30, 2009 5:39 pm

you must build internally the complete string and provide it as a whole to the Print() method.


We save the text in 50 char chunks. I assemble these 50 char chunks into a 255 char text field (text3), some users write more than 250 chars and I cannot assemble them into a string higher than 255 chars - so I'm forced to handle multiple strings.

I'm trying top get the 2nd+ strings to align with the previous strings. I have the value for VFREE (-2147483549 ?) from the .h file above (thanks) - I'll try it next. I thought the RenderHeight did just that tho?

Thanks for the help.
Pat
Patrick
 
Posts: 23
Joined: Thu Mar 12, 2009 5:44 pm

Postby IDEAL Software Support » Mon Mar 30, 2009 7:14 pm

I thought the RenderHeight did just that tho?


This is correct. But you were using RenderWrite(). This method allows to compute the with and height (VFREE, VFREE), or the width (VFREE) for a given height, or the height (VFREE) for a given width. But you specify zero for the height and zero for the width. The dimension(s) which shall be computed must be VFREE, and the other(s) must be set to the value you wish to compute. But both are zero. So the call returns correctly (0, 0) for the computed width and height.

If your programming language does not allow strings larger than 250 characters, you have problem. We recommend you find a way to work around this problem, instead of fiddling with the Render Methods and trying to layout the text yourself. It will not give as good results from the perspective of the layout. It is much better to provide the string as a whole to VPE.

It seems to me like an anachronism if a programming language does not support strings larger than 250 characters in the year 2009. Does your programming language support to allocate larger blocks of memory? So you could use this as a workaround and store your complete strings in such memory blocks and provide them to VPE. Note that the strings in such memory blocks need to be zero-terminated, i.e. put a NULL-byte after the last character of the string.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Postby Patrick » Fri Apr 03, 2009 5:18 pm

I did some checking and found Lansa does have String variables that seem to have no upper limit on size! I was using the old Character fields that only go up to 256 chars.

So thank you very much for making me research this! :D
Patrick
 
Posts: 23
Joined: Thu Mar 12, 2009 5:44 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 20 guests