Trouble formatting for printing
Posted: Tue May 13, 2014 8:38 am
Hi'ya,
I'm still struggling with printing fields !
I have a card with two fields on it. The user can type HTML text (he/she can 'format' the text with colour, bold, italic... etc...) of various length into each of the fields - he/she could 'format' the line length themselves hitting 'cr' -or- LC will wrap the text at line end automatically.
Each of the two fields contains HTML formatted text of various length, some text 'lines' occur on a single screen/page 'line', whilst other text 'lines' may be auto wrapped and 'spread' over several screen/page 'lines'. Furthermore the amount of text (number of lines of text) in each field is variable.
OK, So, printing... should be a pretty simple affair... hmmm...
By getting the 'formattedlength' of the field that contains the required text I can set the height of the control on the print card and 'spread' (print) the text over multiple pages as required. I can even gang up the two controls so that they 'flow' correctly on my print pages be that one page overall (not much text in either of the two controls) or multiple pages (loads of text in one or more of the controls).
The problem : 'formattedlength' reports the overall height of the control required to display the text without needing to scroll (obviously, no good for printing) the said control. Using this value I can check required height of my control and set its height to suit / decide if I need to spread the text of the control over multiple print pages.
So, after using 'formattedheight' to detect if the required control height for text it contains and noting the required control height is greater than the available page space, I can then use a simple repeat structure to detect how may lines of text will fit the available space/control size, populate the control with only that number of lines and repeat printing pages as required... Seems simple enough (now that I've spent some time on it) but... there's always a but... !!
[1] I don't seem to be able to maintain my HTML formatting (bold, italic, colours etc) once I start to manipulate/copy chunks of the user's text between fields...
[2] using the 'Line' command (e.g. : put line 3 of control sMyText into sMyLine) does not put the line 3 (per se) of the control's text as it is seen in the control on the card but rather the line as it is separated by crlf (basically as the user entered it) into sMyLine
[3] inserting '<br>' or '<p>' into the user's text to manually break up (format to line length) the lines actually results in inserting <Br> (or somesuch) which does not result in a formatting command - just a load of chars - which I can understand but LC renders 'incorrectly'...
The long and the short is I'm very confused (having spent numerous DAYS on this) and having played with 'formattedheight', 'formattedwidth' and chunks in repeat loops I'm no further on to being able to display a piece of html formatted text over multiple pages without chopping some of it off, missing out some of it or losing the original html formatting...
Anyone able to decypher / make any sense out of the above and come to my rescue please ?
Thanks a million.
I'm still struggling with printing fields !
I have a card with two fields on it. The user can type HTML text (he/she can 'format' the text with colour, bold, italic... etc...) of various length into each of the fields - he/she could 'format' the line length themselves hitting 'cr' -or- LC will wrap the text at line end automatically.
Each of the two fields contains HTML formatted text of various length, some text 'lines' occur on a single screen/page 'line', whilst other text 'lines' may be auto wrapped and 'spread' over several screen/page 'lines'. Furthermore the amount of text (number of lines of text) in each field is variable.
OK, So, printing... should be a pretty simple affair... hmmm...
By getting the 'formattedlength' of the field that contains the required text I can set the height of the control on the print card and 'spread' (print) the text over multiple pages as required. I can even gang up the two controls so that they 'flow' correctly on my print pages be that one page overall (not much text in either of the two controls) or multiple pages (loads of text in one or more of the controls).
The problem : 'formattedlength' reports the overall height of the control required to display the text without needing to scroll (obviously, no good for printing) the said control. Using this value I can check required height of my control and set its height to suit / decide if I need to spread the text of the control over multiple print pages.
So, after using 'formattedheight' to detect if the required control height for text it contains and noting the required control height is greater than the available page space, I can then use a simple repeat structure to detect how may lines of text will fit the available space/control size, populate the control with only that number of lines and repeat printing pages as required... Seems simple enough (now that I've spent some time on it) but... there's always a but... !!
[1] I don't seem to be able to maintain my HTML formatting (bold, italic, colours etc) once I start to manipulate/copy chunks of the user's text between fields...
[2] using the 'Line' command (e.g. : put line 3 of control sMyText into sMyLine) does not put the line 3 (per se) of the control's text as it is seen in the control on the card but rather the line as it is separated by crlf (basically as the user entered it) into sMyLine
[3] inserting '<br>' or '<p>' into the user's text to manually break up (format to line length) the lines actually results in inserting <Br> (or somesuch) which does not result in a formatting command - just a load of chars - which I can understand but LC renders 'incorrectly'...
The long and the short is I'm very confused (having spent numerous DAYS on this) and having played with 'formattedheight', 'formattedwidth' and chunks in repeat loops I'm no further on to being able to display a piece of html formatted text over multiple pages without chopping some of it off, missing out some of it or losing the original html formatting...
Anyone able to decypher / make any sense out of the above and come to my rescue please ?
Thanks a million.