Jasper report generating bad HTML
If I view the HTML generated by one of my Jasper reports in IE7 I see the following:
<BR /><BR />
<A name="JR_PAGE_ANCHOR_0_1">
<TABLE style="WIDTH: 1000px" cellSpacing="0" cellPadding="0" bgColor="#ffffff" border="0">
<-- table body omitted -->
</TABLE>
The two BR tags are added via the JRHtmlExporterParameter.HTML_HEADER parameter. After these tags and before the beginning of the report table that there's an unclosed anchor tag that is generated by Jasper reports. The fact that this tag is not correctly closed is messing up the formatting of my report because IE is hyperlinking the entire report TABLE. I'm not using this anchor tag, so if I could prevent Jasper from generating it, that would solve my problem.
Incidentally, this problem only occurs in IE, in Firefox everything works fine because the anchor tag is properly closed.
Thanks in advance, Don
Asked by: Chelsea809 | Posted: 21-01-2022
Answer 1
I took Phil's advice and dove into the Jasper source code. I've fixed the problem and submitted it to the project. Details of the cause and resolution are available here.
Answered by: Lyndon959 | Posted: 22-02-2022Answer 2
That's odd code, the <br />
tags are XHTML-style, while the unclosed a
tags are good old HTML, like the upper case tag names. If you serve such page with plain HTML header/content-type, perhaps IE will be happy.
When you write that Firefox closes the tag, I suppose you mean it correctly doesn't extend the hyperlink span over block tags. Note that FF's view source can display closing tags that are not there when you save the page to disk!
Frankly, I don't know if you can get rid of these anchors with some config. If nobody comes with a real solution, maybe you can download Jasper's source code and search JR_PAGE_ANCHOR in it, looking if the code generating it is conditionally driven.
Or, if you can, you can apply post-processing of the generated code.
Answered by: Blake229 | Posted: 22-02-2022Answer 3
In excel export A1 cell transfor to JR_PAGE_ANCHOR_0_1.Some of tips are setting IS_ONE_PAGE_PER_SHEET property doing true, IS_DETECT_CELL_TYPE doing true but these are not working for me. To avoid from this situation , configure your xlsx report configuration is worked for me (set ignore anchor is key point);
private final SimpleXlsxReportConfiguration xlsxReportConfiguration;
JRAbstractExporter exporter;
this.xlsxReportConfiguration = new SimpleXlsxReportConfiguration();
...
xlsxReportConfiguration.setIgnoreAnchors(true);
...
exporter = new JRXlsxExporter();
exporter.setConfiguration(xlsxReportConfiguration);
Answered by: Lenny820 | Posted: 22-02-2022
Similar questions
set - Generating partitions in Java
I am given an integer (lets call it x) and I need to generate an array of arrays, where each subarray is a list of elements which are one of a given set of integers, and the sum of all of the elements of each subarray is x. The array of arrays needs to contain all possible distinct subarrays of this form.
For example, if x is 3 and the list of possible elements is {1, 2}, I'm looking to generate {{1, 2}, {2, 1}}.
java - Generating code stub from class and javadoc
Is anyone familiar with a tool that generates code stubs with meaningful names from class and javadoc?
The real question should've been "I have classes without debug information and a matching javadoc, but my IntelliJ IDEA 8.0.1 (please, no IDE wars) doesn't take into account the javadoc and shows me "void setLocation(Object object, String str1, int i1, int i2);" instead of "void setLocation(Object compone...
java - Generating absolute URLs from Seam emails
Is there a way to coax either the h:outputLink or s:link tags into generating absolute URLs? In a Seam email message, I want to be able to do something like
<s:link view="/someView.xhtml">
<f:param name="a" value="#{a.nastyParam}" />
<f:param name="b" value="#{b.nastyParam}" />
<h:outputText value="Come do something awesome!" />
</s:link>
...
Generating an image with data fields using Java
How would you generate an JPG image file containing data fields that are stored and updated within a database table? The image would then be regenerated every hour or so reflecting the latest values within the database table.
You would start with a basic background image, and then the generated image should contain data fields (e.g. average temperature, cpu load, time since last reboot etc.) overlayed on top of t...
java - Generating a Maven POM from an existing project?
Do any of the IDEs (or any other tool for that matter) have the ability to generate a POM based on an existing project?
I ended up generating the POM with a Maven archetype as Peter and Sal suggested and then moving the existing source in. Thanks for the help guys.
java - Generating JUnit Testcases
Our application depends on numerous resources that are provided by another system.
To ensure the existence of those resources, we currently have a JUnit test case (probably more an integration test), that takes a list of all the resources as a textfile, fetches each and tracks success/failure.
This is a very long running testCase that is not very "tool friendly". What we would really like to have is somethi...
Generating and Displaying PDF file in Flex/Java
We have Flex on the front end and Java on the back end. When a user will request for a PDF file, request will go to the Java backend, where a PDF file will be generated using Jasper Reports. What we dont know is how to display this PDF file in browser; since we dont want to use JSP/Servlets etc - It has to be flex only. Any suggestions?
java - Common algorithm for generating a diff of the fields in two beans?
Let's say you have two instances of the same bean type, and you'd like to display a summary of what has changed between the two instances - for example, you have a bean representing a user's settings in your application, and you'd like to be able to display a list of what has changed in the new settings the user is submitting (instance #1) versus what is stored already for the user (instance #2).
Is there a commonl...
java - Generating client code with wsdl2js?
I am trying to use wsdl2js to generate the client-side handler of a SOAP request for a WSDL file but running into a few problems. If I use:
>wsdl2js -p [projectName] [wsdlFile]
it only generates a javascript file, which isn't what I need.
If I use
wsdl2js -client [wsdlFile]
like they demonstrate, I get an "Unexpected option: -client"...
java - Generating a Faces Context manually
I have two systems I'm trying to integrate. One is built on raw servlets, the new one is build on JSF with IceFaces. I'm trying to facilitate cross-system sign on. The idea is that I have a button in the old system that POSTs the appropriate information to the new site and logs them on.
Well, ideally, I'd like to use just a regular old servlet to facilitate that on the new site. Go to the new site's Servlet, do wh...
Still can't find your answer? Check out these amazing Java communities for help...
Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)