iReport and rich text editor printouts - jasper-reports

I have a question to iReport/JasperReports experts.
I just started to learn JasperReports and iReport.
It looks promising, when you want to print some table reports based on some datasource.
But I have little different requirement.
I have templates prepared in Microsoft Word (typical agreement printout).
Mostly static text with lots of formating like:
lists,
enumerations,
bolding,
italic,
different size fonts,
margins,
indentions,
alignments
and so on
with very few dynamic fields to fill like name, surname, identity number, ...
I can`t find easy way to implement such rich text editor templates in iReport.
Is it possible?
Is it managable?
Is iReport/JasperReports suitable for such rich text editor like printouts?
Thanks

iReport really just defines the template and formatting of the data printed in the report, so you can use it to set font sizes, styles, margins, indentations, etc. If you're using things like a bulleted list or a numbered list, you may have to improvise some using subreports, but for the most part this type of setup is exactly what iReport does.

Related

How can I manage display and spacing on a Crystal Report where I have to display images between the text field?

I have a field that I'm displaying on a report that is a combination of text and codes that represent an image. Some of those icons have ascii symbols that I've used a replace formula to display them as their ascii version. For two or three of the images, I have no luck and have to display a mini picture for the representation.
The codes being sent are something like:
^he^ = ♥ ^st^ = ⭐ ^cl^ = 🍀 etc...
So for the clover leaf, there is no emoji support in my version of Crystal for clover leaves, and the ascii icon I found online for it just shows the empty square icon when an emoji isn't supported.
My workaround for this is to have a formula that converts all my icons to the appropriate ascii where supported, and to leave two blank spaces for the unsupported icons.
>stringvar gift_msg;
>gift_msg:= {DataTable1.gift_field};
>gift_msg := replace(gift_msg,"^CL^"," ");
>gift_msg := replace(gift_msg,"^HE^","♥");
>gift_msg := replace(gift_msg,"^ST^","★");
>gift_msg
I then put a suppression formula on each image that looks like this:
>mid({DataTable1.gift_field},2,4)<>"^CL^"
So I duplicated the image along the length of the field and increment the mid formula to match the field. I also set the font to Consolas so that it's fixed width to remove any surprises in spacing. My issue is that this still creates very strange spacing, and I'm almost certain there's a much easier way to do this.
One option is to use a free service such as Calligraphr.com to convert your image to a font.
Given that your image relies on several colors, the font option might not work.
Another option is to build the expression as html with image source directives where you need them. You would then need a create or use a 3rd-party UFL to convert the full expression to an image that you can load on the fly using the Graphic Location expression. At least one of the UFLs listed by Ken Hamady here provides such a function.

iTextSharp Flattening Form Removes Indentation, Spacing

I am having an issue using Adobe LiveCycle Designer in conjunction with iTextSharp. I have a multi-line text field that I'm stamping That looks like...
Blah blah text here: _________________
______________________________________
______________________________________
In LiveCycleDesigner, I have a single field that encapsulated all 3 lines (including the static text). I've set the font/paragraph settings so that the first line indents over to where the field starts, the field aligns vertically, and the lines are spaced properly.
When I use PdfStamper to set the fields (without flattening the form), it looks fine in Adobe (though Chrome and Firefox default plugins don't seem to support AcroForms very well). When I flatten the form, though, I lose everything but the font.
Does iTextSharp just not support the ability to do this? Is there some better way I should be doing this? I'm trying to build a generic form builder for my application, so a one-off fix won't really be useful for me.
The only alternative I've thought of is to break it into 3 fields on the PDF and use some clever grouping and MeasureString() (UGH) to determine how much of my string can fit in each field. Can anyone think of anything better?

Superscript in Crystal reports formula

I am trying to make part of array text into superscript inside my formula field. I tried rendering the field as HTML with a tag but it seems it is not supported. Following did not work
numberVar array arr:=["1<sup>st</sup>"];
Is there a way round this problem ?
It turns out Crystal Reports works with superscript, only the same way as Visual Studio does. Just copy/paste one of these: ¹²³⁴⁵⁶⁷⁸⁹⁰
As far as I'm aware, Crystal Reports doesn't support superscript at all, not for HTML (see here for supported tags if interested), or for RTF.
Off the top of my head, you would need two separate textboxes to achieve this effect, with the "st" text at a higher Y-position than the "1" to get "1st".

Crystal Reports Formula to parse RTFtext based on font format ie Bold and Italic

I have a column of RTF data that looks like the following:
The terms or definitions to be used in this document are:
Daily Operator. Used when the user is.......etc..
Using crystal reports I would like to grab just the BOLD text using a formula or equivalent.
I keep getting the RTF markup instead of standard text. Here is an example that I used to grab first 10 characters.
DIM convertedText as String
convertedText = cstr({table.DefinitionRTF})
FORMULA = MID(convertedText, 1, 10).
Looking ahead a bit more, how would one determine where the bold or italic Starts. Can you check for crBOLD and return the characters index position?
Thanking all in advance.
No, Crystal does not have the built-in commands to parse RTF objects by font properties. The purpose of Crystal Reports is to present formatted reports (and it more or less does this job very well). Sorry, but it's definitely not made to be a RTF parser.
I recommend doing this with some other tool, for example, a VBA script in MS Access that imports the RTF and parses it using the MS Word API. Probably wouldn't be that difficult.

Best way to represent format for presentation of cells in a grid?

I am building a dynamic reporting feature for a client. They want to create new stored procedures, and have them correspond to new reports. We are using T-SQL and each cell in a grid/report can have its own formatting and/or functionality.
I'm looking for a format specification to identify presentation, color and conditionals for data... for instance, I am thinking of something like this:
{data}|{format}
123.56|$#,##0.00
Results in ... $123.56
I am looking for standard ways to represent the formatting field, with the potential for colors and conditionals. Is there some standard out there already?
It all depends on what you're looking for. You have to ask yourself what types of formatting you wish to apply. Here's some cases you might want to consider:
In-line formatting
Do you want to have a cell that contains mixed formatting (e.g. "1234.567" shows bold, regular and italic in a single cell)?
Multi-column based output
Do you want to output a value in a cell that's based on multiple cells?
Cell1="1234"
Cell2="56"
Cell3={Cell1}.{Cell2}
---> which would output "1234.56"
If don't need either of those things, then all you want to do is provide a single format for the entire cell. Let's divide it into the two formatting elements: transformations and visual effects:
Formatting "1234.5678" into "1234.56" is a transformation. It has to be done by code that knows how to interpret the value as a number, and how to turn that number into the textual string of digit-characters.
Making a cell blue, or the text red, or bold - these are all visual transformations that are merely a set of attributes regarding the display of data in a cell. We don't care here about the type of data in the cell, since we just have to put pixels on a screen.
So, to bottom-line this: it's all about what you want to happen. If you're producing HTML reports, then HTML & CSS are very convenient methods for describing the visual-effects formatting of the cell, since you won't have to convert it twice.
As far as I know, there's only a couple of standards for encoding visual-effects display, and they are similar to SGML - TeX, HTML, PostScript, etc; they all have "tags" (sometimes with "attributes") to modify the display of the content within the tag.
Which leaves us the transformational formatting. There were two common approaches to this. The first is procedural. You list a set of transformations you wish to do on the data to turn it into text. Nowadays, we often use substitution masks, like in your example, $#,##0.00, or like in sprintf's %.2f, etc.
Again, just choose a formatting specifier that is the simplest to use in your environment. If you're coding in a language that accepts a certain format, then use it!