Excel report from java

I'm generating the Excel report from java .In that i create a row,but i don't know how to increase the size of the cell.if any one have idea.kindly suggest it

I had a similar porblem and finally i guess somebody can help me with this issue
I got some help from...http://www.javaworld.com/javaworld/jw-10-2006/jw-1019-xmlexcel.html?page=1...
This is my code in servlet...
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet spreadSheet = wb.createSheet("Users");
spreadSheet.setColumnWidth((short) 0, (short) (256 * 25));
spreadSheet.setColumnWidth((short) 1, (short) (256 * 25));
// Creating Rows
HSSFRow row = spreadSheet.createRow(0);
HSSFCell cell = row.createCell((short) 1);
cell.setCellValue("Year 2005");
cell = row.createCell((short) 2);
cell.setCellValue("Year 2004");
HSSFRow row1 = spreadSheet.createRow(1);
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
cell = row1.createCell((short) 0);
cell.setCellValue("Revenue ($)");
cell = row1.createCell((short) 1);
cell.setCellValue("25656");
cell = row1.createCell((short) 2);
cell.setCellValue("15457");
FileOutputStream output = new FileOutputStream(new File("/tmp/Users.xls"));
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=Users.xls");
ServletOutputStream out = response.getOutputStream();
wb.write(output);
output.flush();
output.close();
forward = null;
In firefox i get the download dialog box but not able to open in from there,i need to save it and then open. In IE i dont get the dialog box instead the excell open inside the browser......Please help me to open a excel sheet onclick on a link "Export to excel" in jsp......Bottom line is onclick of a link in jsp it should open up a ezcell report....
Please please please help me....
Thanks in advance...

