Jump to content
Changes to the Jaspersoft community edition download ×

arbitary

Members
  • Posts

    23
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by arbitary

  1. Hi, I need to craete a report in CSV format(which I ahve already done), but when the user downloads it, it should be zipped and should contain the csv file. How do I do this? I understand that the exportReport() function at the end of the method will create the file, so when excatly will I zip it. I also have a method taht will zip any file, but am not sure where it fits in. Code: JRCsvExporter exporter = new JRCsvExporter(); res.setContentType("text/plain"); ((HttpServletResponse) res).setHeader( "Content-Disposition", "inline; filename="" + ipTxtFileName+".csv" + "";" ); OutputStream out = res.getOutputStream(); exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, "|"); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, out); exporter.exportReport(); Method call to zipping - where should this go? this.doZip(ipTxtFileName+".csv", ipTxtFileName+".zip");
  2. Try increasing the height/width of the column. Sometimes in XLS/CSV reports, the data is not shown because it does not fit.
  3. The line that I have suggested will be of fixed width. Sorry, can't really think of a way to have a flexible dotted line. Will let you know if I come across something for this.
  4. From the top of my head: Draw a 'line' (is available on the top menu in iReports). In its Properties --> Graphics Element, set Pen to 'Dotted'. You have a dotted line now. Simply drag it and place it below your static text.
  5. I don't know if this will solve your problem but try and set Floating Column Footer as checked in Report Properties. You can also modify the xml file directly and add this line isFloatColumnFooter="true" in the <jasperReport> tag at the top.
  6. Look here: http://www.javalobby.org/articles/hibernatequery103/ You really should check on Google before posting questions.
  7. I am running JasperReports on JBoss. I need to hyperlink one of the report columns to an external file. The file is on a Unix machine, outside of my server/application setup. I am trying create a 'Reference' hyperlink with this expression: $P{Path}+$P{FileName}+".html" where $P{Path} = home/reports/ $P{FileName} = reportFile This resolves to: http://www.mywebsite.com/home/reports/reportFile.html but the file is not found. What am I doing wrong? Thanks.
  8. I came across this while trying to export a report as xls. One of the cells have values 1A, 1B, 1C, 1D, 1E or 1F. The column that I am printing this in, is designated as String. When the report renders, all values are shown correctly, except for 1D and 1F, which are shown only as 1. After putting debug statements in the JRXlsExporter file, I found that the flow is as follows: 1) method createTextCell --> isDetectCellType is false 2) Control goes to else part: isAutoDetectCellType which is true. Here it first parses the value as Double. 1D and 1F are accepted as double and float values and shown as 1. Others are shown as 1A, 1B, 1C. I understand that the best way is to have the control go into (1), where the cell type is detected as String/text. My question is - how is isDetectCellType set to true? If my column datatype in the layout is set to String, shouldn't this be String too??
  9. If you don't check 'isStretchWithOverflow' the value will automatically get truncated without altering the width or height. If you need to dynamically increase the width to fit the cell contents, then that is not possible.
  10. The file will get saved on the server. However, what you can do is, delete the file from the server after it opens, like I am doing. The person viewing the open file always has a choice to save it locally.
  11. After your report has been generated and saved to the machine, you need to open it for viewing. Code: res.setContentType("application/pdf"«»); BufferedInputStream in; try { in = new BufferedInputStream(new FileInputStream(opReport)); OutputStream out = res.getOutputStream(); int bt = -1; while((bt = in.read()) != -1) out.write(bt); out.flush(); out.close(); in.close(); File opReportFile = new File(opReport); opReportFile.delete(); } In the above code, opReport is the string name of the file(alongwith the path). Once the report is viewed, the PDF viewer will allow the user to save it. I delete the report once it is viewed(since the user has a copy), but you can choose to retain it.
  12. I am not sure if this could be your problem, but I had the same issue while viewing reports in iReport virtualizer on Windows .vs. via an application on Unix. Sometimes when the data is too 'tall' it simply does not show up. I increased the height of the cells that were showing up as blank and it worked fine. Try it out..might help.
  13. My report data source is a csv file, which usually has over 1 million records. Since I do not want to show that many, I have to limit the report to about 10 pages. To do this, I put a condition in 'PrintWhenExpression' for all bands - new Boolean(($V{PAGE_NUMBER}).intValue()<11) So, I want the bands to print as long as page number is less than 11. The problem is, the report shows 11 pages and the last one is blank. Can anyone please figure out what is happening? My summary band has size 0, so that is not the problem. Thanks in advance.
  14. The property that I modify is different. You select the column that should stretch, then right-click. This brings up the 'Properties' option. Click on it. There are multiple tabs at the top - go to the 'TextField' tab and check 'Stretch with overflow'. I have just 1 field in my report that has enough data to wrap and the result is pretty decent looking. It increases the row height just enough to accomodate the data.
  15. I don't think there is an option to dynamically alter the width. Infact, if your text is too long for the width, it gets truncated. What I do is set the 'Stretch with overflow' preprty to true. That way, if it is a long text, it wraps.
  16. I think I found a bug here. In JRCsvDataSource, in the function parseRow(), for the last column, if there is no data, it is not added to the Vector of fields. So, if the last column is blank or null, the program thinks that there are (actual-1) columns. I removed this check and it works fine.
  17. I am creating a report with a csv datasource(its a tab-delimited file actually). It has 4 columns, which I specify in my report definition as COLUMN_1 to COLUMN_4. In the Java code, when I call the 'fillReport' method, I get the following error - 17:57:27,144 INFO [sTDOUT] net.sf.jasperreports.engine.JRException: Unknown col umn name : COLUMN_4 This happens only when the tab delimited file does not have data in the 4th column. This is very strange, since I have data missing in columns 2 and 3 too, but it works OK. Has anyone ever come across this? Any solutions will be appreciated.
  18. I don't think the <input type=....> tags are supported for data fields. Atleast the samples don't show it. jasperreports-1.2.7demosamplesstyledtext Instead, you could use shapes around the data(a transperant rectangle maybe) and make it look like it is a textfield.
  19. Thanks for the reply, David. I tried to do this: 1) Create a parameter in the main report for the csv datasource: <parameter name="SUBREPORT_DATA_SOURCE" isForPrompting="false" class="net.sf.jasperreports.engine.data.JRCsvDataSource"> <defaultValueExpression ><![CDATA[new net.sf.jasperreports.engine.data.JRCsvDataSource(new File("sub2data.csv"))]]></defaultValueExpression> </parameter> 2) Then set this parameter in the subreport datasourceexpression: <dataSourceExpression><![CDATA[$P{SUBREPORT_DATA_SOURCE}]]></dataSourceExpression> Compile - OK Run - Same problem 'Unknown column COLUMN_1'. Am I supposed to map all fileds from this subreport to my main report too? I mean, create params in main report for all fields in subreport? This does not seem logical somehow. Also, would it be possible to do this programatically through java? How will I fill the report with 2 datasource objects?
  20. Hi, I can see many examples on jasper sites which explain how to create subreports from different queries, but none of them explain how to do it from 2 or more different csv datasources. I have a mainreport.jrxml which has 2 subreports - sub1 and sub2. sub1 uses the default datasource(a csv file), so its ds expression is: <dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression> sub2 uses a different csv file, so I have created a parameter called 'SUBREPORT_DATA_SOURCE' and set it as a datasource for sub2. It looks something like this: <dataSourceExpression><![CDATA[new <dataSourceExpression><![CDATA[$P{SUBREPORT_DATA_SOURCE}]]></dataSourceExpression> Can someone please tell me what value the 'SUBREPORT_DATA_SOURCE' parameter should have? I know it has be a 'JREmptyDataSource' type, but how can it point to my csv file(say 'sub2data.csv')? Alternately, I also tried to specify the datasourceexpression for sub2 as: <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRCsvDataSource(new File("sub2data.csv"))]]></dataSourceExpression> It compiled but gave a runtime error - Unknown column name - Column_1. Column_1 is a column in sub2. Please help!!
  21. Hi, I am generating an HTML report from Jasper that has about 500 records. If I keep the pagination on, it shows me the first page and a part of the scond page. Thats it. If I set pagination to 'off' it again shows me only records that can be accomodated in that one page. My question is: How can I make the HTML report have vertical scrollbars, so that I see all records without pagination, by simply scrolling down. I am really surprised that there is no parameter to control scrolling or maybe I have missed it. Any help will be much appreciated.
  22. Hi Jorge, I am pretty much in the same fix here. This is what I am doing: 1) Create a report, which will ultimately be my subreport, with a csv datasource as input. 2) Test it. It works fine with values displayed. 3) Create a blank main report with no connection or datasource. 4) Add a new subreport to this main file. While adding, say 'Select existing report' and point to subreport.jasper, which was created in Step 1. 5) The problem comes in the next step, when I have to choose the source from where data should be filled for the subreport. I gave new JRCsvDataSource(new File($P{SUBREPORT_DIR} + "dataFile.csv")) as the JRDataSource expression. 6) I run the report and nothing comes up. 7) Even worse, if I open my subreport from the main report (by right click on subreport object) and try to run it, it says 'no data'. That is strange because in Step 2 it did work. What am I doing wrong? I can see a lot of demos and answers out there for creating subreports from database queries but none for csv files.
  23. Hi, I am trying to do something with iReports. Please let me know if its feasible. I have a csv file, A.csv which is being used to generate a report. That works great. I have another file B.csv which has data unrelated to A.csv. I need to show both sets of data in the same report. So, I have header, detail and footer for A.csv, which has to be followed by only detail for B.csv. I want A.csv to finish printing and then for B.csv to begin. Is this possible at all? I tried adding a subreport to my master report without any parameters, but it did not work. Thanks in advance.
×
×
  • Create New...