对POI开源库excel大概泛(overview)了解(1)

target:learning the APi of .xlsx generation and .xlsx data outputting etc

component APIs
OverView
Excel() (SS=HSSF+XSSF+SXSSF)

1:definition:

HSSF is the POI Project‘s pure Java implementation of the Excel ‘97(-2007) file format
XSSF is the POI Project‘s pure Java implementation of the Excel 2007 OOXML(.xlsx) file format

2:functions:

HSSF and XSSF provides ways to read spreadsheets create,modify,read and write XLS
spreadsheet.they provide:
low level structures for those with special needs
an eventmodel api for efficient read-only access
a full usermodel api for creating, reading and modifying XLS files

3:Other
(1)SS Usermodel for HSSF and XSSF support, seeing the ss usermodel converting guide

(2)An alrernate way of generating a spreadsheet is via the Cocoon seralizer

(3)merely reading spreadsheet data, then use the eventmodel api in either the org.apache.poi.hssf.eventusermodel package
or the org.apache.poi.xssf.eventusermodel package, depending on your file format.

(4)If you‘re modifying spreadsheet data then use the usermodel api. You can also generate spreadsheets this way.

SXSSF:
origin:Since 3.8-beta3,POI provides a low-memory footprint SXSSF API built on top of XSSF.

快速指导:

How to use The HSSF APi:
Capabilities:
HSSF
(1)
allows numeric,string,date or formula cell values to be written to or read
from an XLS files.
(2)
supports row and aolumn sizing,and cell styling(bold,italics etc)
supports for both built-in and user defined data formats
(3)
is available that event-based(only read)APi for reading XLS files.

General use
User API(HSSF and XSSF)
Writing a new file
(1)The high level Api(package:org.apache.poi.ss.usermodel)is what most people should
use,usage is very simple.
first step(create Workbooks)
one way:creating an instance of org.apache.poi.ss.usermodel.Workbook
two way:create a concrete class directly (org.apache.poi.hssf.usermodel.
HSSFWorkbook or org.apache.poi.xssf.usermodel.XSSFWorkbook)
three way:use the handy factory class org.apache.poi.ss.usermodel.WorkbookFactory.
second step(create sheet):
(1)Sheets are created by calling createSheet() from an existing instance of Workbook
(2)the created sheet is automatically added in sequence to the workbook.
(3)you set the name associated with a sheet by calling Workbook.setSheetName(sheetindex,"SheetName",encoding).
(4)For HSSF, the name may be in 8bit format (HSSFWorkbook.ENCODING_COMPRESSED_UNICODE) or Unicode (HSSFWorkbook.ENCODING_UTF_16). Default encoding for
HSSF is 8bit per char. For XSSF, the name is automatically handled as unicode.
third step(create Row)
(1)Row are created by calling createRow(rowNumber)from an existing instance of Sheet
setRowHeight(height) on the row object
The height must be given in twips, or 1/20th of a point. If you prefer, there is also a setRowHeightInPoints method.
forth step(create Cells)
(1)Cells are created by calling createCell(column,type)from an existing Row.
Cells should have their cell type set to either Cell.CELL_TYPE_NUMERIC or Cell.CELL_TYPE_STRING
Cells must also have a value set. Set the value by calling setCellValue with either a String or double as a parameter.
you must call setColumnWidth(colindex, width) (use units of 1/256th of a character) on the Sheet object.
fifth step(create Styles)
Cells are styled with CellStyle objects which in turn contain a reference to an Font object
calling createCellStyle() and createFont()
To set a font for an CellStyle call setFont(fontobj).

Once you have generated your workbook, you can write it out by calling write(outputStream)
passing it an OutputStream (for instance, a FileOutputStream or ServletOutputStream).

组件映射:

Component Map

The Apache POI distribution consists of support for many document file formats. This support is provided in several Jar files. Not all of the Jars are needed for every format. The following tables show the relationships between POI components, Maven repository tags, and the project‘s Jar files.

Component Application type Maven artifactId Notes
POIFS OLE2 Filesystem poi Required to work with OLE2 / POIFS based files
HPSF OLE2 Property Sets poi  
HSSF Excel XLS poi For HSSF only, if common SS is needed see below
HSLF PowerPoint PPT poi-scratchpad  
HWPF Word DOC poi-scratchpad  
HDGF Visio VSD poi-scratchpad  
HPBF Publisher PUB poi-scratchpad  
HSMF Outlook MSG poi-scratchpad  
DDF Escher common drawings poi  
HWMF WMF drawings poi-scratchpad  
OpenXML4J OOXML poi-ooxml plus either poi-ooxml-schemasor
ooxml-schemas and ooxml-security
See notes below for differences between these options
XSSF Excel XLSX poi-ooxml  
XSLF PowerPoint PPTX poi-ooxml  
XWPF Word DOCX poi-ooxml  
XDGF Visio VSDX poi-ooxml  
Common SL PowerPoint PPT and PPTX poi-scratchpad and poi-ooxml SL code is in the core POI jar, but implementations are in poi-scratchpad and poi-ooxml.
Common SS Excel XLS and XLSX poi-ooxml WorkbookFactory and friends all require poi-ooxml, not just core poi
时间: 2024-10-16 23:15:54

