How to set the header of the file to excel type when writing it?

Hello,
I am using POI API to read an excel file that I have previously written using Java, but not using POI (I've written the file using Microsoft office xml and then writing it using FileOutputStream with an xls extension).
The problem is that when I read back the file I am getting this error:
The system was unable to upload the file: Invalid header signature; read 7311066695147732796, expected -2226271756974174256.
which means that the header of the file is not excel typed.
If I manually open the file and save it as excel POI is able to read it but I don't want to do this as this entire process of writing/reading the file should be automated. I don't want to use POI for writing the file because POI cannot provide me everything that I need when Microsoft office xml can.
So, my question is simple: Is there a way, using java, to set the header of a file to excel so that POI will recognize it as such?

hi roy,
@see: http://poi.apache.org/hssf/index.html
"HSSF is the POI Project's pure Java implementation of the Excel '97(-2007) file format. It does not support the new Excel 2007 .xlsx OOXML file format, which is not OLE2 based."
maybe jexcelapi supports you in writing your xls:
http://jexcelapi.sourceforge.net/
hth, jens

Similar Messages

  • Re: How to Set Standard Header Section In Export To excel

    Hi Experts,
    I am using Jdeveloper 11.1.2.3.0 ,
    I am taken a Employee and Department  tables For that one i am taking a 2 command buttons and set action ExportToExcel Component to those buttons . Then One button for Employee Date and Second Button for Department But I need Same Template For both the Excels Like Header Section is maintain the Logo And Footer Date Followed For both Pages.
    Can Any Give a solution for this One.
    With Regards,
    satish

    Use POI Apache POI - the Java API for Microsoft Documents to export your data. You write native excel wookbooks and have total control on the export (what is exported, headers footers...) Sample http://www.techartifact.com/blogs/2013/08/generate-excel-file-in-oracle-adf-using-apache-poi.html
    Timo

  • How to get the number of rows written to the header of the spool file.

    Hi
    I need to create a header line for the spool file .
    the header line should include fixed length values .
    The header should include the number of records found in the table with a maximum begin date (begin_date is the column of the table)
    To get the header in the spool file , i wrote a select query has :-
    --SPOOL 'C:\Documents and Settings\abc\Desktop\output.TXT'
    select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000') ||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) ||
    rpad(' ',76,' ')
    from dad.school
    group by sysdate;
    SPOOL OFF
    which gets me all the rows in the table , but i only want the rows with the latest school_begin_date .
    how can i achieve that ...
    I know that a subquery should be written in the from clause to get the number of rows found with a maximum school_begin_date.
    select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000') ||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) ||
    rpad(' ',76,' ')
    from dad.school where
    select rownum from dad.school
    where school_begin_date = max(school_begin_date) ;
    the error i get is
    ORA-00934: group function is not allowed here
    I NEED HELP ..IN GETTING THE ROWNUM JUST FOR THE LATEST BEGIN_DATE ?
    PLS HELP ME IN WRITING THE QUERY .
    THANKS IN ADVANCE .

    Try this:
    select 'W'||to_char(sysdate,'MM/DD/YYYYMi:HH:SS')||lpad(max(rownum),9,'000000000')||'R'||max(to_char(school_from_date,'MM/DD/YYYY')) || rpad(' ',76,' ')
      from dad.school
    where school_begin_date = (select max(school_begin_date)
                                  from dad.school);

  • When i convert any file to pdf, date is automatically added in the header in pdf file. How to change

    When i convert any file to pdf, date is automatically added in the header in pdf file. How to change that?*

    heres a screenshot
    heres a screenshot of how i convert them

  • How to set white spaces between the fields in dataset??

    Hi all,
    I am writing a set on information to from infotypes to a text file. Its a fixed width file. How do set white spaces in the fields for dataset?
    Example:
    TYPES: begin of header,
                    filler(40)  type c,
                    id(3)        type c,
                    filler2(7) type  c,
                    delimiter  type  c,
                 end of header.
    DATA header type header.
    header-filler1 = ' '.
    header-id       = '100'.
    header-filler2 = ' '.
    header-delimiter = cl_abap_char_utilities=>newline.   ( do it to get a new line)
    my_table = header.
    append my_table.
    DATA: out_file(256) type C,
          codepage_ref type ref to CX_SY_CONVERSION_CODEPAGE,
          out_char type c,
          size type i,
          insert_string type string,
          insert_size type i.
      out_file = filename.
      open dataset out_file for output in text mode ENCODING NON-UNICODE.
      LOOP AT my_table.
        size = strlen( my_table ).
        insert_string = ''.
        DO size TIMES.
          offset = sy-index - 1.
          try.
              out_char = my_table+offset(1).
              IF out_char = SPACE.
                CONCATENATE insert_string '' INTO insert_string SEPARATED BY SPACE.
              ELSE.
                CONCATENATE insert_string out_char INTO insert_string.
                transfer insert_string to out_file NO END OF LINE .
                insert_string = ''.
              ENDIF.
            catch CX_SY_CONVERSION_CODEPAGE.
              insert_size = strlen( insert_string ) - 1.
              insert_string = insert_string(insert_size).
          endtry.
        ENDDO.
       transfer CL_ABAP_CHAR_UTILITIES=>NEWLINE TO out_file NO END OF LINE.
      ENDLOOP.
      close dataset out_file.
    How do I get to insert the space for filler1 and filler2?
    Edited by: Siong Chao on Oct 4, 2011 4:56 AM
    Edited by: Siong Chao on Oct 4, 2011 8:27 AM
    Edited by: Siong Chao on Oct 4, 2011 8:29 AM

    problem lies in the open dataset codes
    Used:
    open dataset out_file for output in text mode encoding non-unicode message msg.
    if sy-subrc= 0.
    loop at my_table.
    transfer my_table to out_file
    transfer cl_abap_char_utilities=>newline to out_file no end of line.
    endloop.

  • Hi gurus  in BDC how to print the header on the top of the data

    hi gurus  in BDC how to print the header on the top of the data

    hi,
    while downloading the file using gui_download function module
    in that function module in  TABLES  filednames parameter is used to get headings
    example:
    CALL FUNCTION 'GUI_DOWNLOAD'
         EXPORTING
      BIN_FILESIZE                    =
           FILENAME                        = FILENAME1
          FILETYPE                        = 'ASC'
          WRITE_FIELD_SEPARATOR            = 'X'
         TABLES
           DATA_TAB                        =   T_ZETBR
          FIELDNAMES                       = IT_HEADER
    reward if useful,
    thanks and regards

  • Replacing the Header in rule file without changing source file(header defi)

    hi,
    i am loading the data using header in the Source file (.xls).
    I need to load the same file but for diff header (say instead of A1 i need A2) without any changes in source file.
    can someone please provide information that how to change the header in source file without opening/changing source file.
    Thanks in advance
    Anubhav Bisht

    HI SM,
    thanks for reply.
    the Problem is that there is two members in header defined in the source file that i need to change while loading the data.
    the load rule is picking header from the Source file, so replacing in the field is not working..
    do you have any other option/Suggestion.
    Regards
    Anubhav

  • How to set InDesign CS5 as the default in the system having InDesign CS4 has the default ?

    How to set InDesign CS5 as the default .indd application when you have InDesign CS4 and CS5 installed and InDesign CS4 is the current default (InDesign CS4 was installed after CS5 installation)

    Thanks, but I already tried it at first but it is not the effective method.
    I think its because of the this reason :
    Both - InDesign CS4 and InDesign CS5 have their application/program/exe named as "indesign.exe".
    Installation of either InDesign CS4 or InDesign CS5, sets a Windows default path for the "indesign.exe". In this case, since InDesign CS4 was installed later (after InDesign CS5 was already installed), the "indesign.exe" which was directing InDesign CS5's "indesign.exe" was replaced by InDesign CS4's "indesign.exe".
    But after long google and search through regedit, I've got the solution :
    Locate HKEY_CLASSES_ROOT\InDesign.Document\Shell\Open\Command in regedit
    Change the value of (Default) attribute to "C:\Program Files (x86)\Adobe\Adobe InDesign CS5.5\InDesign.exe" "%1"     // Include the quotes
    Message was edited by: Vidit Kothari

  • Translation - XLF file with the UTF-8 BOM at the head of the file

    Using APEX 3.2, I'm trying to get translations loaded for an application that I'm working on. We are going through the process of generating XLIFF files, sending them to a translator to translate, and then importing the data back in rather than manually editing the translations.
    This works perfectly when I use my text editor to enter the (very poor) translations in the file. Our translator, however, uses a tool that adds a byte-order mask BOM at the head of the XLIFF file when it saves it in order to identify it as a UTF-8 encoded file. This appears to be a valid way for the tool to indicate the encoding being used though, obviously, the encoding in the header overrides it and the BOM is not the preferred method of specifying the encoding of an XML file. However, when we import the file in APEX, and hit the Apply XLIFF button, we get an error
    ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing LPX-00210: expected '<' instead of '¿' Error at line 1
    The third byte of the UTF-8 BOM (0xEF,0xBB,0xBF), if interpreted as an ISO-8859-1, would be the upside down question mark character in the error message. So it appears that the APEX importer is interpreting the BOM using the ISO-8859-1 character set and throwing an error that the file is not valid. That is not my reading of the proper XML parser behavior.
    Obviously, we can work around the problem either by asking our translator to use a different tool or by opening up the files we get back in a hex editor and removing the BOM. Is there anything we can do to resolve the issue that doesn't involve adding an additional manual step to the process or the translator changing the tool being used? Or is there something I'm missing that would indicate that a file with the BOM in the first three bytes should not be considered a valid XML file?
    Justin

    Hello Justine,
    >> Are you stating that that APEX translation engine more or less requires the database character set to be AL32UTF8 in order to work properly …
    Not exactly.
    The APEX translation engine uses the XML DB parser, and this one needs a legal XML file. The problem is that in your specific case, the encoding of the XLIFF file doesn’t match the database character set, hence a character set conversion process is involved in the middle. This conversion process – from UTF-8 to WE8MSWIN1252 embeds illegal XML characters in your stored XML file, right where the BOM is. If, for example, your XLIFF file were encoded in Windows-1252, no character conversion would be necessary and the final (database stored) version of the XLIFF would have been remained legal (assuming it started this way). In this case, the APEX translation mechanism will work just fine, even with a database character set of WE8MSWIN1252 (as you can see when you are using your own XLIFF files, which don’t include the (offending) BOM byte).
    >> … even if an alternate character set encodes all the characters we need?
    With your current database configuration, it seems that the alternate character set you are talking about can’t really encode all the characters that you need, as it can’t cope with the UTF-8 BOM conversion. It very well may be the only character it can’t handle, but that is enough.
    As we need to be practical, and a database character set conversion is most likely out of the question, the simple solution is probably asking your translator to save your XLIFF files without including the BOM. I’m not familiar with the professional XLIFF editors you mentioned, however, as UTF-8 encoding doesn’t really need a BOM, saving a UTF-8 file without it should be an option (just like Keith mentioned with regards to very simple editors like the windows’ Notepad, or Notepad++).
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • Hi All, I have question about the iMac operating system. I have the last updated. The problem when I manage the place of the folder windows they are all mixing up. I mean they not on the place where I left them. how to set they stay on the same place. Tks

    Hi All, I have question about the iMac operating system. I have the last updated. The problem when I manage the place of the folder windows they are all mixing up. I mean they not on the place where I left them. how to set they stay on the same place? I know there are different possibilities to set.
    I tried but it not helped for me. What I can do? How and where can set this they stay on their place?
    Thanks.
    laci

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In Library Manager it's the FIle -> Rebuild command)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. 
    Regards
    TD 

  • How to include a Header in the Open Script

    Hi
    I have a header called "X-Forwarded For", and i want it to be used in the script, i have tried the following statements to do so:
    1) http.headers(http.header("X-Forwarded-For", "12.1.1.1",Header.HeaderAction.Modify));
    2) http.headers(http.header("X-Forwarded-For", "12.1.1.1",Header.HeaderAction.Add));
    But none of the ways worked for me. Can you please help me out to deal with this problem?
    Thanks & Regards
    - Fahim

    Perhaps I was not clear in my previous reply. You must send the header with the first navigation, and then it will be sent with all future navigations. Your cannot call http.headers() directly unless you save the return of the headers, and then pass the returned headers to the first navigation. After that first navigation, you will not need to send the new header in any subsequent navigations assuming the proper HeaderAction.
    http.get(1, "http://testserver2",
      http.querystring(http.param("QueryString1", "QueryValue1")),
      http.headers(http.header("X-Forwarded-For", "12.1.1.1", Header.HeaderAction.SetIfNotSet)),
      false, "ASCII", "ASCII");The 12.x OpenScript users guide explains the http.get and http.post in full detail in sections "6.6.2 Adding HTTP Get Navigation", and "6.6.3 Adding HTTP Post Navigation", which includes setting http.headers()

  • SharePoint 2010 Allow User to Add Comments to Files in a Library and to the Header of the Web-Page

    (1) I need to allow an end-user to be able to add comments to files either when they are added to a library or after they are added. I didn't see a Column available for adding to a Document Library for "Comments".
    (2) I need the same user to be able to add text/comments to the Header of the web-page that contains the library (above the library at the top of the screen).
    When I (the SP Admin) add the "Content Editor Web-Part" to the top of the web-page that contains the Document Library, the Toolbar disappears. The Content Editor Web-Part would be ideal to allow the end-user to add comments to the Header, but I
    really need the Toolbar available.
    Is there another Web-Part that I could use for allowing comments to be added to the Header of a web-page without disabling the Toolbar, or is there a known-fix for allowing the Toolbar to be available and functional after adding a Content Editor Web-Part?
    JCashon

    Hi,
    According to your post, my understanding is that you want to add Comments to Files in a Library and to the Header of the Web-Page.
    (1)If you use the document content type in the library, it will contain the “Comments” field automatically. When you add the document, you can enter the conments. You can also edit the “Comments” field after the document added.
    (2)If you add the add the "Content Editor Web-Part" to the AllItem.aspx Page, you can add the text to the web part as the Header.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • ORA-27047: unable to read the header block of file

    My Windows 2003 crashed which was running Oracle XE.
    I installed Oracle XE on Windows XP on another machine.
    I coped my D:\oracle\XE10g\oradata folder of Win2003 to the same location in WinXP machine.
    When I start the database in WinXP using SQLPLUS i get the following message
    SQL> startup
    ORACLE instance started.
    Total System Global Area 146800640 bytes
    Fixed Size 1286220 bytes
    Variable Size 62918580 bytes
    Database Buffers 79691776 bytes
    Redo Buffers 2904064 bytes
    ORA-00205: error in identifying control file, check alert log for more info
    I my D:\oracle\XE10g\app\oracle\admin\XE\bdump\alert_xe I found following errors
    starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
    starting up 4 shared server(s) ...
    Oracle Data Guard is not available in this edition of Oracle.
    Wed Apr 25 18:38:36 2007
    ALTER DATABASE MOUNT
    Wed Apr 25 18:38:36 2007
    ORA-00202: control file: 'D:\ORACLE\XE10G\ORADATA\XE\CONTROL.DBF'
    ORA-27047: unable to read the header block of file
    OSD-04001: invalid logical block size (OS 2800189884)
    Wed Apr 25 18:38:36 2007
    ORA-205 signalled during: ALTER DATABASE MOUNT...
    ORA-00202: control file: 'D:\ORACLE\XE10G\ORADATA\XE\CONTROL.DBF'
    ORA-27047: unable to read the header block of file
    OSD-04001: invalid logical block size (OS 2800189884)
    Please help.
    Regards,
    Zulqarnain

    Try to install win 2003 server software, do the fresh installation of oracle software, now copy the datafiles and controlfiles to same locations as you did on winxp.
    get back to us, if still not out of the woods. I still doubt that a simple restore would do the trick, since you doing it across different platforms, might be I can be wrong, but this is what I personally feel, you not able to start the database on winxp.
    hare krishna
    Alok

  • How to set a song in the playlist to be phone ringtone

    how to set my song in the playlist to be my ringtone

    you have to convert it to a ringtone first. searching google will give you many ways to do it. also, there are some ringtone apps with pros and cons to each one. you cannot just pick a song on your phone and make it a ringtone unfourtunately.

  • How to set a cookie in the browser from an html page called via an Iview

    How to set a cookie in the browser from an html page called via an Iview
    Hello all,
    I have an issue which is causing problems. I have a snap survey (html form with submit and cookie setting) which is embedded in a url iview.
    Although the submit and the form work fine, the portal will not allow the cookie to be set it seems.
    Is there a way to allow cookies to be set from an embedded page in a url iview??
    You will make my day if you know!
    System: EP7 SP13
    Kind regards
    Alex

    Hi,
    Check this:
    http://www.oracle.com/technology/products/ias/portal/html/same_cookie_domain_with_pdkv2.html
    Cookie Basics
    Web browsers have built in rules for receiving and sending cookies. When a browser makes a request to a web server and the web server returns cookies with the response, the browser will only accept a cookie if the domain associated with the cookie matches that of the original request. Similarly, when a browser makes a subsequent request, it will only send those cookies whose domain matches that of the target web server.
    These rules are designed to ensure that information encoded in cookies is only "seen" by the web server(s) that the originator of the cookie intended. These rules also ensure that the cookie cannot be corrupted or imitated by another server. By default, the domain associated with a cookie exactly matches that of the server that created it. However, it is possible to modify the domain at the time the cookie is created. Relaxing the cookie domain increases the scope of the cookie's visibility making it available to a wider "audience" of web servers.
    For example, if a cookie is created by a.us.oracle.com, it's domain will usually be set to a.us.oracle.com. This means that the browser will only send the cookie to a.us.oracle.com. It will never send it to any other servers. However, if at the time of creation, the domain of the cookie is set to .us.oracle.com, the browser will send the cookie to any server whose domain falls within .us.oracle.com. such as portal.us.oracle.com, provider.us.oracle.com, app.us.oracle.com etc
    Regards,
    Praveen Gudapati

Maybe you are looking for

  • Calling A Page Process From Report Link

    Hello. I am using Apex 4.2.1 on Oracle 11gR3 and mod_plsql. I am trying to run a PLSQL after-submit page process when users click a SQL generated link in a classical type report. For example, my classical report uses the query: SELECT E.*, '<a id="ri

  • Converting PAL to NTSC and making a DVD

    I have a couple of .avi files, some are in PAL and others in NTSC, I wanna make a DVD in NTSC mode, How can I convert the files?

  • Insert three values for each record

    I have a very complex Data Flow, with several joins, splits, etc.... once all of this logic is completed, I need to insert the values 2013, 2014, and 2015 for a Derived Column (called Year).  Each record that comes through this data flow needs to hav

  • Recommended bookmark tool for FF on Mac OS X Leopard?

    Hi all, I have tried out the latest "Gmarks" add-on for sorting my ~1,500 bookmarks. Importing from FF directly does not work, and there is no other import option, e.g. from html. Does anyone have experience with google bookmarks and/or this add-on?

  • Making code faster smaller and more elegant

    hi just like yesterday I�m new to java. first of all I want to get familiar with the basics. I wrote a little game therefore. with some help. within the code are no mistakes, compiling errors or such. but now my question is why is my CPU usage nearly