In the management system, often used to download files, especially Excel report creation and download, the following to a simple demonstration, STRUTS2 implementation of the Excel file download function.
Because this experiment is to dynamically create Excel files, you need some jars:
Java read-write Excel package is Apache POI (Project address: http://poi.apache.org/), so you need to obtain the POI jar pac
Just started using new Hssfworkbook (Excelfile) to read workbook, no problem with the previous version of Excel2003 (including 2003), FileInputStream However, the following exception occurred while reading Excel2007:Org.apache.poi.poifs.filesystem.OfficeXmlFileException:The supplied data appears to being in the Office 2007+ XML. You are calling the "part of POI" deals with OLE2 Office Documents. You are need to call a different part of the
Process: (similar to JXL, just reading logic a little different)
The two main differences with JXL:
1, read and write a slightly different way:
(1) POI read:
[Java] view plain copy print?
(2) JXL read:
[Java] view plain copy print?
2. The data types are judged in a slightly different way:
(1) Personally feel that the data type processing, poi than JXL convenient and practical,
The JAVAWeb SSH framework exports EXCEL using POI, And the pop-up save box appears, javawebpoi
To import a package, simply paste the key code. JSP just needs to click an Action Link.
Poi pack I use: poi-3.11-20141221.jar
Valid for test:
Effect:
Action Code:
Private InputStream inputStream; // (get, set Method omitted) defines an input stream, used to catch th
, then there are totals do not say, with the total can be directly set up the formula, can also be calculated directly after the program, the latter is generally used to compare complex reports, you do not have to set the location of the merge in the POI, reduce In conjunction with this example, we calculate the average age and the sum of the scores. As follows:1 //Data Analysis Lines2 intDadarownum =Sheet.getlastrownum (); 3Xssfrow TotalRow =
To implement the POI export Excel shape as--A1 (LV1)----B1 (LV2)----B2 (LV2)------C1 (LV3)------C2 (LV3)----B3 (LV2)--A1 (LV1)I. Data fields that can be usedID (primary key), PID (parent account ID), name (name), level (current hierarchy)Two. Ideas:Define an empty list of accounts to hold an already sequenced account. Create an iterator to the parent node to isolate all of its child nodes, traverse the child nodes into the list of accounts, and call t
This blog is mainly about Java in the POI read Excel, and Excel version includes: 2003-2007 and 20,102 versions, that is, Excel suffix named: xls and xlsx.Read Excel and MySQL Related: Java POI Technology read Excel data to MySQLYou can also read and import excel in: Java's POI technology to learn how to write Excel informationImporting Excel using JXL technology
The previous version of POI does not support big data processing, and if too much data is often reported to oom errors, sometimes resizing the JVM is not a good result. 3.8 version of the POI new out Sxssfworkbook, can support the operation of large data volume, but only sxssfworkbook support. xlsx format, not supported in. xls format. 3.8 version of the POI expo
This chapter will guide you through the process of setting up Apache POI on Windows and Linux system-based settings. Apache poi can be easily installed and integrated, without any complicated setup process, through a few simple steps, the current Java environment, user management is required to install.System Requirements
Jdk
Java SE 2 JDK 1.5 or higher
Memory
1 GB R
. xls files support only 6w+ of data writes. xlsx files only support write-104w+ dataIn Java, the Jxl tool class can only manipulate. xls files and cannot manipulate the. xlsx fileThe POI tool class can support. xlsx file operations.Excel data reading and writing are correspondingly simple, there are a lot of code on the net, I would like to say here is how to write 100w+ data into Excel.In the POI, Xssfwor
At present, many Web sites provide a POI download interface, but generally need key to implement. However, each key (which is normally requested by the individual) has a daily quota of 1000, which is a drop in the bucket for the need to get a lot of poi data.
In view of the recent want to analyze the POI data, so the crawler is also more interested in
);// Write a fileFileOutputStream fileOut = new FileOutputStream ("ooxml-newlines.xlsx ");Wb. write (fileOut );FileOut. close ();
// Create an Excel fileWorkbook wb = new HSSFWorkbook (); // or new XSSFWorkbook ();// Create a workbookSheet sheet = wb. createSheet ();// Create a rowRow row = sheet. createRow (2 );// Create a cellCell cell = row. createCell (2 );// Set the value in the cell to use the \ n linefeed.Cell. setCellValue ("Use \ n with word
Have done many times to export Excel. Have encountered a problem, if the content contains a relatively long number, such as the order number "2546541656596", Excel will automatically become the scientific counting method ...Did not solve several times, and recently also exported Excel, determined to find a solutionIn Excel, the longer numbers are automatically turned into scientific notation unless we set the cell format to "text"Haha, seems to find the idea: Use the
First LectureAbout PoiApache POI is an open source library of the Apache Software Foundation, where POI provides APIs to Java programs to read and write to Microsoft Office format archives.1. Create a new workbook and name the workbookWorkbook wb=new// define a newer workbook fileoutputstream fileout= new FileOutputStream ("c:\\-out workbook with Poi"); Wb.write
How many times in the business system are exposed to excel parsing. Choosing Apache POI Under the Java development platform is a very sensible option, and POI provides a very sophisticated API to read or write to Microsoft Office Excel.At present, the imported data will be processed two times, we develop the model is to import the contents of Excel directly into the database corresponding to a data table, a
First of all to talk about what happened today, in the spirit of an Android heart I was assigned to the PB group, Cao Ying Han Ah! Well, what we're going to record and share today is that Java uses POI import to export data from Excel. Below the POI package of http://poi.apache.org/download.html, interested friends can also go to see the API. Let's share the two points that you should be aware of when doing
One: SceneUsing Word templates to implement dynamic word generationII: Basic Requirements1: Replace the contents of the text2: Replace the contents of the table (without dynamically generating the table)3: The replaced content should be the same format as before the replacement4: Easy to modify the template5: The effect is as follows:Template:Results:Three: POI analysisHow to use: directly read the Word file, replace the contents of the various parts
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.