BKeeney Shorts printing multi-page text document

I have a long string that could span multiple pages.

Using Shorts, does anyone know how to append the multiple pages?

I know how to print the text onto one page and return it but figuring out
how many pages the text will require and splitting it up is my problem.

Most of the examples in Shorts show a single routine creating and return one page that is then Appended.
I don’t see a newpage method that I could call from WITHIN a sub… so that I could run a loop calculating
text height, appending text, and then when you run out of room… newpage and continue.

I guess I have to pull all that code out of the sub and into the main print report and then pass just
one page of text at a time into one single routine that returns one single page.

It will depend on that very long string if this will work for you.

I split the string on the endoflines into an array.
then I loop through with the full string in the text item to see if it will fit.
I will decrement the counter, and add that many rows of the array to a string that I try to fit again.
keep decrementing the counter (making the string smaller) until the string fits.
then I switch to the next page, and remove the lines that I have already put on the previous page from the array.

starting the loop again, see if all the remaining rows will fit, if not, decrement the counter and try that many rows, looping until it fits.

I am not infront of Xojo right now or I will post some sample code.

—sb

[quote=367662:@scott boss]I split the string on the endoflines into an array.
then I loop through with the full string in the text item to see if it will fit.
I will decrement the counter, and add that many rows of the array to a string that I try to fit again.
keep decrementing the counter (making the string smaller) until the string fits.
then I switch to the next page, and remove the lines that I have already put on the previous page from the array.

starting the loop again, see if all the remaining rows will fit, if not, decrement the counter and try that many rows, looping until it fits.[/quote]

That’s exactly the sort of thing we sent Tim earlier today. We have an example project if you’re in need of an example. It tends to be an ugly, time consuming, process because it a lot of text will take a while and should, ultimately be part of a thread so as to not affect UI performance.