My java program can't read the EXCEL file generated by BI Publisher

I have a program that generates excel file and another program that reads the previously generated file.
I'm getting this error when my code reads the file using the "HSSFWorkbook" object:
Exception in thread "main" java.io.IOException: Invalid header signature; read 3271134372600964429, expected -2226271756974174256
     at org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockReader.java:112)
     at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:151)
     at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:298)
Edited by: user1900500 on Mar 11, 2011 3:37 PM

If you're using JDK 5 or later, you could use the Scanner class for input information. See below:
try {
               Scanner reader = new Scanner(new File("C:\\boot.ini"));
               StringBuilder sb = new StringBuilder();
               while (reader.hasNextLine()) {
                    sb.append(reader.nextLine());
                    sb.append(System.getProperty("line.separator"));
               System.out.println(sb.toString());
          } catch (FileNotFoundException e) {
               e.printStackTrace();
          }

Similar Messages

  • How can I read the EXCEL file while Program is running in background.

    Hi all Expert,
    How can I read the EXCEL file while Program is running in background.
    Thanks

    you need to place ur excel file on application server and follow this thread: Reading an Excel file from the application server?
    loots of information if you can search forum.. thanks

  • Problem in reading the excel file path in WINDOWs machine from UNIX environ

    Hello friends,
    My requirement is to read each row of the excel sheet and sent that row to the database. I have implemented it by using jxl and apache poi framework. locally in my WINDOWS machine it is working fine..
    But when i deploy the code in UNIX machine. My application runs on a Unix server , trying to read the excel file in WINDOWS environment. I am not able to retrieve the file path. for ex : C:\Documents and Settings\sabbanik\My Documents\KARUNAKAR\excel.xls
    I am getting error in this line
    workbook = Workbook.getWorkbook(filepath)
    Error message : input file not found.
    Thanks in advance..

    You said: I am getting error in this line workbook = Workbook.getWorkbook(filepath) >
    Based on this, I will assume you are trying to use OLE to access information about the Excel file. As mentioned by Andreas, your code will be executing on the server (Unix) and since Excel isn't on the server (and cannot be) an error will result. OLE can only be used in Windows environments (client or server). To access client side OLE calls and content, you need a java bean and Excel installed on the client machine. Oracle provides WebUtil as an option to writing your own Java Bean. To use this, you will need to be running Forms 10.1.2 or newer. Details can be found here along with a demo:
    http://www.oracle.com/technetwork/developer-tools/forms/webutil-090641.htm

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

  • How can I read the bootstrap files and extract the fragment-URLs and fragment-numbers in plain text?

    How can I read the bootstrap files of any HDS Live stream and extract the fragment-URLs and fragment-numbers in plain text?
    Could it be that it is some kind of compressed format in the bootstrap? Can I uncompress it wirh  f4fpackager.exe? Could not find any download for f4fpackager.exe. I would prefere less code to do so. Is there something in Java of JavaScript, that can extract the fragment-numbers?
    Thank you!

    Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
    Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave.

  • How can i read local excel file into internal table in webdynpro for abap a

    Could someone tell me how How can i read local excel file into an internal table in webdynpro for abap application.
    thank u for your reply

    Deep,
    File manuplations...............................
    1. At the presentation level:
    ->GUI_UPLOAD
    ->GUI_DOWNLOAD
    ->CL_GUI_FRONTEND
    2. At the application server level:
    ->OPEN DATASET : open a file in the application server for reading or writing.
    ->READ DATASET : used to read from a file on the application server that has been opened for reading
    -> TRANSFER DATASET : writing data to a file.
    -> CLOSE DATASET : closes the file
    -> DELETE DATASET : delete file
    If file is on the local PC,use the function module GUI_UPLOAD to upload it into an internal table by passing the given parameters......
    call function 'GUI_UPLOAD'
    exporting
    filename = p_file
    filetype = 'ASC'
    has_field_separator = '#'
    tables
    data_tab = t_data
    p_file : excel file path.
    t_data : internal table
    <b>reward points if useful.</b>
    regards,
    Vinod Samuel.

  • How can I read a Excel file?

    How can I read an Excel file and compare if the cells type are numeric or not??
    i hope you can can give me a hand..
    thanks

    If you want to use plsql try utl_file supplied package to read the excel file -> http://psoug.org/reference/utl_file.html
    And you can use a function like this to understand if the column is number or not ;
    CREATE OR REPLACE FUNCTION is_number (
    char_in VARCHAR2)
    RETURN BOOLEAN
    IS
    n NUMBER;
    BEGIN
    n := TO_NUMBER(char_in);
    RETURN TRUE;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN FALSE;
    END is_number;
    DECLARE
    x BOOLEAN;
    BEGIN
    IF is_number('ABC') THEN
    dbms_output.put_line('TRUE');
    ELSE
    dbms_output.put_line('FALSE');
    END IF;
    END;
    /

  • How can I read an excel file .xls from an forms 6i

    Hi
    I have forms6i and webutil don t work with this version, can I read an excel file from forms6i.
    Thank u

    Hi hosoriol,
    You can refer an excel as an external table first using the steps below and then you can start reading from it.
    If you want to update the excel file then create an view and create instead of triggers for it.
    Steps
    h3. 1.[Create an external table for the excel file |http://www.adp-gmbh.ch/ora/misc/ext_table.html|Click here to view detailed description]
    h4. 1. Create a directory in Oracle where you have kept the xls file
    create or replace directory ext_dir as '/home/rene/ext_dir';h4. 2. grant read, write on directory ext_dir to scott;
    h4. 3. creating the external table
    create table ext_table_csv (
                                                i   Number,
                                                n   Varchar2(20),
                                                m   Varchar2(20)
                     organization external (
                                                     type   oracle_loader
                                                     default directory ext_dir
                                                    access parameters (
                                                                                 records delimited  by newline
                                                                                 fields  terminated by ','
                                                                                  missing field values are null
                                                   location ('file.csv')
                     reject limit unlimited;
    Note_
    If you want to update the excel file then create a view and then create the instead of triggers to do the update, delete or insert.[Creating views on external tables | http://www.dba-oracle.com/oracle_news/2005_9_1_updating_external_tables.htm]
    h3. 2. Use the data block wizard and connect to the corresponding schema and create a database block.
    Kindly click Correct or Helpful if it helps Thanks :-)

  • I have the latest downloadable version of LR5.  It crashed while it was createing 1:1 previews during an import. After a Win7(64) restart, it shows a message that LR needs to quit because it can't read the preview files and it will try to fix it the next

    I have the latest downloadable version of LR5.  It crashed while it was createing 1:1 previews during an import. After a Win7(64) restart, it shows a message that LR needs to quit because it can't read the preview files and it will try to fix it the next time is launches.  I get the same message the next and every subsequent time it launches so I can't launch LR at all now.
    I get that the preview file got corrupted somehow.  Is there some way to fix this problem without building a new catalog?

    Use Windows Explorer to open the folder containing your catalog. You will see a folder with the extension .lrdata. You need to delete that folder and then start Lightroom again. Lightroom will generate a new previews folder.

  • My LV program can't find the iak file when the program is loaded from a different PC.

    Hello all,
    My LV vi with Fieldpoint I/O and it's IAK file are stored on the company network.  If I load and run the LV vi from the PC it was developed on, everything is fine.  If I load and run on a different PC (that has an identical install of LV), the LV vi can't find the IAK file (all of the I/O pointers to the file are grayed out.) 
    Also, if I make an EXE out of the vi on the machine that can find the IAK, it won't find it if it's run from the other machine.
    It is not related to whether one machine has different "rights", as they are identical.  It's not related to different installs of LV, as they are identical.   
    I have found that this is related to the network login name/password, and to the machine's network name.  If I login on the second machine and try to run the program, it won't find the IAK.  If I point it to the IAK it will run.  If I save it and log out, and then login as a different user with the same rights on the second machine, it won't find the IAK again, until I re-point it there when I re-run it.  This is true for both the vi and the EXE.
    This problem makes deploying the EXE difficult to different machines, as the first time it's run, the EXE has to be pointed to the IAK.  Pointing the EXE to the IAK is difficult as these installations have no keyboard or mouse.
    Does anyone have any ideas on how to fix this so the LV vi or it's EXE finds the IAK from no matter where it's loaded from?
    Thanks,
    Mike

    Laura,
    I figured I'd continue this thread because it's along he same line..
    I have two Fieldpoint systems. They are identical, except for one thing...one has an AI-110 in position 7...the other has nothing. Both have the same IP address, etc and I swap the ethernet cable between them when I want to select which one I use.  I use a dedicated ethernet card to the FP processor...and it's not the company net.
    There are two IAK files...one for the system with the AI-110, one for the system without the AI-110. The two IAKs are in different paths.
    Before I had the system and the IAK without the AI-110, I made an EXE of the code that woked with the AI-110, and it worked fine.
    But now if I run the EXE after I've used MAX and opened the IAK without the AI-110, the EXE won't read the AI-110!  I have to go back into MAX and open the IAK that has the AI-110 in it, close MAX and restart the EXE for the EXE to see the AI-110.  (Max is NOT SET to "Download Items on Save")
    I looks like the EXE is looking at MAX to get the IAK or a pointer to the IAK.
    Did I build my EXE incorrectly?  Shouldn't an EXE completely ignore MAX once it's made?
    Thanks,
    Mike

  • After I Update to IOS 7.1 I can't open the excel file attached in  my email

    After I updated my Iphone 5s from IOS7.0.6 to IOS7.1 when i check my email i can't open excel file attached in my email i check with my frineds phone thy have same issoue

    David_PDX wrote:
    Hi Alex,
    The trick to this whole thing is to scroll to the bottom of the message. There should be a dashed line at the bottom of the email message with text underneath it that says, "This message was downloaded as plain text." Underneath that it should say (in blue hyperlink text) "Download full message". Select that hyperlink, and the Excel file should download completely. You should then be able to select the document and have it open correctly.
    I have had the same concern regardless of file format that is sent, so I do not believe your issue is with file format. Hope this helps.
    I've seen the same thing happen with images, which it displays in a corrupted form. It's fixed by downloading the full message.
    There's a more serious side effect of this, which I've now seen with several types of files. If one FORWARDS the email to someone else, the attached files it sends them are CORRUPTED and unopenable too. In the case of a Word files I looked at, it had dropped the last two bytes of the file.
    The workaround for that is to download the full message before forwarding.
    I'm seeing this happening with so many types of attachments that I'm assuming it affects them all. Please everyone report this to Apple feedback (http://www.apple.com/feedback/). It's one thing not being able to open a file on your device, it's another to have files corrupted permanently just by forwarding.

  • Can I read the dd file without the device

    Hello,
    Is it possible to read the DD file in Configurator 3.1 without connecting to the device? 
    The short version of the story......  I have only used the configurator a few times and was walked through the process.  Now I need to figure out how to control a positioner (DVC6000f), I just need to stroke a valve open, closed and position it somewhere between the two.  I am not able to connect to a positioner right now, so I would like to load the DD file into the configurator and look around to see if I can figure out how to give it a position command signal.  Once I am able to stroke the valve I will need to write a simple LabView program to make it easier than the configurator program.
      What is the best way to figure out which block I need to position the valve?  I am hoping when I actually connect to the positioner it will be obvious, but life is usually not that easy.
    Bryan

    Hello Josiane,
      Thank you for the information, I was able to load the DD and look around the configuration blocks.  Initially engineering only asked about simple control of the valve, today things have changed.  I found out that there are to be many tests performed on the valve including sine wave response, step testing, Hysterisis, linearity, dead band, and some others. 
    So my question now is how well can I control the positioner by writing a Vi in LabView?  I can perform the above tests on a positioner with a 4-20mA output signal from my DAQ.  Would it be possible to write the 4-20mA output signal into an input block (instead of an analog output channel) and control the valve in real time?  I could just change the mA signal into whatever units the positioner wants.  Or what would be the best approach to control the valve for testing?
      Is there a number I can reach for support?  It might be easier than email.
    Bryan

  • Elements 10 can not read the raw-files from my Sony a-57

    The raw-converter is updatet to 6.7 and according to Adobe it should be able to read Sony a-57. When I got Elements 10, a file had to be moved so it could read the raw-files from my Minolta 5D. Can this be the cause of the problem ? What to do ?

    What version of ACR does Help / About Plug-ins… / Camera Raw… show you, and is more than one Camera Raw listed in About Plug-ins…?

  • How can i display a excel file generated by labview?

    hello,
    I'm looking for an exemple to display (open) a .xls file generated by labview after simulation but without use  the tookit report generation.
    somebody knows how could I do this?
    Any suggestions?
    Thanks,
    longar
    p.s: i use labview 8.6 
    Solved!
    Go to Solution.

    There is quite large dedicated Excel thread with a lot of examples.
    I'm curious though. If you don't have the toolkit, how did you create the Excel file in the first place?

  • How can i read the text files and buffer the data in Vector?

    hi. I have been running into this problem for days, but with no luck and losing right direction.
    The problem is : I am trying to read a text file and buffer the data into a
    Queue for each user.
    the sample text file is as below:( 1st column is timestamp, 2nd is user_id, 3rd is packet_id, 4th is packet_seqno, 5th is packet_size)
    0 1 1 1 512
    1 2 1 2 512
    2 3 1 3 512
    3 4 1 4 512
    4 5 1 5 512
    5 6 1 6 512
    6 7 1 7 512
    7 8 1 8 512
    8 9 1 9 512
    9 10 1 10 512
    10 1 2 11 512
    11 2 2 12 512
    12 3 2 13 512
    13 4 2 14 512
    14 5 2 15 512
    15 6 2 16 512
    16 7 2 17 512
    17 8 2 18 512
    18 9 2 19 512
    19 10 2 20 512
    20 1 3 21 512
    21 2 3 22 512
    22 3 3 23 512
    23 4 3 24 512
    24 5 3 25 512
    25 6 3 26 512
    26 7 3 27 512
    27 8 3 28 512
    28 9 3 29 512
    29 10 3 30 512
    30 1 4 31 512
    31 2 4 32 512
    32 3 4 33 512
    33 4 4 34 512
    34 5 4 35 512
    35 6 4 36 512
    36 7 4 37 512
    37 8 4 38 512
    38 9 4 39 512
    39 10 4 40 512
    40 1 5 41 512
    41 2 5 42 512
    42 3 5 43 512
    43 4 5 44 512
    44 5 5 45 512
    45 6 5 46 512
    46 7 5 47 512
    47 8 5 48 512
    48 9 5 49 512
    49 10 5 50 512
    50 1 6 51 512
    51 2 6 52 512
    52 3 6 53 512
    53 4 6 54 512
    54 5 6 55 512
    55 6 6 56 512
    56 7 6 57 512
    57 8 6 58 512
    58 9 6 59 512
    59 10 6 60 512
    60 1 7 61 512
    61 2 7 62 512
    62 3 7 63 512
    63 4 7 64 512
    64 5 7 65 512
    65 6 7 66 512
    66 7 7 67 512
    67 8 7 68 512
    68 9 7 69 512
    69 10 7 70 512
    70 1 8 71 512
    71 2 8 72 512
    What I wanna do is to read all the data above and buffer them in a queue for each user( there are only 10 users in total).
    I already created a class called Class packet:
    public class packet {
        private int timestamp;
        private int user_id;
        private int packet_id;
        private int packet_seqno;
        private int packet_size;
        /** Creates a new instance of packet */
        public packet(int timestamp,int user_id, int packet_id,int packet_seqno, int packet_size)
            this.timestamp = timestamp;
            this.user_id=user_id;
            this.packet_id=packet_id;
            this.packet_seqno=packet_seqno;
            this.packet_size=packet_size;
    }then I wanna to create another Class called Class user which I can create a queue for each user (10 users in total) to store type packet information. the queue for each user will be in the order by timestamp.
    any idea and sample code will be appreciated.

    Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
    Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave.

Maybe you are looking for

  • To buypass the SAP standard POP up box in PO create and change mode

    Hi All, In purchase order ME21N or ME22N, i have made changes using enhancement MM06E005. It is in FM Exit_sapmm06E_012 that i have my new code. Here when the business requirement is met the custom warning message is triggered. With this, i get sap p

  • Some questions for ressources provisionning.

    Hello people. I'm currently playing around with LDoms on a new brilliant shiny T5520 and I have some questions about. My actual configuration is the following: - 1 T5520 Server with 32 Gb RAM and a 8 cores 64 threads Niagara T2 - 4 SAS 143 Gb disks o

  • Setting a tab order for forms (AS3)

    Hi all, When I press the Tab key to jump to the next text box on my form, it jumps to the 4th text box and then to the 7th and so on. There is no order what so ever. Does anyone know I can set this order?

  • Reg derivation rule

    Hi,        i had created a G/L account for balance sheet, this need to be assigned to profitcenter, i had tried to use it with t-code 3KEH, but i am facing an error relating to problem with intervals,              please guide me in solving this issu

  • Display a generated query in a text field with values

    Hello, I generate a query based on pl/sql. This works fine, but how can I display the query with the values from an item? i.e. in my query i have select * from a_table where name = :p1_name if i want to display the query in the correct way " select *