Using NPOI to open both XLS and XLSX for reading

I am having an issue opening an Excel 2007 (xls) Workbook.  I receive the following error:
The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)
My code for reading xls file is:
// Workbook object
HSSFWorkbook hssfworkbook;
// create workbook object using file stream
using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read))
hssfworkbook = new HSSFWorkbook(file);
  Please tell me the solution for above issue.
Thank you.
         

Hi Vani d,
I am afraid that NPOI is third-party dll. This is out of our support. So i will move to off-topic forum.
But here are some useful info as below
Please note the following code, When opening a workbook,  a .xls using HSSFWorkbook,  a .xlsx using   XSSFWorkbook. Please refer to
http://poi.apache.org/spreadsheet/quick-guide.html for more information.
Workbook wb = new HSSFWorkbook();
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
wb.write(fileOut);
fileOut.close();
Workbook wb = new XSSFWorkbook();
FileOutputStream fileOut = new FileOutputStream("workbook.xlsx");
wb.write(fileOut);
fileOut.close();
Have a nice day!
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Unable to open .xls and .xlsx files from windows explorer or from Microsoft outlook using MS Office 2007

    When I double click on an .xls or .xlsx file Excel will open up, but I never see the file open up.
    If I right click on the excel file and say open with excel I then get the following error:
    "Windows cannot find file c:\test\test.xls.  Make sure you typed the name correctly, and then try again...."
    Everywhere I looked seems to indicate the file associations was messed up so per a technical document I deleted the .xls and .xlsx association and then ran the Office 2007 repair and rebooted.  Still not working even after office puts the .xls and .xlsx
    file associations in.
    Here is what I see the in .xls and .xlsx for the &Open action:
    Application: "C:\Program Files\Microsoft Office\Office12\EXCEL.EXE" /e
    UseDDE: Checked
    DDE Message: [open("%1")]
    Any guidance would be appreciated!
    Greg

    In the ened I had to go into Excel Options, Advanced, General, and uncheck the "ignore other applicaitons....".  BUT this only worked after doing the Office 2007 repair.

  • .xls and .xlsx file upload in webdynpro

    Hi All,
    Its very urgent.Tried for many options, Searched the scn. But no result. None of them are consistent while uploading xls and xlsx file.
    Sometimes the same file is working garbage value and sometime is working fine.
    Even I tried using CL_FDT_XL_SPREADSHEET , but its always been caught by cx_fdt_excel_core.
    Could anyone suggest me what to do in this case, as my client is not agreeing to any other kind of file .

    Hi Prabhati,
         i had a similar requirement  but i was able to persuade my clients to use tab delimeted file(saved as xls).
    XLS and XLSX excel upload in WDA - webdynpro
    Thanks & Regards,
    Tashi

  • Lightroom opens up to "trial expired." I have to sign in every time I open both Lightroom and Photoshop CC

    Lightroom opens up to "trial expired." I have to sign in every time I open both Lightroom and Photoshop CC. What is the cure?

    Hi,
    Can you please elaborate what happens when you try to Sign in?
    Also , Can you please share the following logs at [email protected]:
    Go to %temp% folder and share PDApp.log , oobelib.log and amt3.log
    Thanks,
    Shikha

  • After up grade to ios5.1, my 3GS  can not use personal hot spot (both USB and blue tooth) .

    After up grade to ios5.1, my 3GS  can not use personal hot spot (both USB and blue tooth) . Tried reboot, reset network, reset everything, reinstall my xp system on my N B, still does not work. My iPad  used to go to Internet  via iPhone 3GS personal hot spot, now my 3GS can not find my iPod through blue tooth!!!!

    Same problems, unfortunatley I updated to 5.0 1 hour before going on holiday for three weeks and no way to restore my phone to try to remove it.At the same time, drop outs, range problems and the most annoying was my music and apps were corrupted and would not function properly :-(

  • How can I open both UDP and TCP ports

    Hi,
    How can i open both tcp and UDP ports for an IP in Cisco ASA?
    Regards
    Ejaz

    Are you referring to port opening in Cisco ASA to permit certain traffic? I believe the following document should help.
    http://www.cisco.com/en/US/docs/security/asa/asa82/configuration/guide/acl_overview.html
    Adding a Standard Access List
    hostname(config)# access-list access_list_name standard {deny | permit} {any | ip_address mask}
    Example:
    hostname(config)# access-list OSPF standard permit 192.168.1.0 255.255.255.0
    http://www.cisco.com/en/US/docs/security/asa/asa82/configuration/guide/acl_standard.html
    Adding an Extended Access List
    access-list access_list_name [line line_number] [extended] {deny | permit} protocol source_address mask [operator port] dest_address mask [operator port | icmp_type] [inactive]
    Example:
    hostname(config)# access-list ACL_IN extended permit ip any any
    http://www.cisco.com/en/US/docs/security/asa/asa82/configuration/guide/acl_extended.html
    Hope this will help.

  • I have a new ipad air and my own apple id. My wife has iphone and her own apple iD.  All our music is in her apple id.  can i sync both ipad and phone for music but keep my ipad separate from her iphone ?

    I have a new ipad air and my own apple id. My wife has iphone and her own apple iD. 
    All our music is in her apple id.  can i sync both ipad and phone for music but keep my ipad separate from her iphone for everything else?

    How to use multiple iPods, iPads, or iPhones with one computer
    http://support.apple.com/kb/HT1495
    How to Share a Family iPad
    http://www.macworld.com/article/1163347/how_to_share_a_family_ipad.html
    Using iPhone, iPad, or iPod with multiple computers
    http://support.apple.com/kb/ht1202
    iOS & iCloud Tips: Sharing an Apple ID With Your Family
    http://www.macstories.net/stories/ios-5-icloud-tips-sharing-an-apple-id-with-you r-family/
    How To Best Use and Share Apple IDs across iPhones, iPads and iPods
    http://www.nerdsonsite.com/blog/2012/06/07/help-im-appleid-confused/
     Cheers, Tom

  • Open PR, PO and Contract for services.

    Dear All,
    I want to develop a report that gives the open PR, PO and Contract for services.
    When user will enter the service number report will give the open PR, PO and Contract.
    But for services quntity in item overview is always 1 AU.
    I want to compair the quantity in item details (ESLL - MENGE).
    Suppose PR is with 100 Hrs and 3 diffrent PO created for this with 25 Hrs each.
    How Can I compair this.
    Thanks and Regards.
    Prakash

    TNX

  • When I try to print sth I can´t choose my printer. Adobe Reader only shows a printer I used years ago.I aleady deleted and reinstalled the Reader and deleted all other printers from the computer.How can I add a new printer to Adobe Reader?Thanks for help!

    When I try to print sth I can´t choose my printer. Adobe Reader only shows a printer I used years ago.I aleady deleted and reinstalled the Reader and deleted all other printers from the computer.How can I add a new printer to Adobe Reader?Thanks for help!

    Hi,
    I would suggest you to uninstall Adobe Reader using the cleaner tool and then re-install the latest version.
    Adobe Cleaner Tool:- Download Adobe Reader and Acrobat Cleaner Tool - Adobe Labs.
    Latest version of Adobe Reader:- http://get.adobe.com/reader/
    If you still experience the same issue, please share the following information:-
    - Screenshot of Adobe Reader showing printer options
    - Screenshot of Microsoft Word showing printer options
    - Screenshot of control panel- Control Panel\All Control Panel Items\Devices and Printers
    Regards,
    Nakul 

  • HT4972 I am trying to update ipod touch from ios 4.3.2 to ios 6.1.3.  I have it connected to my computer, and the summary in itunes indicates the update is available.  However, when I click "update", it opens Windows Explorer and waits for a file name to

    I am trying to update ipod touch from ios 4.3.2 to ios 6.1.3.  I have it connected to my computer, and the summary in itunes indicates the update is available.  However, when I click "update", it opens Windows Explorer and waits for a file name to open.

    I am not at that computer now, but I did check via windows update & with the check updates menu choice in the itunes program  - neither indicated a newer version of itunes is available. (it is a vista computer).
    The itunes software on the computer displays my ipod & the current ios (4.3.2), and indicates a newer ios is available (6.1.3). When I choose "update", I am taken to Windows Exploer and prompted to choose a file to open. it is as if the "update" button has the incorrect code attached to it.
    The ipod is working, but there are several app I would like to install, but I can't with the current ooperating system.

  • I plan to purchase a Mac mini and then a new iPad.  Can I use the iPad as a monitor and keyboard for the Mac mini, either through the USB connection or thru Wi-Fi?

    I plan to purchase a Mac mini and then a new iPad.  Can I use the iPad as a keyboard and screen for the Mac mini, using either the USB connector or Wi-Fi?

    I'm sorry, I should have said thru Bluetooth, not Wi-Fi.  I want to use the mini as a base station and the iPad like a laptop that I can sync when I'm home and carry with me when I travel.  Is is possible to hook these 2 up - iPad/mini, through Bluetooth?  I understand I need to use a regular monitor/keyboard/mouse on the initial install.

  • 503 Service Unavailable? unable open irj/portal and NWA for SAP CE 7.3 trial version

    Hi Experts,
    I am not able to open irj/portal and nwa for my recently installed SAP CE 7.3 trail version.
    Only start page is opening.
    SAP J2EE engine and data base is up and runing.
    1.
    Time
    2014 07 03 10:18:04:932
    Severity
    Error
    Filename
    defaultTrace_00.3.trc
    Details
    SourceName: com.sap.engine.services.deploy.server.TransactionManager Location: com.sap.engine.services.deploy.server.TransactionManager DCComponent: servlet_jsp CSNComponent: BC-JAS-WEB User: Guest Session: 0 CorrelationID: 4699250000000003 DSRTransaction: f0452ed0026911e48a26000c29f14d18 DSRRootContextID: F0452ED0026911E48A26000C29F14D18 DSRConnection: f0452ed0026911e48a26000c29f14d18 DSRCounter: 0 ThreadName: Thread[HTTP Worker [@1380566121],5,Dedicated_Application_Thread] TimeZone: +0530
    Text
    Global [startApp] operation of application [sap.com/tc~lm~itsam~co~ui~nwa~localnavigation~wd] failed with errors on server process [4699250].
    Thanks,
    Amith.

    Hi Mayank,
    I am not able to access index.html page it shows 404 error,
    Main page is opening.
    please provide path for dev_server0 and stdout_server0 logs i will update.
    Thanks,
    Amith.

  • Can I use Time Capsule as external storage and not for Time Machine?

    Can I use Time Capsule as external storage and not for Time Machine?
    I want to just use it like a USB drive but wirelessly and so other people in my suite can use it wirelessly to get the files I put on there. Let me know if you need me to explain some more

    Will the Time Capsule come with directions on how to set it up as external storage rather then time machine.
    Yes, AirPort Utility will walk you through the setup.
    Because when I watched the video on it it says that time machine is automatically recognized
    You have to turn Time Machine "On" for each Mac separately. By default, it is "Off". Leave it off if you do not want to use Time Machine.  If by some chance Time Machine is "On", then turn it "Off"

  • [JRockit] WARNING: could not open Unknown thread system flavour for reading

    [JRockit] WARNING: could not open Unknown thread system flavour for reading, per-thread CPU usage can't be measured.
    What are the reason of this warning?
    Can I ignore this warning?
    My system is: SLES9 SP3
    (2.6.5-7.276.PTF.196309.1-bigsmp)
    Pagesize = 1 075 080 972

    Which version of JRockit (java -version) ? Do you have LD_ASSUME_KERNEL set?
    /Staffan

  • [BUG] Exporting to xls and xlsx produces empty file

    When I'm viewing a table with data, and in Actions choose "Export...", turn off "Export DDL", choose "xls" for format, everything else is on default, and either leave empty or enter same name for both Query and Data worksheet names, and specify filter query - export produces empty xls/xlsx file. Only when one explicitly enters different worksheet names does valid non-empty excel workbook get generated with two differently named worksheets.
    Either validation should be added for worksheet names, or generating them automatically on export should be supported.
    I'm using Oracle SQL Developer 3.1.07.
    Kind regards,
    Stevo.

    Hi Stevo,
    Really appreciate you reporting this. There was an earlier, somewhat similar thread on this issue that we blamed on export file size:
    Sql Developer 3.1 - Exporting a result set in xls generates and empty file
    But you have discovered an important variation that explains it for small export file sizes also. Here is what I verified on 3.1.07.42:
    1. Normally if the worksheet names are left untouched (empty), then the names default to Export Worksheet and SQL
    2. If the name settings in Tools|Preferences|Database|Utilities|Export|Excel Format are null (empty), there is no problem
    3. If the name settings are intentionally changed to a single blank character, then the problem you describe occurs.
    So, you may wish to go to the preference settings and intentionally Backspace over each to null it out, then click OK.
    In the case of intentionally setting both worksheet names, data and query, to the same non-null value, that is also a problem.
    Regards,
    Gary
    SQL Developer Team
    Edited by: Gary Graham on Apr 17, 2012 11:55 AM
    Logged a bug for this:
    Bug 13971991 - FORUM: EXCEL FILE EMPTY IF DATA AND QUERY WORKSHEETS ARE THE SAME AND NON-NULL
    Edited by: Gary Graham on May 25, 2012 2:00 PM
    Notification received: fixed for 3.2

Maybe you are looking for

  • How do I use SQL statements to perform calculations with form fields????

    Please help!!! I don't know how to use a SQL statement within my APEX form...... My form is below. The user will enter the values in the form. Click on Submit. Then we need to run a SQL select statement with those values. Our form looks like this: St

  • 8.1.6 JDBC XA on 8.1.5 server can't find JDBC_XA package

    I'm using Oracle's 8.1.6 XADataSource. I'm enlisting the XAResource associated with an XAConnection with my JTA transaction manager. I'm hitting an 8.1.5 RDBMS server. Apparently, I'm missing the PL/SQL package JAVA_XA. Can I get a .sql for it and lo

  • SAve output in html automatically.

    Hi Freinds! I need to save the out of my report into html automatically. I have a report which shows the pro-rate factor for a given period and delivers the output, i have an include program added to it which automates the process to directly save th

  • How to print activities together with bar chart

    Hi, Anyone can advise how to print out an activities together with bar chart. When you try to print, an insufficient bar chart come out. Why? Thank you

  • Sql*plus hiding username and password

    Hi All, I was wondering if there is a way that I can avoid having to specify username and password when I execute sqlplus and sqlldr on Unix systems. I know that If I don't specify a username or password these programs will prompt for one. That is fi