zen reports: line break rules

203 views
Skip to first unread message

len...@yahoo.com

unread,
Aug 5, 2013, 2:20:20 PM8/5/13
to intersys...@googlegroups.com

Hello,

does anyone know how to overwrite the FO rule for breaking the line so that the string of text fits a specified item width in ZEN report?

For example, it seems that Zen report would not start the next line with a period or a comma even though we would insert a space in the middle of the sentence. Space would always work (up to now), except for cases, when the next line starts with period or comma (maybe other punctuation signs).

We tried "breakonline" set to true, and couldn't make it to work either, however, it would be great to set it up for all our reports, not for each individual case.

 

thank you,

 

Elena

Jonathan Levinson

unread,
Aug 6, 2013, 10:06:15 AM8/6/13
to intersys...@googlegroups.com

I don’t understand your request.  Can you give some examples?

 

For you, what is an acceptable solution for breaking the line so that the string of text fits a specified item width in the ZEN Report?

 

I don’t understand what you mean by not starting the next line with a period or comma.  Please give an example.

 

What do you mean by you couldn’t get “breakonline” to work?

 

What do you mean by setting up “it” for all your reports, not each individual case?

 

Thanks,

Jonathan

--
You received this message because you are subscribed to the Google Groups "InterSystems: Zen Community" group.
To post to this group, send email to InterSys...@googlegroups.com
To unsubscribe from this group, send email to InterSystems-Z...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/InterSystems-ZEN?hl=en
Zen Community Terms and Conditions: http://groups.google.com/group/InterSystems-ZEN/web/community-terms-and-conditions
---
You received this message because you are subscribed to the Google Groups "InterSystems: Zen Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intersystems-z...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

elena fialkova

unread,
Aug 6, 2013, 10:37:44 AM8/6/13
to intersys...@googlegroups.com
Hi, Jonathan,
I am sorry that it sounds confusing. Here is an example:
I have a text: "CORTISOL,FREE,24hr.U(30)"  This text does not fit into column width of the zen report, so it has to go to the second line.
To make sure that it does that, I insert a space after the number of characters which I know fit my column width (18), and after that the string looks like that:
"CORTISOL,FREE,24hr .U(30)"
However, this text does not go to the second line! It merges with the next column of the report, which looks very bad. The reason (I think), is because the second line would start with a period.
We don't care that it would start with a period, or any other punctuation sign. For our purposes, we just want any line to break whenever we insert a space.
Is this possible?
 
thanks,
 
Elena

You received this message because you are subscribed to a topic in the Google Groups "InterSystems: Zen Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/intersystems-zen/YYeeuslk4s0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to intersystems-z...@googlegroups.com.

APWZ

unread,
Aug 6, 2013, 10:47:49 AM8/6/13
to intersys...@googlegroups.com
I think you are asking for an option that you can set once, globally (such as in the Application class), and have it apply to all the reports. I am not aware of any such option.
You say you have tried "breakOnLineFeed" unsuccessfully. It would be helpful to see an example of what you expected vs what you saw.
 
Other ReportDisplay attributes to consider investigating are:  "linefeed-treatment", "literalSpaces", "insert-zero-width-spaces"
also "too-long-text", which is applicable only to tables. You can set the text to wrap, truncate, or run into the next cell.
 
 
As for which characters a line-break will not land immediately before, I assume that level of detail is controlled by the PDF rendering engine's algorithms. Please consult Apache FOP's documentation if you are using Cache's built-in rendering engine (in versions 2010.2 and up).   If there is an FO attribute to allow explacit control you will find it in the XSLFO spec (http://www.w3.org/TR/xsl/#keepbreak). To set arbitrary FO attributes, use the Zen Report ReportDisplay attribute "block-container-property" with "include-block-container".
 
 hope that helps,
Ariela Z

Jonathan Levinson

unread,
Aug 6, 2013, 10:53:54 AM8/6/13
to intersys...@googlegroups.com

Instead of space insert a $C(10) – use for instance $tr to convert spaces to $C(10) in your ReportDefinition and set the attribute breakOnLineFeed=”true”. 

 

In your report definition you might have something like:

 

<element name=”Perscription” field=”prescription” expression=’$tr(%val,” “,$C(10))’/>

 

You can use XSLT recursive techniques if you only want to change your ReportDisplay and not your ReportDefinition.

 

ZEN Reports allows you to use XSLT programming.

 

See http://docs.intersystems.com/cache20131/csp/docbook/DocBook.UI.Page.cls?KEY=GRPT_common_display_elements#GRPT_item_call_template

 

The above doc shows you how to use XSLT recursive programming though it is not a tutorial and you might want to see a standard XSLT reference such as the XSLT Cookbook for more hand-holding.

 

In your XSLT (if that is the route you choose to go) you would change spaces to “\n”.  You would also use breakOnLineFeed=”true” (as you would in both approaches to a solution).

 

Regards,

Jonathan Levinson

Senior Software Developer

InterSystems

Peter Davis

unread,
Aug 6, 2013, 10:59:46 AM8/6/13
to intersys...@googlegroups.com
Unless you're using a fixed-width or monospace font, there isn't a fixed number of characters that will fit on a line. In most fonts, the characters have different widths, and the sum of the widths determines what will fit on a line.

Most line-breaking algorithms will not break immediately before a punctuation mark like comma or period, at least in English and, I think, most European languages. One possible mechanism to get around this is to put zero-width spaces (U+200B) between every pair of characters in the string. That effectively makes each character into a separate word, so FOP should be able to break the line anywhere. Because the spaces have zero width, they do not affect the appearance of the line.

Note, however, that this is "in theory."  I have not tested this with ZEN Reports.

-pd

Elena Fialkova

unread,
Aug 6, 2013, 11:27:53 AM8/6/13
to intersys...@googlegroups.com
We do use fixed-width mono space font exactly for the reason, so we could count the characters.

Sent from my iPhone

Elena Fialkova

unread,
Aug 6, 2013, 12:33:22 PM8/6/13
to intersys...@googlegroups.com
$c(10) and breakOnlineFeed combination worked, thanks


Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages