Positioning elements in jasper Reports

Hai all
I am using jasper report.Is there any way to position an element dynamically or passing the x and y position of an object at runtime as parameter.
My next doubt is what is the 1cm equivalent in jasper report.I am using ireport as tool.I want to position a column exactly 1cm form the left margin.
Help Pls
Thanks(have a nice day)
Aniesh U.K

Hi,
You have several options, but I think the simple one is to use a Border Layout. You could have a panel, that contains your two panels and the scrollPane, and add the elements.
mainPanel.setPreferredSize(...);
mainPanel.setLayout(new BorderLayout());
mainPanel.add(topPanel, BorderLayout.NORTH);
mainPanel.add(scrollPane, BorderLayout.CENTER);
mainPanel.add(bottomPanel, BorderLayout.SOUTH);
Using this, when you maximixe the window, the panels will maintain their relative positions and the scroll pane will extend itself to occupy the all the available space. It is important to set the Preferred Size of the panels.
If this is not what you want, tell me and I can give you other solutions...

Similar Messages

  • How to set the backcolor of an element in jasper report dynamically

    Hi,
    I've just start using jasper report for my project. I have a problem that : my report will show some records get from database, I want some data field on report must have "red" backcolor according to its value, for example : if a text value is 3 its back color is red, and others value its backcolor is transparent. I don't know if there are some way to control jasper report script as I use java code in html file.
    Please help me, thanks,
    Dat.

    Hi,
    I had the same problem. There are two ways (as far as I know) to solve it.
    - if you only want to highlight some fields you can create a rectangle with your color and set the printWhenExpression
    - if you want to set the color from your DataSource, you can use styled text. Just select styled text from the font panel and use the <style> element in the textFieldExpression like:
    "<style backcolor=\"" + $F{COLOR} + "</style>" Hope this helps

  • How to generate jasper report in pdf format using swing

    hi all,
    im new to swing and jasper.. can anybody provide me some example on how to generate the jasper report in pdf format? i will call the reportManager from sessionBean.. below is my code:
    1)delegate:
    public GenerateReportDto generateIntoPdfReport(String fileName, String outputFileName, Map parameters){
    GenerateReportDto generateReportDto = getAuditTrailServiceRemote().generateIntoPdfReport(fileName, outputFileName, parameters);
    return generateReportDto;
    2)sessionBean:
    public GenerateReportDto generateIntoPdfReport(String fileName, String outputFileName, Map parameters){
    //Map parameters = new HashMap();
    ReportManager reportManager = new ReportManager();
    3)ReportManager()
    public void generateIntoPdfReport(String fileName, String outputFileName, Map parameters) {
              Connection conn = null;
              try {
                   conn = dataSource.getConnection();
                   //Generate the report to bytes
                   File reportFile = new File(fileName);               
                   byte[] bytes =
                        JasperRunManager.runReportToPdf(
                             reportFile.getPath(),
                             parameters,
                             conn
              //conn.close();
              //Write the bytes to a file
              ByteBuffer buf = ByteBuffer.wrap(bytes);
              File file = new File(outputFileName);
              // (if the file exists)
              boolean append = false;
              // Create a writable file channel
              FileChannel wChannel = new FileOutputStream(file, append).getChannel();
              // Write the ByteBuffer contents; the bytes between the ByteBuffer's
              // position and the limit is written to the file
              wChannel.write(buf);
              // Close the file
              wChannel.close();
              } finally {
                   if (conn != null) {
    conn.close();
    Any help would be highly appreciated. Thanks in advance

    Hi ,
    One 'simple' way is by using the DBMS_SCHEDULER db package and the procedure CREATE_JOB(....) using as job_type the value 'EXECUTABLE'...
    Read for further info in 'PL/SQL Packages and Types Reference'.
    If you have access to OEM ... you can configure this there using wizard.....
    Other way is to use the External Procedure call capabiblity of Oracle DB Server...:
    http://www.oracle.com/pls/db102/ranked?word=external+procedure+call&remark=federated_search
    My greetings,
    Sim

  • Session in Jasper Report

    Hi All,
    I'm currently using Jasper Reports for report generation. I'm currently facing problem in retrieving session objects while generating the report.
    I'm trying to Print a report by exporting it to pdf format. In the jrxml, i include a Sub report which creates a graph. Now in the class which extends the JRDefaultScriptlet when I try to get the session object, it is returning null. Hence I cannot retrieve my session objects to be used while generating report.
    Please reply on how do I proceed with it.

    <textField hyperlinkType="LocalAnchor">
    <reportElement x="0" y="30" width="555" height="30"/>
    <textFieldExpression>
    <![CDATA["Go to summary section."]]>
    </textFieldExpression>
    <hyperlinkAnchorExpression>
    <![CDATA["summary_section"]]>
    </hyperlinkAnchorExpression>
    </textField>where hyperlinkType could be:
    - Reference (Hyperlink points to an external resource) = <hyperlinkReferenceExpression>
    - RemoteAnchor (Hyperlink points to an anchor in an external resource) = <hyperlinkAnchorExpression>
    - RemotePage (Hyperlink points to a page in an external resource)=<hyperlinkPageExpression>
    - LocalAnchor (Hyperlink points to an anchor in the report, defined by the <anchorNameExpression> element.)=<hyperlinkAnchorExpression>
    - LocalPage (Hyperlink points to a page in the current report.)=<hyperlinkPageExpression>
    - None (Used to indicate that the element containing the hyperlinkType attribute is not an anchor (this is
    the default) )
    hth

  • Jnlp with jasper report

    hi ia have one java Frame in which i enter the no.and according to number it ghenereate report from data base.using jasper report
    i have one test.jar and one test.jrxml file for jasper report
    how can i start jasper report with jnlp

    hi ia have one java Frame in which i enter the no.and
    according to number it ghenereate report from data
    base.using jasper reportEither Jasper reports will need to be 'installed',
    or it will need to have its classes on the application's
    runtime classpath. The last one is probably the
    better strategy, but the first is also possible, using
    a (web start) installer (element).
    Can you run this from the command line?
    If so, what exact command do you use to run it?
    i have one test.jar and one test.jrxml file How does the code load the .jrxml file?
    A File("test.jrxml") approach would be a
    problem for web start.
    The best way is to put it also on the application's
    classpath (probably by putting it in a Jar it and
    adding the jar to the classpath), then use getResource()
    to get an URL pointing to it.
    ..for
    jasper report
    how can i start jasper report with jnlpThen there is the question of whether the DB
    and JNLP will be coming from the same server,
    which means the code can be sandboxed, or
    whether it requires code signing and extended
    permissions.
    What does the frame do with the report once it
    is generated? Is it written to disk, or printed?
    This question breaks down to many parts.
    Message was edited by:
    AndrewThompson64

  • Open Jasper Report in new page using servlet

    Guys,
    Looks very simple but i am having problem making this process work. I am using 11.1.1.4
    This is my use case:
    - From a employee page, user clicks on a menu item to open report for current employee. I need to pass appropriate report parameters to servlet and open report into new page.
    I can successfully call servlet using commandmenuitem and set request parameters and call servlet from backing bean.... but that doesn't open report in a new page.... any way i can do this?
    Another option i tried was that using gomenuitem and setting target=blank but in that case i need to pass the parameter using servlet url which i like to avoid.(in case i need to pass many parameters in future) (also values will be set on page so i need to generate url when then click the menuitem...... so there are some hoops and loops i need to go through) I don't know a way to pass the request parameter using backing bean to servlet... i don't think it is possible.
    Those are the two approaches i tried.
    If you have any better approach...I would appreciate if you can let me know. (i have searched on internet for two days now.... for the solution)
    -R
    Edited by: polo on Dec 13, 2011 7:22 AM

    Hi,
    Hope following will useful
    http://sameh-nassar.blogspot.com/2009/10/using-jasper-reports-with-jdeveloper.html
    http://www.gebs.ro/blog/oracle/jasper-reports-in-adf/

  • Jasper report on HTML when one image loaded from database and for the other

    How to generate jasper report on HTML when one image loaded from database and for the other we give a image path
    My code
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
              exporter = new JRHtmlExporter();
              exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
              exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);
              exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, strImageInputDirectory);
         exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME, strImageOutputPath == null ? "." : strImageOutputPath);
         exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR, Boolean.TRUE);
         exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);
         exporter.setParameter(JRHtmlExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
              exporter.exportReport();
              byte[] bdata = ((ByteArrayOutputStream) baos).toByteArray();
    Can any one help pls
    Message was edited by:
    ameet.au

    hey sorry for posting it in this forum.
    but do u have sample code for making it work.. since i am able to do it on PDF format(image from Database and another stored in the webserver) using
    byte image[] =(byte[]) outData.get("image");
                        ByteArrayInputStream img = new ByteArrayInputStream(image);
                        hmimg.put("P_PARAMV3", img);
    print = JasperFillManager.fillReport(reportFileName, hmimg, jrxmlds);
    bdata= JasperExportManager.exportReportToPdf(print);

  • Jasper report with Struts2 and hibernate.

    Hey all!
    I'm new to Struts2, Hibernate and jasper report. I want to make a report using those tools. Can anybody pls help me by providing a step by step process for it?
    I'm using eclipse Ganymede IDE. And want to view report on page with two search criteria as start date to end date and an option choosing.
    Can any body pls response me for this?

    Yes you can, you'll need to create a new library in JDeveloper with the Jasper reports JARs.
    See: Re: JasperReport with Jdeveloper

  • Jasper Reports in Linux vs Jasper Reports in Windows

    Dear Sirs...
    an application is developed using jdeveloper 10.1.2 (struts with UIX technology) and used Jasper report to generated PDF and HTML reports programmatically (no XML files for reports tamplates are used).
    in jdeveloper PDF reports are generated without problem,
    i create a WAR file and deploy it to oracle application server R2 under windows, it works just fine.
    that same WAR file is deployed into linux (again oracle application server R2), this time an exception occurs,
    i only selected two jar files (jasperreports.jar and itext.jar) to be included into the war file.
    now can any one explain to me why it runs perfectly fine in windows AS and not linux AS???? aren't both of them use the same java virtual machine????
    any advice please???
    best regards

    sorry i forget to post the error in linux, the log contains the following:
    net.sf.jasperreports.engine.JRException: Error
    compiling report java source files :
    /home/oracle/OraHome/j2ee/home/EasyJasperDesign_1192848437309_635467.java
    best regards

  • Jasper report in Jdev adf

    dear all,
    i'm now trying to integrate jasper report in ADF..
    and i'm try to code this code at bean..but its error..
    public void runOracleReport(ActionEvent actionEvent) {
    JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(PopulateBean.createBeanCollection());
    Map parameters = new HashMap();
    parameters.put("branchval", getBranchId());
    try
    InputStream input = new FileInputStream(new File("C:\\Users\\user\\.ireport\\4.7.0\\config\\Templates\\Report\\GenerateOfferLetter.jrxml"));
    OutputStream os = new FileOutputStream(new File("C:\\Users\\user\\Desktop\\ICEMS\\Report\\offerLetter.pdf"));
    JasperDesign jasperDesign = JRXmlLoader.load(input);
    JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
    JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, conn);
    JasperExportManager.exportReportToPdfStream(jasperPrint, os);
    JasperViewer.viewReport(jasperPrint, false);
    catch (JRException e) {e.printStackTrace();}
    catch (Exception e) {e.printStackTrace();}
    is it any connection code that i have to write..
    Thank you

    thank you very2 much..it helps me al lot..
    2 questions taht i confused:
    1: Is it query at adf must be same at query jasper?
    2: Is it this code is valid code when i want to call more than parameters:
    Map parameters = new HashMap();
    parameters.put("branchval", getBranchId());
    parameters.put("degreeVal", getDegreeId());
    parameters.put("intakeVal", getIntakeId());
    parameters.put("typeOfferVal", getTypeOfferId());
    parameters.put("jasperParamenterName", "ParameterValue"); Used if you want to pass a parameter to a jasper report
    JasperPrint print = JasperFillManager.fillReport(report, parameters, conn);
    Thank you

  • Jasper report

    i have table name student in my MS access data base. student have column name class,section, rollno,studdof... etc . Class Field contains data I ,II,III Std. etc similar to section contains A,B,C etc i want to generate a jasper report by selecting particular class,section eg. i am selecting class I and section B using combobox my problem is that how to pass this condition in java pro to generate jasper report for particulas class and section
    Edited by: faizan on Jun 9, 2008 11:53 PM

    Those extra pieces are from my program and there just to show where I was getting the variables to pass to the map.
    You can replace them with your our variables you need for your reports.

  • Jasper report s

    Hi can someone plz tell me integration of ireport with Myeclipse
    or how can i use jasper report as i want reports to hav output in pdf and html and i'm using spring/hibernate as persistence .
    thanks in advance.

    Hi Shariff,
    have you already googled for "apex integrate jasper"? It returns several how-to's.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • How to open Jasper report in New window (new Browser,new Tab)

    Hi,
    I'm Using oracle jdeveloper 11.1.1.4.0 fusion middleware for Jasper report. i want to open the Jasper report in new window
    In Application On click of CommandMenuItem(ExportToHTML)it opens the New Window,.While opnening this window i want to call a method (This method opens the jasper report in current browser)
    I Tried the afterPhase and beforePhase for this but doesnt work for me.while executing this using beforePhase I'm getting following Exception :
    Pls Help on this.Thanks in Advance......!!
    Java.lang.IllegalStateException: strict servlet API: cannot call getOutputStream() after getWriter()
    at weblogic.servlet.internal.ServletResponseImpl.getOutputStream(ServletResponseImpl.java:280)
    at javax.servlet.ServletResponseWrapper.getOutputStream(ServletResponseWrapper.java:112)
    at ReportsDisplayBean.exportHtmlReport(ReportsDisplayBean.java:272)Is any other way to do this ? :(
    Thanks.

    Hi,
    The view itself is a Web Part called an XSLT List View Web Part (XLV for short). This Web Part is stored on an ASPX page that is by default associated with a list or library on your site.
    I suggest you can check if the view page is valid, also, you can try to create another view, then redirect to the view page to see if there is xslt in the page.
    Here are some detailed articels for your reference:
    Create a custom list view using SharePoint Designer
    Using SharePoint Designer 2010 to Work with Web Parts
    How to: Customize the Rendering of a Field on a List View
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • Error in Jasper Report Generation

    Hi,
    I generated Jasper Report.
    Jar File Used:
    1)classes12
    2)commons-beanutils-1.5
    3)commons-collections-2.1
    4)commons-digester-1.7
    5)commons-logging-1.0.2
    6)jasperreports-1.2.1
    7)org.eclipse.jdt.core.manipulation_1.0.0.v20060605-1400
    8)org.eclipse.jdt.core_3.2.0.v_671
    Jdk Used
    JDK 1.5
    Java File:
    import java.util.HashMap;
    import net.sf.jasperreports.engine.JREmptyDataSource;
    import net.sf.jasperreports.engine.JRException;
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperExportManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.JasperReport;
         public class LineDisplay {
         public static void main(String[] args) {
         JasperReport jasperReport;
         JasperPrint jasperPrint;
         try {
         jasperReport = JasperCompileManager.compileReport("F:\\SampleProject\\Jasperreport\\WEB-INF\\src\\com\\zylog\\Sample.jrxml");
         jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JREmptyDataSource());
         JasperExportManager.exportReportToPdfFile(jasperPrint, "c:\\firstReport.pdf");
         } catch (JRException e) {
         e.printStackTrace();
    I succesfully generated Jasper Report.But My client faced the following Exception as,
    java.io.FileNotFoundException: F:\MBSWorkspace\JasperReport\Sample_1252478220359_232342.class (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at net.sf.jasperreports.engine.util.JRLoader.loadBytes(JRLoader.java:272)
    at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:73)
    at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:190)
    at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:131)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:211)
    at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:144)
    at com.zylog.jasper.Sample.main(Sample.java:18)
    NESTED BY :My Client Used JDK 1.6..
    I dont know why he got a such problem..Help anyone to solve it..

    Deepa_05 wrote:
    What do you mean?They mean that every time something doesn't work for you, you just post it here and act all helpless, rather than try and solve it yourself. Do you not have any idea what the error might be telling you?

  • Jasper report issue report row 65535 but can't generated correctly

    Hi All ,
    We are trying to create report with jasper report . The issue is sometime generated report can be open.
    Below is test case and result .
    1.     when dummy all the returned field of procedure to ‘1’ and 20000 rows are to printed in report. The file size is 7564K. The excel can be open after several minutes waiting.
    2.     When dummy the procedure only return 5000 rows with actual data, the field type may be char, number. The file size is 2010K. The excel can be open quickly.
    3.     When dummy the procedure only return10000 rows with actual data. The file size is 3999K. The excel cannot be open.
    What the issue may be?
    Below is our code.
         * Generate the the report, currently generate excel report.
         * @param results - data set return from procedure execution
         * @param parameters - input parameters for Jasper Report design
         * @param procName - Jasper file name
         * @param outputFile - used as report file name
         * @throws JRException - Jasper exception
    private void ReportGenerator(List<ScriptParameterObject> results,HashMap<String, Object> parameters, String procName,String outputFile) throws JRException, Exception
    logger.info("Creating report: " + outputFile + ".xls");
    //URL en = ClassLoader.getSystemResource("jasper"+java.io.File.separator+procName + ".jasper");
              URL en = ClassLoader.getSystemResource(procName + ".jasper");
    if(en==null)
    throw new Exception("Can't find jasper file: " + procName + ".jasper");
    logger.debug("Loading jasper file: " + en.getPath());
    //InputStream isJasper = ClassLoader.getSystemResourceAsStream("jasper"+java.io.File.separator+procName + ".jasper");
    InputStream isJasper = ClassLoader.getSystemResourceAsStream(procName + ".jasper");
    JasperReport relatorio = (JasperReport) JRLoader.loadObject(isJasper);
              SapiData sapiData = new SapiData(results);
              logger.debug("Filling report file ..." + results.size());
    JasperPrint impressao=null;
    try{
              impressao = JasperFillManager.fillReport(relatorio,parameters, sapiData);
    catch(Exception ex){
    System.out.println(ex); ---never catch error. but not know why the .xls can't open
    if (impressao == null) {
    logger.debug("impressao == nul.");
    logger.debug("Filled report file successfully.");
              impressao.setLocaleCode(Locale.getDefault().getCountry());
              JRAbstractExporter saida = null;
              saida = new JRXlsExporter();
              saida.setParameter(JRExporterParameter.JASPER_PRINT, impressao);
              saida.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outputFile     + ".xls");
              saida.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,Boolean.FALSE);
              saida.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.TRUE);
              saida.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);
              saida.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN,Boolean.TRUE);
              saida.setParameter(JRXlsExporterParameter.MAXIMUM_ROWS_PER_SHEET, Integer.decode("5000"));
    logger.debug("Exporting excel report file ...");
              saida.exportReport();
              logger.debug("Generated excel report file successfully: "+outputFile + ".xls");
              /* - used for generate html report
              JRAbstractExporter htmlExp = new JRHtmlExporter();
              htmlExp.setParameter(JRExporterParameter.JASPER_PRINT, impressao);
              htmlExp.setParameter(JRHtmlExporterParameter.OUTPUT_FILE_NAME,outputFile + ".html");
              htmlExp.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);
              htmlExp.setParameter(JRHtmlExporterParameter.IS_WRAP_BREAK_WORD,Boolean.TRUE);
              htmlExp.exportReport();
         }

    I hava the same problem.Hava you solved it?

Maybe you are looking for

  • Restauration incomplète

    J'ai un hp envy 17 notebook E4S12Uacarré ABL j'avais intallé windows 8.1 J'ai reçu de microsoft une mise a jour facultative concernant VDDM 1.1 1.2 1.3 au redémarage l'écran est devenu noir impossible d'ouvrir windows j'ai fait une réinstallation ave

  • Attempting to Display Total/Percentage in Answers when grouped by Attribute

    Hi all, I'm relatively new to BI and attempting the following setup. (I'm simplifying the model somewhat of course). I have a Fact called Job which has an attribute called Type ( along with others such as Create Date , Delivered Date , Length , Score

  • HR-ABAP(Payroll Management)

    Hi All, I am new to HR-ABAP. I wanted to know more about HR-ABAP(Payroll Management). Please send me the links or documents if u have collected. Regards, Mihira

  • Data import for users of forms created with Livecycle Designer

    Hello, I have seen several posts regarding data import for forms created by Livecycle Designer but nothing that helps with something I am trying to accomplish.  I can create a data connection and import information in a form but what I would like to

  • Custom list with special permissions

    Hi There! Is it possible to have special premissions in 1 field of a list. For example, a ¨status¨ field that can only be updated by the admin. Thanks for your help!! Ignacio