Use POI to create a simple Myxls.xls fileThe usual package is org.apache.poi.hssf.usermodel.*;Example:Import java.io.*;Import org.apache.poi.hssf.usermodel.*;public class Zoomsheet {Public Zoomsheet () {}public static void Main (String args[])Throws IOException {Hssfworkbook wb = new Hssfworkbook ();Hssfsheet Sheet1 = wb.createsheet ("new sheet");FileOutputStream fileout = new FileOutputStream ("Workbook.xls");Wb.write (fileout);Fileout.close ();}}Cla
Java uses POI to import data from a database into Excel
Effect:
Use the first POI package into the project path, note that only need to import POI package can be downloaded after three jar package
Core code:
Connection database: Dbconnection.java
Copy Code code as follows:
Package org.xg.db;
Import java.sql.Connection;
Import Java.sql.Driver
Process Description:
The POI object includes a partial base color, which is used in the form
Hssfcellstyle Styleheader = Wb.createcellstyle ()//Create a cell's style
//Background color setting
style.setfillbackgroundcolor ( HSSFColor.GREEN.index);
Among them, HSSFColor.GREEN.index is the color that poi comes with.
Our idea is to modify POI's own color, configure its RGB to the color we want
Monitor reports export Excel summary based on POI
Poi manipulating Excel objects
HSSF: Manipulating Excel (. xls) format
XSSF: Manipulating Excel 2007 OOXML (. xlsx) format to manipulate Excel memory usage above HSSF
SXSSF: Support from POI3.8 Beta3, based on XSSF, low memory footprint.
1. Principle of realization
Based on the Excel configuration template for report export, to achieve the export of Excel
Exporting data through Excel has become a basic feature of various web sites, and below is a detailed introduction to how to export Excel files using the Poi.jar method. The steps are as follows:1, create a website, below I create a site called test, and then put the POI jar package into the Lib folder. I am here to download the link poi-2.5.1.jar.The structure directory is as follows:2. Then we can create
Don't talk nonsense, post codeIntroduction Rack Pack: Poi-3.12-20150511.jar Poi-ooxml-3.12-20150511.jarPipe network can be downloadedTry{flogicdatasetJava Apache POI export Excel
Java POI Implementation inserts a picture into ExcelTags: javapoiexcel2014-03-05 08:59 9103 People read Comments (4) favorite reports Classification:"Java Development"-----JavascoreCopyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.Doing web development inevitably involves dealing with Excel. Boss, give me a job today.-Export Excel. Start to think is pretty simple, nothing is to find, build ex
Export the processed webpage or background data to word through POI. The open/save dialog box is displayed in the export.
Import java. Io .*;
Import java. util .*;
Import org. Apache. Poi. poifs. filesystem .*;
Import org. Apache. Poi. util. littleendian;
Public class wordtest {
Public wordtest (){
}
Public static Boolean writewordfile (string path, string conte
When you use poi to generate an Excel file with a large amount of data, there are several problems:
1. Currently, office2003 excle supports a maximum of 65536 lines per sheet. When the data exceeds 65536 lines, an exception is reported.
2. If there are about 17 columns and about rows of data, an OOM error will occur.
Exception in thread "15124183 @ qtp-16902686-1" Java. Lang. outofmemoryerror: Java heap SpaceException in thread "thread-13" Java. Lang
Previous versions of POI do not support processing large amounts of data. If there is too much data, an OOM error is often reported. Sometimes the JVM size adjustment is not very good. Region format.
Poi of version 3.8 exports data to excel. Generally, only hssfworkbook andSxssfworkbook and hssfworkbook are used to process a small amount of data, while sxssfworkbook is used to process a large amount of dat
Because poi is used in the work process, problems encountered during use and major poi classes are recorded.
Common poi classes include hssfworkbook, hssfsheet, hssfrow, and hssfcell.
Hssfworkbook: as its name implies, it is a workbook class.
Hssfsheet: a tab class.
Hssfrow: it is a row class.
Hssfcell: column Class.
The operation sequence is hssfwork
use poi to read The data instances of version and above : Publiclist Test instance: @Test publicvoidtestreadexcel () { try{List use poi to read An instance of the 2003 version of Excel data Publiclist The test data is the same as before: Reference Articles ; http://www.cnblogs.com/hongten/p/java_poi_excel_xls_xlsx.html Work history: Import data from Excel using PO
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 ....
Jar:poi-3.12.jar
Apache POI is an open source Java project that reads and writes Microsoft OLE2 component documents such as Excel, Word, and so on. Currently the POI has a ruby version.Structure:
HSSF-provides the ability to read and write Microsoft Excel xls format files.
XSSF-provides the ability to read and write Microsoft Excel OOXML xlsx format files.
HWPF-provides the ability to read and write Microsoft Wo
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.