Jump to content
We've recently updated our Privacy Statement, available here ×

hovendal

Members
  • Posts

    20
  • Joined

  • Last visited

hovendal's Achievements

Explorer

Explorer (4/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. Hi all, How can I create reports with text direction RTL (like it is possible in HTML)? I have a set of fully functional reports, which all support unicode texts, and I now have the need for "flipping" the reports, so that RTL-languages are displayed correctly from right to left. It seems the only solution i can find is to mirror the entire reports (that is, creating new ones with different floating properties, new placement values etc...) which I would like to avoid, since we are talking of many many large reports. I am using spring together with jasper and I am using xmlviewports definitions returning a modelandview from spring with data in specified data source - eg.: Controller: Code: View definition: Code: In html you can simply put DIR="RTL" - can I do something similar in jasper? Thanks! Post Edited by hovendal at 10/25/2011 09:19
  2. Dear all, I have run into a problem, which I cant seem to figure out. We have a running application, with a lot of reports, which are all working fine. We are using spring and XmlViewResolver to catch report views as pdf, xml etc, and just returning a modeandview. This all works like a charm, However, a request for the ability to store a compiled pdf report as binary data in a database has seen the light. Therefore, we added support for this by instead of returning a view, we compiled the report with JasperPrint. Se code below for specific details. However, the generated print is without localizations. All ressource bundle fields, like: <![CDATA[$P{REPORT_RESOURCE_BUNDLE}.getString("insta.report.profiles.title")]]> returns null. How can this be, and what are we doing wrong? As said many times, if were are returning a view istead, this works just fine. Hope somebody is able to help. Code:// Setup model adn JRBeanCollectionDatasourceMap<Object, Object> model = new HashMap<Object, Object>(0);List<ProfilesBean> datasource = new ArrayList<ProfilesBean>(0);datasource.add(profilesBean);model.put("data", datasource);model.put("format", "pdf");JRBeanCollectionDataSource source = new JRBeanCollectionDataSource(datasource);// Compile reportJasperPrint jp = JasperFillManager.fillReport("C:/reports/profilesReport.jasper", model, source);// Create binary file and saveBinaryFile file = new BinaryFile(JasperExportManager.exportReportToPdf(jp));this.fileService.saveBinaryFile(file);
  3. You cant use fields/variables for setting fg/bg colors on elements... If you dont want to use styled text, my best solution so far, is to create a 1x1 buffered java awt image, and set this as an available field. You can then use this image along with fill-frame to set a nice bg color defined at runtime... E.g: <image scaleImage="FillFrame"> <reportElement x="0" y="0" width="71" height="15"/> <imageExpression class="java.awt.Image"><![CDATA[$F{image}]]></imageExpression> </image> Hope this helps...
  4. Dear JasperReport gurus. I have a quite common report, with a title and column header, and a quite big detail band and smaller one following it. The report produces two very different pages and the following is therefore only relevant for the first page. The first detail section contains a number of subreports, which can be of 0 or more lines, and therefore the detail section is of variable height. What I would like to do, is to add some "vertical space" between two detail bands, or fix the position of one the lower band, to always be fixed at the bottom of the page, and when a lot of lines are added to above detail band, it should not move down to next page. Making the first detail band so high that it pushes the second to where it should be gives me the preferred "design", but when adding lines to on the subreports it "pushes" the lower limit downwards, so the next detail band is pushed to the next page...This is even though, there is space left "in the bottom" of the first detail section. A columnfooter sounds like a solution to this, but it needs only to appear on page one - so it does not suffice... It is quite difficult to explain, but I hope you understand my problem... I have attached an image, to hopefully clarify what I mean... Thanks! BR Hovendal
  5. Hi all, I have a question regarding how to fix a layout problem, where som of my elements are pushed "down", even thoug my band is not filled completely. In the attached file reportexample.pdf i have shown a simple layout with two bands inside a detail section. The first band (1) is of height 500px, even thoug this might not be used - maybe only 200 or 300 pixels are used. The "bigger" height of this band is set because the next band should be located at the bottom of the page... My problem occurs when more lines are added to (1). Even thoug it is not exceeding 500 pixels, it pushes my band (2) downwards. Everything inside the big band uses positiontype=float since lines can be added both before and after some content. And it works fine, everything is "placed" where it should be... But it seems as if the "empty" space between (1) and (2) is magically preserved instead of getting smaller and smaller with more lines added to (1). How should one solve this? It is a VERY (~1500 lines) large report, so I dont prefer pasting it all here :) I have scetched the outlines in code however... BR! Code:<detail> <band height=500> <some static content....> <subreport of variable lines....> <some static content, with positiontype=float> <subreport of variable lines....> <some static content, with positiontype=float> </band> <band height=xx> </band></detail>If more than one line is printed from of each of the subreport, the second band is pushed down....
  6. Yes, I am in fact "counting" the pixels... Using a tool thoug, but still... I am thinking that it might has something to do with how many pixels per inch, but what to do then... I just need to know what width my image needs to have to correspond to my column width... Files attached.. 1 pdf with image with width 497 = column width in report 1 pdf with image with width 761 = measured width of column Both pdf's include a blue bar with the supposed column width of 497 pixels... Report code included as well... Code:<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RoomListOneFreq" pageWidth="595" pageHeight="842" columnWidth="497" leftMargin="70" rightMargin="28" topMargin="28" bottomMargin="28"> <!-- Imports --> <import value="net.sf.jasperreports.engine.*"/> <import value="java.util.Set"/> <import value="net.sf.jasperreports.engine.data.*"/> <!-- Title band --> <title> <band height="30"> <image > <reportElement x="0" y="0" width="497" height="30"/> <imageExpression class="java.lang.String"><![CDATA["reportlogo.jpg"]]></imageExpression> </image> </band> </title> <!-- Page header band --> <pageHeader> <band height="17" splitType="Stretch"> <rectangle> <reportElement x="0" y="0" width="497" height="15" backcolor="#002D56" forecolor="#002D56"/> </rectangle> </band> </pageHeader></jasperReport>
  7. Actually, I can see now, that it is not only the image that is wrong -. the PDF file is not at all following my width specifications. For instance: I have a colounm header with width 497, which in pdf is 721 px wide - viewed in 100% mode in my reader. My image is in the pdf actually smaller - only width 457. I am pretty confused by now, can someone please explain what and how the widths I specify in my JRXML is interpreted?!
  8. Hi All, I have searched the forum and found an earlier post with approximately this question - with no replies :( I have a jasper report with a pixel width of 497. So I have designed a nice image to be in the title band, with width 497, and a height of 50 px. Unfortunately the image is not as wide as it should be, when I generate the pdf. It is in fact ALOT smaller... If i try to use "scaleImage" it scales it allright, but ofcourse, it is then very grainy - and it streches both width and height... I read the image with: <imageExpression class="java.io.InputStream"><![CDATA[getClass().getResourceAsStream("/reportlogo.jpg")]]> Could this have any impact? What do you guys do, when you need an image, that fits the entire width of the page. Please help! :)
  9. Hi all, I am wondering if it is possible to "include" a report in a report - it might sound weird, but my thougt is, that by using subreport to include a report, that will only be printed once i would be able to do that. Since the report itself doesnt need a datasource to iterate over, I havent specified one - normally I would use a JRBeanCollectionDataSource. Insted I am supplying it with a java object throug a parameter, which contains all the data needed in this "subreport". Everything compiles fine and I can open the report as well, but where I suspect the "subreport" to be, there is nothing. I have tried som different approaches by now, but without luck. So this made me, if this is at all possible? Maybe by supplying a dummy datasource with one "item" in it, but this just sounds a bit stupid... Hope to hear from you soon! See code below Code:<!-- Keyfigures table --><band height="110"> <subreport> <reportElement key="keyfigures" x="0" y="50" width="497" height="60" positionType="Float"/> <subreportParameter name="REPORT_RESOURCE_BUNDLE"> <subreportParameterExpression><![CDATA[$P{REPORT_RESOURCE_BUNDLE}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="numberFormat"> <subreportParameterExpression><![CDATA[$F{numberFormat}]]></subreportParameterExpression> </subreportParameter> <subreportParameter name="calcsheet"> <subreportParameterExpression><![CDATA[$F{calcSheet}]]></subreportParameterExpression> </subreportParameter> <subreportExpression class="java.lang.String"><![CDATA["keyfiguretable.jasper"]]></subreportExpression> </subreport> </band>
  10. Why have I not seen isRemoveLineWhenBlank="true" :)
  11. Hi All, I am designing a report which consist of a master report with 3 nested subreports: Master Buildings Floors Rooms So for each building every floor is printed, and for each floor every room is printed. At the end of each subreport there is a summary summing up the total area of the rooms. So in the rooms subreport there is a summary for the current floor. In floors subreport there is a summary for the current building, and in the building subreport theres is a summary of everything. If for instance there is only one building, there is no need to print the "Bulding total" summary - since this will be the same as the "Total summary". Which is why this element has a printWhenExpression to only be printed when the number of buildings > 1. My problem occurs when this is true, and the "building summary" is not printed. Even though it is not printed it takes up space so the "total summary" is moved that space down the page. Can this be avoided in anyway and how? Thank you for all for helping! BR Hovendal Post Edited by hovendal at 08/11/2009 13:34
  12. Hi all, I have a dummy group which includes a subreport - each element of height 15 + a summary of height 25. I need my group to start a new page when there is room for less than 4 lines, so i set minHeightToStartNewPage=(4*15+25)=85. But if a subreport only holds <= 3 lines, a pagebreak shouldn't be issued, since 3 lines and less can fit and in the 85px margin. How can I do this? I am using a custom datasource of type java.util.set, so i can easily issue a $p{datasource}.size() to find out how many rows it contains... But I am not sure how to combine this effectivily with minHeightToStartNewPage. Thanks for any help. BR Hovendal
  13. Really, it is not possible? I have a hard time understanding why this can be done in a more flexible way....
  14. Hi all, I am working on a report in which columns can be chosen arbitrarily to be shown. I am still designing it in jrxml, but calculating the positions and sizes of the columns based on which columns to be shown, and store them in my BeanDataSource. But this proves to be a bit of a problem, since i cant use field values in e.g. x="" attributes - for instance see code below. Can this be done in anyway, or must a static integer be provided? That seems kinda weird if variables cant be used here since it would be obvius to use them to dynamically set widths and positions... I hope someone can help! Best regards Hovendal Code: <textField> <reportElement x="<![CDATA[$F{posM2}]]>" y="6" width="50" height="21" forecolor="#FFFFFF" > <printWhenExpression><![CDATA[$F{showM2}]]></printWhenExpression> </reportElement> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$P{REPORT_RESOURCE_BUNDLE}.getString("report.roomlist.m2")]]></textFieldExpression> </textField>
  15. Found the problem, so nvm! Thanks for your help anyway :)
×
×
  • Create New...