Similar Messages

  • Generating Excel report from java

    I'm generating Excel report from java .I want align a text in top ie)align top.i searched for that ,but i didn't get that.Is it possible to perform align top,if so how?

    the Progrma I' m executing is as follows :
    import java.io.*;
    import java.util.*;
    import jxl.*;
    import jxl.write.*;
    import jxl.write.Number;
    public class excel
    private String filename;
    private WritableWorkbook workbook;
    public excel(String fn)
    filename=fn;
    public void write() throws IOException, WriteException
    WorkbookSettings ws = new WorkbookSettings();
    ws.setLocale(new Locale("en", "EN"));
    workbook=Workbook.createWorkbook(new File(filename),ws);
    WritableSheet sheet=workbook.createSheet("First Sheet",0);
    Label label=new Label(0,2,"A label record");
    sheet.addCell(label);
    Number number=new Number(3,4,3.142);
    sheet.addCell(number);
    workbook.write();
    workbook.close();
    public static void main(String args[]){
         try{
                   excel ecl = new excel("D:\\TestXSL.xls");
                   ecl.write();
              }catch(Exception e){
              e.printStackTrace();
    }

  • Background color in POI (Excel report from java)

    I'm generating report in Excel from Java.how can background color is set for single cell.

    i write code like
    style.setFillBackgroundColor(HSSFCellStyle.RED);
    it shows error that can not resolve symbol variable RED.why?give me solution

  • Generating Excel report from java by using POI

    Hi
    Im trying to generate the report in Excel using POI. Im retrieving the data from the table. As per my query its having millions of records.
    For example, Im giving the sheet name as below given
    HSSFSheet sheet      = wb.createSheet("SampleReport_01");
    In a single sheet, 65000 records can be displayed. Im checking this condition also. It exceeds 65000 records, the records will be dislayed in the next sheet "SampleReport_02","SampleReport_03" and so on. Im incrementing this count 01, 02 , 03 and so on.
    While generating the report, its giving out of memory exception.
    Can anyone suggest, this is because of huge volume of data? If so, how to handle this one.
    Thanks in Advance
    Dhilip

    your workbook object is in the jvm memory. putting so much data in it while working with it will take memory allocated to jvm.
    better solution is to make a .csv file. Add the data in it with through append (check this [http://www.javacoffeebreak.com/faq/faq0086.html|http://www.javacoffeebreak.com/faq/faq0086.html] ) .
    latter import the .csv file into excel sheet manually.

  • Webutil Error when trying to run excel report from Oracle form

    I am trying to run an excel report from a oracle from but it throws me following error:
    Oracle.forms.webutil.fileTransfer.FileTransfer bean not found. WEBUTIL_FILE_TRANSFER.getmaxtransfer will not work
    Can you tell what is this error due to and how to eradicate this.

    hi
    Did you generate .plx?
    please check if you did not generate plx and if u did not create db packages please create the webutil user and create db packages.
    here is the webutil configurations.
    How to get up and running with WebUtil 1.06 included with Oracle Developer Suite 10.1.2.0.2 on a win32 platform
    Solution
    Assuming a fresh "Complete" install of Oracle Developer Suite 10.1.2.0.2,
    here are steps to get a small test form running, using WebUtil 1.06.
    Note: [OraHome] is used as an alias for your real oDS ORACLE_HOME.
    Feel free to copy this note to a text editor, and do a global find/replace on
    [OraHome] with your actual value (no trailing slash). Then it is easy to
    copy/paste actual commands to be executed from the note copy.
    1) Download http://prdownloads.sourceforge.net/jacob-project/jacob_18.zip
      and extract to a temporary staging area. Do not attempt to use 1.7 or 1.9.
    2) Copy or move jacob.jar and jacob.dll
      [JacobStage] is the folder where you extracted Jacob, and will end in ...\jacob_18
         cd [JacobStage]
         copy jacob.jar [OraHome]\forms\java\.
         copy jacob.dll [OraHome]\forms\webutil\.
      The Jacob staging area is no longer needed, and may be deleted.
    3) Sign frmwebutil.jar and jacob.jar
      Open a DOS command prompt.
      Add [OraHome]\jdk\bin to the PATH:
         set PATH=[OraHome]\jdk\bin;%PATH%
      Sign the files, and check the output for success:
         [OraHome]\forms\webutil\sign_webutil [OraHome]\forms\java\frmwebutil.jar
         [OraHome]\forms\webutil\sign_webutil [OraHome]\forms\java\jacob.jar
    4) If you already have a schema in your RDBMS which contains the WebUtil stored code,
      you may skip this step. Otherwise,
      Create a schema to hold the WebUtil stored code, and privileges needed to
      connect and create a stored package. Schema name "WEBUTIL" is recommended
      for no reason other than consistency over the user base.
      Open [OraHome]\forms\create_webutil_db.sql in a text editor, and delete or comment
      out the EXIT statement, to be able to see whether the objects were created witout
      errors.
      Start SQL*Plus as SYSTEM, and issue:
         CREATE USER webutil IDENTIFIED BY [password]
         DEFAULT TABLESPACE users
         TEMPORARY TABLESPACE temp;
         GRANT CONNECT, CREATE PROCEDURE, CREATE PUBLIC SYNONYM TO webutil;
         CONNECT webutil/[password]@[connectstring]
         @[OraHome]\forms\create_webutil_db.sql
         -- Inspect SQL*Plus output for errors, and then
         CREATE PUBLIC SYNONYM webutil_db FOR webutil.webutil_db;
      Reconnect as SYSTEM, and issue:
         grant execute on webutil_db to public;
    5) Modify [OraHome]\forms\server\default.env, and append [OraHome]\jdk\jre\lib\rt.jar
      to the CLASSPATH entry.
    6) Start the OC4J instance
    7) Start Forms Builder and connect to a schema in the RDBMS used in step (4).
      Open webutil.pll, do a "Compile ALL" (shift-Control-K), and generate to PLX (Control-T).
      It is important to generate the PLX, to avoid the FRM-40039 discussed in
      Note 303682.1
      If the PLX is not generated, the Webutil.pll library would have to be attached with
      full path information to all forms wishing to use WebUtil. This is NOT recommended.
    8) Create a new FMB.
      Open webutil.olb, and Subclass (not Copy) the Webutil object to the form.
      There is no need to Subclass the WebutilConfig object.
      Attach the Webutil.pll Library, and remove the path.
      Add an ON-LOGON trigger with the code
             NULL;
      to avoid having to connect to an RDBMS (optional).
      Create a new button on a new canvas, with the code
             show_webutil_information (TRUE);
      in a WHEN-BUTTON-PRESSED trigger.
      Compile the FMB to FMX, after doing a Compile-All (Shift-Control-K).
    9) Under Edit->Preferences->Runtime in Forms Builder, click on "Reset to Default" if
      the "Application Server URL" is empty.
      Then append "?config=webutil" at the end, so you end up with a URL of the form
          http://server:port/forms/frmservlet?config=webutil
    10) Run your form.hope this helps u.
    sarah

  • Problem when calling a report from java

    Hi all,
    i have created a report using ireport which contains arabic data.
    when i execute the report from ireport to generate a pdf file it works.
    however when i call this report from java i have an exception"
    Could not create the report Could not load the following font :
    pdfFontName : ARIAL.TTF
    pdfEncoding : Identity-H"
    the pdfFont i used it in ireport, also the pdfEncoding.
    did anyone passed with the same problem
    thanks for help

    Hello Oracle experts,
    The parameters are getting passed successfully in my report.
    But I want to know hous to use it in my query group.
    I just want the syntax.
    Thanks

  • Generating Excel Report from Outlook 2013 for the meetings attended/ accepted

    Hello Team,
    Could you please advise how do I Generate Excel Report from Outlook 2013 for the meetings I attended/ accepted. Also I do I check or figure out the time I spent attending meeting.
    Please help to answer me ASAP.
    Thank you
    Preet

    Hi Preet,
    As far as I know, no features in Office client can generate Excel workbook from Outlook. But we can implement this requirement by macros. If you want to receive more information, I suggest you post this issue on MSDN forum.
    http://social.msdn.microsoft.com/Forums/en-US/home
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share
    their knowledge or learn from your interaction with us. Thank you for your understanding.
    Best regards,
    Greta Ge
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Accessing XML Publisher Reports from Java application

    How to accesss the XDO Reports from Java application?
    I am wondering that we need to get the URL for accessing the report and call the URL with in Java program?
    Is that right? Is there any other option? Any help is greatly appreciated.

    You need to write some class based on the BI Publisher APIs taking data, template, output format, etc.
    Pehaps the following Blog of Tim Dexter shines some light on your question
    http://blogs.oracle.com/xmlpublisher/2007/02/27#a166
    Marcos

  • Call Crystal Report from java

    <p>Hi,<br /><br />Can anyone pl send me an e.g of how to call crystal reports from java ? Preferably crsytal version 10. how to instantiate a crystal report viewer? how to pass parameters? how to set the connection string?</p><p>my email is <a href="mailto:[email protected]">[email protected]</a><br /><br />Regards,</p><p>Hui Bee<br /></p>

    <p>Hi Hui Bee, </p><p>   There are a number of version 10 samples available contained in the following package:</p><p><a href="http://support.businessobjects.com/communityCS/FilesAndUpdates/cr10_jrc_samples.exe" title="JRC 10 samples">http://support.businessobjects.com/communityCS/FilesAndUpdates/cr10_jrc_samples.exe</a></p><p>However, I would strongly suggest that you take a look at using the latest version of the Java component that ships with our Crystal Reports for Eclipse product. You can download it from here:</p><p><a href="/node/450">http://diamond.businessobjects.com/node/450</a></p><p>and best of all, it&#39;s free! </p><p>Regards,<br />Sean Johnson (CR4E Product Manager) <br /><br /> <a href="http://www.eclipseplugincentral.com/Web_Links-index-req-ratelink-lid-639.html">Rate this plugin @ Eclipse Plugin Central</a>          </p>

  • Printing the datas through Crystal Report from Java

    How can I Print the datas through Crystal Report from java?

    How can I Print the datas through Crystal Report from
    java?
    What the hell are "the datas"?
    Jesus, I can understand this is a shrinking planet, Global community, and all that happy horse pucky. Typos or small grammar errors are no big deal, I make them all the time. But when I have to spend more time interpretting the question than figuring out the answer, it drives me crazy.

  • Running JSP Excel report from Forms 10g

    Perhaps this had been discussed before, though I didn't find an exact solution.
    We have a JSP report that displays data in MS Excel. Works fine if called from the url.
    The report shall be called from the form passing a parameter list with PARAMFORM=NO.
    Problem: reports runs as designed but opens up an empty Excel spreadsheet. No errors, no data..
    We are using RUN_REPORT_OBJECT with desformat=spreadsheet and paramform=no.
    We can't use just web.show_document alone since quite a few parameters need to be passed.
    I've read in one of the posts that a paper layout need to be created (in addition to web layout) to run RUN_REPORT_OBJECT. We've done that, but now it does not open EXCEL, and displays paper layout in a browser.
    So, how to call JSP (Excel) report from Forms passing parameter list without displaying the parameter form?
    Thank you

    What is the complete Application Server version you are using? Be sure you are using 10.1.2.2
    What platform and version is it installed?
    What version of Excel is installed on the client?
    Does it work if you use an RDF report?
    Try this:
    o Change DESFORMAT to DELIMITED
    o Append the following to the end of the URL created in the WEB.SHOW call:
    &mimetype=application/vnd.ms-excel
    The result should be the same as using SPREADSHEET.

  • Call report from java with deployment of java web start

    I need call report from java,the call function is:execURL ( String pURL )
    pURL is a url link to call report from report services .
    such as :http://10.20.1.43:8888/reports/rwservlet?destype=cache&desformat=PDF&report=test.rdf&user=scott/tiger@cims
    public static void execURL ( String pURL )
    String tempstr = new String();
    int posIdx = 0;
    if ( (System.getProperty("os.name").equals("Windows NT"))||
    (System.getProperty("os.name").equals("Windows 2000")) )
    posIdx = pURL.indexOf("&");
    while ( posIdx > 0 )
    tempstr = pURL.substring(0,posIdx)+"^"+pURL.substring(posIdx);
    pURL = tempstr;
    posIdx = pURL.indexOf("&",posIdx+2);
    try
    Runtime.getRuntime().exec("cmd /c start "+pURL);
    catch (Exception e1) {System.out.println(e1.getMessage()); }
    else
    try
    Runtime.getRuntime().exec("start "+pURL);
    catch (Exception e2)
    System.out.println(e2.getMessage());
    It's run with no problem with deployment of simple jar.
    But when i call report with deployment of java web start,it can not.
    I think it's java secuity problem,so i add
    Permission java.io.FilePermission "c://winnt//system32//cmd.exe", "execute";
    in java.policy file in client(windows 20000).However ,it can not too.
    Who can help me,Thanks in Advance!

    David,
    In your code, 'cmd' is invoked as Runtime.getRuntime().exec("cmd /c start "+pURL);
    but in your policy file you specify
    Permission java.io.FilePermission "c://winnt//system32//cmd.exe", "execute";
    Before creating a new process, the security manager checks for FilePermission(cmd,"execute")
    if cmd is an absolute path, otherwise it calls checkPermission with
    FilePermission("<<ALL FILES>>","execute"). Try specifying
    FilePermission("<<ALL FILES>>","execute") in your policy file.
    But, I believe using exec, may not be the right solution as it may not work on
    other platforms. Also you will have to expect the client m/c to relax security
    permission.
    Did you consider using java.net.HttpUrlConnection class instead to access the report
    service URL?
    HTH,
    Sathish.

  • Unable to open a report from Java SDK

    Hi,
    I am trying to open a report from the SDK in a java application. Here is the code :
    package com.metrixware.test;
    import com.crystaldecisions.sdk.occa.report.application.OpenReportOptions;
    import com.crystaldecisions.sdk.occa.report.application.ReportAppSession;
    import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
    import com.crystaldecisions.sdk.occa.report.lib.ReportSDKException;
    public class MyBoTest {
    @param args
         public static void main(String[] args) {
             ReportClientDocument myDoc = new ReportClientDocument();
             try {
                  ReportAppSession sess = new ReportAppSession();
                  sess.setReportAppServer("AGIRC-DEMO");
                  sess.initialize();
                  myDoc.setReportAppSession(sess);
                   myDoc.open("rassdk://D:/Document8.rep",OpenReportOptions._openAsReadOnly);
                   System.out.println("Titre du doc : "+myDoc.displayName());
              } catch (ReportSDKException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    but i always get the following error stack (ReportSDKException) on the open method of the doc :
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException: Impossible de charger le rapport.---- Error code:-2147483123 Error code name:failed
         at com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException.throwReportSDKServerException(Unknown Source)
         at com.crystaldecisions.proxy.remoteagent.s.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.if(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.do(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ClientDocument.open(Unknown Source)
         at com.metrixware.test.MyBoTest.main(MyBoTest.java:22)
    The document is at the right location on my local machine where my test is running. The RAS server is up and running on the CMS.
    Can you help me on this problem.
    Also i have another question. Can you tell me if i'll be able to read through this object the generated SQL select statement of the report.
    Thanks.
    Julien Pignatel

    try the following instead:
    ReportClientDocument myDoc = new ReportClientDocument();
    myDoc.setReportAppServer("AGIRC-DEMO");
    myDoc.open("rassdk://D:
    Document8.rpt",OpenReportOptions._openAsReadOnly);
    Also make sure that on RAS command you have added: -ipport "1566" -reportdirectory "D:/"
    Please note:
    1. Don't need to use ReportApSession class
    2. what do you use Document8.rep, you cannot open a Deski document with RAS. RAS can be used only with crystal reports.
    Hope that helps.
    Best Regards
    Aasavari

  • Best Practice for creating Excel report from SSIS.

    I have a requirement to create an Excel report on a daily basis which pulls data from SQL. I have attempted to resolve this by creating a stored procedure to save the results in SQL, a template in Excel to hold the graphs & pivot tables and an SSIS package
    to copy the data to the template.
    Problem 1: When the data turns up in Excel it is saved as text rather than numbers.
    Problem 2: When the data turns up in Excel it appends the data rather than overwriting it.
    I resolved problem 1 by having another sheet which converts the text to numbers (=int(sheet1!A1))
    I resolved problem 2 by adding some VB script to my SSIS package which clears the existing cells before copying the data
    The job runs fine, however when I schedule the job to run overnight it complains "System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID". A little googling tells me that running the client side commands in
    my vb script (workSheet1.Range("A2:F9999").Clear(), workBook.Save(), workBook.Close() etc) from a server side task is bad practice.
    So, I am left wondering how people usually get around this problem; copy a SQL table into an existing Excel file and overwrite the data, without having the numbers turn up as text. My requirements are that the report must display pivot charts with selectable
    options and be automatically updated overnight.
    Help appreciated,
    Bish.
    Office 2013 on my PC, Office 2010 on the server, Windows Server 2008R2 Enterprise, SQL Server 2008R2.

    I think that the best practice in case like this is to Link an excel file to a view or directly to a table. So you don't have to struggle with changing template, with overnight packages, etc. If the data are too much complex and the desiderate too excessive
    then I tend to create a Cube and that's it...dashboard, graph and everyone is happy. In your case if the request is not too much try to don't use SSIS but directly build a view and point directly on SQL.
    SSIS is really strong for the ETL, to run some stored procedure too heavy, to use a cut time scheduled, etcetera , etcetera, etcetera...I love it. But sometimes we need to find the easier solutions...
    I hope this post helped you

  • Reports from Java and Oracle database

    Hi
    I need to generate couple of reports from my application, with Java as front end and oracle 11.2.0.3.0.  database . Reports are  having very simple select statements, using the criteria users enter from GUI. we don't need to execute a  direct select statement from Java, with the where clauses . I did some research and found out about Pipelined functions. I tested for a small set of records and it worked fine. Will this work for large data set? any drawbacks of using this method?  Any other methods for this requirement?
    Thanks in advance
    JP

    Pipeline table functions do not sound like the appropriate approach. It is designed to primarily deal with data transformations. Using it as a rendering engine for report writing? There are fundamental problems with such an approach.
    As Dave and Andre commented - the CORRECT means for PL/SQL to pass "data" to Java (or other client languages) is via reference cursors (pointers that the client can use for referencing SQL cursor programs on the server). And Java as a report writer does not really compare with the ease and flexibility that Oracle Apex (Application Express) provides as a reporting framework.

Maybe you are looking for

  • IPhone 3G still connecting to 2.4 GHz N network. How is that possible?

    I have an Extreme N that is set to 2.4 GHz N and extended with an Express N. Question is, how is it possible that my iphone 3G and touch are still connecting to WiFi? Should they not even see my N network since the are both G?

  • 22 inch LaCie Blue II to new iMac - possible?

    I have a new 21" iMac and an old 22 inch LaCie Blue II computer Monitor that I'd like to add as a second monitor because I like the tonal quality for print - is it possible? Will I be able to span or is the old LaCie to slow? Thanks Chris

  • Drill down to Trans XD03 (display Vendor) not working

    All, I have searched SDN but could not find this question posted. I am doing a drill down in a ALV report. I have a call transaction to XD03 - that looks like this: IF rs_selfield-fieldname EQ 'LIFNR'.     SET PARAMETER ID: 'LIF' FIELD rs_selfield-va

  • Generating pdf files from htp.p input

    I have a procedure that generates htp.p coding is there any way that i can use this procedure in oracle reports to create a pdf file?

  • Error in database connectivity

    sir i want to connect jsp with MS-Access the code is-------- <!-- jai shri ram --> <html> <head><title>JAI SHRI RAM</title></head> <body> <%@ page import="java.sql.*" %>      <%      String user1 = null;      String pass1 = null;      ResultSet rs =