对POI开源库excel大概泛(overview)了解(1)的相关文章

android开源库发布到jcenter图文详解与填坑

相信很多人都用过开源项目,特别是android studio普及以后,使用开源库更方便简单.而如何上传开源库到jcenter供大家方便使用,虽然网上也有教程,但还是遇坑了,最后总结一下,希望可以帮助大家. [csdn地址: http://blog.csdn.net/zhangke3016/article/details/52075159] [本文简书地址: http://www.jianshu.com/p/0acf9e05b27e]同步更新 AndroidStudio是从Maven Reposi

二维码扫描开源库ZXing定制化

(抱歉文章还在修改但是不小心发布了= =) 最近在用ZXing这个开源库做二维码的扫描模块,开发过程的一些代码修改和裁剪的经验和大家分享一下. 我的代码库: https://github.com/SickWorm/ZXingDialog 代码没有在github维护,所以没有log.但是所有修改的地方我都加上了“@ch”的注释,以方便定位 官方源码: https://github.com/zxing/zxing 实现功能: 1.功能裁剪(只保留QRCode二维码扫描功能,去掉条形码等其他码扫描功能

Android开源库与设计模式开源组SAOS建立

Android开源库与设计模式开源组建立 简介 在2014年年底突然参与了CSDN的博客之星评选,看着自己的博客水平实在太低,于是就想一定得写一些跟别人不太一样的博客出来.经过自己的一番思考,觉得在Android开源库的深入实现上并没有什么太多的资料,或者只是大概讲述了一些基本原理.这样我觉得是不够的,很多事情你没有自己去经历你不会有很深的认识,或者你根本不知道原来它会出现这样的问题.于是我就想我没通过学习轮子制造过程来更加深入的学习,这样不仅能够了解那些知名的开源库,也能够从实战的角度学习开源

android事件总线(eventbus)开源库发布

 AndroidEventBus 如果你不知道事件总线是什么,那么没有关系,下面我们先来看这么一个场景: 你是否在开发的过程中遇到过想在Activity-B中回调Activity-A中的某个函数,但Activity又不能手动创建对象来设置一个Listener什么的? 你是否想在某个Service中想更新Activity或者Fragment中的界面? 等等之类的组件之间的交互问题-- 一经思考,你会发现Android中的Activity, Fragment, Service之间的交互是比较麻烦的,

Android6.0运行时权限(基于RxPermission开源库)

版权声明:本文为博主原创文章,未经博主允许不得转载. 前言 在6.0以前的系统,都是权限一刀切的处理方式,只要用户安装,Manifest申请的权限都会被赋予,并且安装后权限也撤销不了. Android 6.0 采用新的权限模型,只有在需要权限的时候,才告知用户是否授权:是在runtime时候授权,而不是在原来安装的时候 ,同时默认情况下每次在运行时打开页面时候,需要先检查是否有所需要的权限申请. 判断是否是需要运行时权限的标记就是targetSDKVersion. 当targetSDKVersi

各种实用的 PHP 开源库推荐【转】

转自: https://my.oschina.net/editorial-story/blog/882780 PHP 是一种通用开源脚本语言.语法吸收了 C 语言.Java 和 Perl 的特点,利于学习,使用广泛,主要适用于 Web 开发领域,是大多数后端开发者的首选.PHP 作为最受欢迎的编程语言之一,经常出现在各大语言之战中,但到底谁是最好的编程语言呢?这不是文章要讨论的内容:) 本文从众多 PHP 开源库中选出了几款实用有趣的工具,希望对你的学习工作有帮助. 1.PHP 日志工具 Mon

<转>iOS第三方开源库的吐槽和备忘

iOS第三方开源库的吐槽和备忘 做iOS开发总会接触到一些第三方库,这里整理一下,做一些吐槽. 目前比较活跃的社区仍旧是Github,除此以外也有一些不错的库散落在Google Code.SourceForge等地方.由于Github社区太过主流,这里主要介绍一下Github里面流行的iOS库. 首先整理了一份Github上排名靠前的iOS库(大概600个repos) 除了逛一下每日/每月流行之外,也可以到这里来看一下整个iOS Repos的排名. 下面是一些比较流行的第三方库: HTTP 相比

关于Merge的整理--AndroidScreenSlidePager开源库中用到的

在做AndroidScreenSlidePager开源库练习demo的时候,发现布局文件使用的是<merge>标签而不是<FrameLayout>标签.作者给出的说法是:CirclePageIndicator and ViewPager shoud be used as child views of a Framelayout. But here we used merge instead, because the root view in any activity is a Fr

iOS第三方开源库的吐槽和备忘(转)

原文:http://www.cocoachina.com/industry/20140123/7746.html 做iOS开发总会接触到一些第三方库,这里整理一下,做一些吐槽. 目前比较活跃的社区仍旧是Github,除此以外也有一些不错的库散落在Google Code.SourceForge等地方.由于Github社区太过主流,这里主要介绍一下Github里面流行的iOS库. 首先整理了一份Github上排名靠前的iOS库(大概600个repos) 除了逛一下每日/每月流行之外,也可以到这里来看