ben.kansas
11th April 2018, 21:31
Hello,

We have a custom session to print our Contract Acknowledgement in LN 10.5 using LN UI.

On the report, we want to print the contract line text (tpctm110.text). We've placed it on the report in its own layout.

When the text field has a large amount of text, the report prints the first line, then skips to a new page. The new page is blank (no text from the text field, though it does print the other before field layouts). Then prints the remainder of the data on the report.

The full text is not printed.

Any advice on how to fix this?

Thanks,
Ben

mark_h
11th April 2018, 22:31
Does it do the same thing if sending it to a display or a file?

ben.kansas
11th April 2018, 23:51
Sending to Display the text is truncated after the first line.

However, sending to a file, all of the text prints.

mark_h
12th April 2018, 15:36
I am not sure about your version, but we have had instances where the users cut and paste into text from word(for example) and this causes some weird things to happen. I was wondering if you could confirm it is plain text? This is about the only thing I can think of right offhand.

ben.kansas
12th April 2018, 19:39
So I took your advice. I retyped all of the text to make sure that it was plain text. Now I am getting about half of the text printing.

It looks like the report is then trying to do a page break, but then isn't continuing with printing the text field.

mark_h
13th April 2018, 15:44
I was just looking at our print PO's and the layout that does text and I do not see anything special around it. Do you have any print page breaks turned on for the other layouts? One thing you can try is cloning it to a new report - then delete all layouts except text. Run it see what happens - then add layouts one at a time watching what happens with each addition. I am not even sure that will help. Swagging it here.

We do printing via UNIX printers. Most of our printers have formfeed checked - not sure if any of this makes a difference or not.

PS - when you re-typed it you spelled department wrong. That almost looks like our standard PO type text. :)

ben.kansas
13th April 2018, 18:48
Hi Mark,

Thanks for the advice. I took it.

I re-discovered in the process that on the layout I set the output expression to lattr.break, which would prevent the layout from printing on a page break, regardless of whether the text is complete.

Because the layout is a before.field type, I don't want it to print every time there's a new page. So I need to do some manual control on when the when the layout is printed.

Any suggestions on detecting that the text isn't complete and using lattr.print to control whether the layout prints?

Maybe something using lattr.textlineno and comparing it to the total number of lines in the text field?

txt.file = bse.temp.dir$() & "/ConTxt"
lines = text.read("tpctm110.text", "2", kw1, kw2, kw3, kw4, grp, opt, txt.file, 0)

if not lattr.break then
if lattr.textlineno <= lines then
lattr.print = TRUE
else
lattr.print = FALSE
endif
else
lattr.print = TRUE
endif



Thanks,
Ben

mark_h
14th April 2018, 00:59
Hmm - could you set a variable to like print.mylayout = true. Then in the after.layout set it to false. Then in the before layout test if print.mylayout the print it, if false set my print.layout = false. You then go into the layout for when you want to trigger it to print again - you just have to figure out when you want it to print again and set the print.mylayout back to true. I have actually used empy layouts just to trigger the script to do something.

ben.kansas
16th April 2018, 21:03
Here's the really frustrating part.

When the report is printed via BWPrint, it is fine. All the text prints and layouts are handled correctly.

However, we use LN UI and send our documents to the DOM for printing. When run through the DOM, the report cuts off half of the text.

If I remove the text field before print section, then it prints all of the text, but doesn't handle page breaks correctly.

field.tpctm110.text:
before.print:
txt.file = bse.tmp.dir$() & "/ConTxt"
txt.lines = text.read("text", "2", kw1, kw2, kw3, kw4, grp, opt, txt.file, 0)
need(txt.lines)


Any advice on handling this with the DOM?

mark_h
17th April 2018, 15:09
Sorry I do not know anything about the LN UI or DOM. Wait and see if someone comes along on DOM usage.

ben.kansas
19th April 2018, 22:45
Any help with DOM usage?