First, consider this existing code that prints a multi-line text from a memo field.
- Code: Select all Expand view
FOR lx := 1 TO MLCount( oEndText:tagtext, 120,, .T. )
WOPAGEHEAD( oPrn, aHead )
IF lPrintColor
oPrn:SayText( nRow, 2 * nCsp, MemoLine( oEndText:tagtext, 120, lx,, .T. ),nCsp*120, nRsp * 1.1, oFcond, , CLR_RED )
ELSE
oPrn:SayText( nRow, 2 * nCsp, MemoLine( oEndText:tagtext, 120, lx,, .T. ),nCsp*120, nRsp * 1.1, oFcond )
ENDIF
nRow += nRsp
NEXT
The function WOPAGEHEAD( ) checks the row number to be sure there is enough space for the next line on the page , If not, it advances to the next sheet, prints the header, and then continues to print the text from the memo field. Also, because the nRow is updated with each line, we know where to start printing the next section after the information contained in the memofield.
Using the new implementation, I find the following issues:
1) You have used a defined dimensions sample. This is not the same as the presenting problem in the original thread which wants to print the text inline with other information that was already printed, and before additional information. The example cited was disclaimer text that comes near the end of a printed invoice.
2) Using the following code for 22.03
- Code: Select all Expand view
- cRTF := oEndText:tagtext
oPrn:SayText( nRow, 2*nCSP, cRTF, nCsp*80, nRsp * 6.1 )
I can print the text. The text is actually saved as RTF in the memo field. However, the size of this text can vary a lot. So, I need to be able to determine the amount of space I will be needing, based on the content of the RTF, and be able to track the printed rows. I need to know when to cutoff printing on one sheet and start on the next. Perhaps there are already functions that can determine this. Using them, as in the first coding sample, I could then feed the data appropriately to the print routine.
I hope this isn't too confusing. What we have is significant, but I think we will see this be a concern no matter what type of RTF content we ultimately decide to print. We must handle the length and page breaks.
I am very willing to test any ideas. I'm already experimenting with this.
Thank you for all the work on this implementation. I do appreciate it.