Java POI read Excel file essay

Source: Internet
Author: User

  1. Requirement: The most recent project needs to move the app's upload menu function to the PC side to achieve, the main difficulty is the image of the bulk import, because the framework is the company's own development, I really dare not compliment, upload files I use JS to the server, in the background to read ....
    Why upload to the server, because now the security of the browser is improved, input file cannot get the true absolute address ....
  2. Jar:poi-3.12.jar Poi-ooxml-3.12.jar Poi-ooxml-schemas-3.8-20120326.jar Xmlbeans-2.3.0.jar No Use the same version because there were some in the project before, I'm lazy, It's a direct, non-conflict use.
  3. Note: Reading Excel needs to differentiate between 07 and 07 versions, here I only write above 07 (including 07)
  4. Code:
    FileInputStream ins =NewFileInputStream (FilePath); Wookbook=Newxssfworkbook (INS);            Ins.close (); List<XSSFPictureData> pictures =wookbook.getallpictures ();  for(inti= 0; I < pictures.size (); i++) {Xssfpicturedata PictureData=Pictures.get (i); byte[] data =Picturedata.getdata (); String ext=picturedata.suggestfileextension (); FileOutputStream out=NewFileOutputStream ("C:\\users\\administrator\\desktop\\imanger\\pict" +i+ ".") +ext);                Out.write (data);            Out.close (); }

  5. Summary: The picture in the Exel, not the elements in the table, can be understood as floating on the table, cannot be fixed in the table

Java POI read Excel file essay

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.