Question

I am using DynamicJasper to generate reports from some tables at run time. I have some fields that the data has been styled using basic html tags as the data was created. Very basic tags like bold and italic, and jasper reports can handle them by setting the markup attribute of the textElement to html. The problem is a can not find a way to change it using DynamicJasper.

I have tried using addFieldProperty("markup", "html") found in ColumnBuilder, but that adds markup as a property to the field markup (probably obvious that it should do that based on the name) instead of the text elemennt.

How to you change the markup value for a text element using DynamicJasper?

Was it helpful?

Solution

The DynamicJasper API does not contain methods to set markup.

But you can use JasperReports API for this needs. For example, the JRBasePrintText class and JRCommonText interface have method for setting markup:

public void setMarkup(java.lang.String markup)

The JRCommonText interface has constant fields:

public static final String MARKUP_NONE = "none";
public static final String MARKUP_STYLED_TEXT = "styled";
public static final String MARKUP_HTML = "html";
public static final String MARKUP_RTF = "rtf";

You can modify DynamicJasper classes for your needs like in this post, for example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top