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

Similar Messages

  • 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...

  • 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();
    }

  • 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 change the background color of a webi report in the infoview

    Hi,
    Can someone please me help me with the below issue.
    Environment Details:
    BusinessObjects XI3.1 SP1SP2SP3                                                                               
    BusinessObjects XIR2 SP5                                                                               
    .Net infoview                                                                               
    IE 7                                                                               
    JRE versions used as;                                                                               
    On BOXI3.1 SP3 Server -1.6.0_03                                                                               
    On BOXIR2 SP5 Server -1.4.2_02                                                                               
    On the client machine   -1.6.0_14      
    Issue Description:
    -Open an existing webi report in the infoview.                                                                               
    -In the report,I am not able to change the background and the font color for the column headings from the properties tab in the left navigation panel.                                                                               
    -I can change the color after hitting the color tab for multiple times.Also the color was getting changed when the color code was manually changed.                                                                               
    -The reports background color was getting changed,but not the font color.                                                                               
    -I tried to create a test report,where I was able to change the color.                                                          
    I have;
    -Installed the Java update 14 on BOXI3.1 server machine,here I was  able to change the background and font color.
    -However on the client machine,with the same Java update 14,the background and the font color for the column headings was not getting changed.
    -Same behaviour is observed on BOE XIR2 SP5 machine.
    Is there any limitations for using Java update 14 or am I required to do any other settings.
    Regards,
    Pankaj

    Hi Pankaj,
    It is a strange behavior. You also stated that when you create a test report it works fine.
    Can you create a copy of this report and then try on the new copy?
    One thing you can do as a test to refresh the universe and then try it. And change some columns - add some column and then save and ten remove and save and make changes like this and trying changing color.
    I think there is a problem with this report this is why it is behaving like this on all machine.
    Regards,
    Bashir Awan

  • Create an excel file from java

    I am using Jakarta's POI to create an excel file from MySql. The POI works well when a samll amount of data was written from MySql (created .xls file less than 3500KB). The problem is when a large amount of data need to be written to an excel file, java.lang.OutOfMemoryError Exception in thread "main" appears. In my project, I really need to have a large amount of data to be wriiten ton excel file. Do somebody has good solution for it?
    Thanks

    What about using some text files like csv
    (comma-separated value) file? It is plain text but
    Excel (and other spreadsheet programs) will be able to
    read it.
    But then there will be no formatting and bells and
    whistles. It was just an idea.Excel will also read HTML <TABLE>'s, with full formatting. There are some extra tags for numeric formatting, also. Just create an HTML table, and save to a file with .xls extension, e.g.:
    <TABLE>
    <TR bgcolor="#00FF7F">
    <TH>Agency ID</TH>
    <TH>POS ID</TH>
    <TH>Machine Serial</TH>
    <TH>Disk Serial</TH>
    <TH>MAC ID</TH>
    <TH>System Manufacturer</TH>
    <TH>Machine Type</TH>
    <TH>BIOS Manufacturer</TH>
    <TH>BIOS Version</TH>
    <TH>BIOS Date</TH>
    </TR>
    <TR bgcolor="#9ACD32">
    <TD>1000</TD>
    <TD>1069</TD>
    <TD STYLE='vnd.ms-excel.numberformat:@'>US215199248</TD>
    <TD STYLE='vnd.ms-excel.numberformat:@'>5C5AE88F3</TD>
    <TD STYLE='vnd.ms-excel.numberformat:@'>000423155334</TD>
    <TD>Hewlett-Packard</TD>
    <TD>Desktop</TD>
    <TD>American Megatrends Inc.</TD>
    <TD>JA.01.03US</TD>
    <TD>07/19/2001</TD>
    </TR>
    </TABLE>

  • Help for writing to excel file from Java Program

    Hi,
    I am new to Java and Java API. I need to write to some specific cells of an excel file from a Java Program. Please anyone help me or give some directions.
    Thanks,
    Reet

    Hi,
    I saw an example while searching in google about importing jxl.*. Could you direct me how I can import this package as java does not have it. I heard that jxl is much easier that POI although I am not new to both of them.
    Thanks,
    Priya

Maybe you are looking for

  • Getting an error in KPI Modeler as "{"customMessage":"failed to detect the sap language of the current session language","status":500}"

    Hi Experts, We have installed UISKPI01 in SAP NetWeaver Gateway System for Fiori Analytical Apps (KPI modeler is necessary to model the KPI) but while trying to create and Save the Group, we are Getting an error in KPI Modeler as "{"customMessage":"f

  • One payment ID has more than one payment medium file by Vendor

    Hi Guru, Running DME engine currently creates one payment medium file but inside the lines haaving dulicates under the same payment method and same vendor. How to collect  them in a payment medium file  under one payment method? KR, J.

  • [CS3][JS] Selecting Layers by Name

    I'm trying to design a script to select layers by a given name. And then PDF layer1 (base) and certain items that are on each layer 1 at a time so I have multiple different pages. But the PDF thing doesn't seem to be much of an issue. I just can't se

  • XML DB Content Management Sample

    I'm trying to build a content management system. I downloaded the XML DB CS Sysytem sample from http://otn.oracle.com/sample_code/tech/xml/xmldb/cmsxdb/index.html 1) Opened the sample workspace in J Developer V903. 2) Added all libraries according to

  • Partial download mail with Yahoo account

    Hi. I have Mail 3.6 on Mac os 10.5.8 and 2 account: Gmail and Yahoo. Gmail works fine but Yahoo has downloaded only mail until 25/09/2008. I deleted mail account in Mail e re-created but problem didn't resolve. I have Powerbook G4 with Mac os 10.4.11