zoukankan      html  css  js  c++  java
  • execel 的java库

    http://fastexcel.sourceforge.net/

    Fast Excel-Yet Another Excel Read/Write Component.SourceForge.net Logo
    Abstract

    FastExcel is a pure java excel read/write component.It's FAST and TINY. We provide:

    • Reading and Writing support for Excel '97(-2003) (BIFF8) file format.
    • Low level structures for BIFF(Binary Interchange File Format).
    • Low level structures for compound document file format (also known as "OLE2 storage file format" or "Microsoft Office compatible storage file format").
    • API for creating, reading excel file.

    FastExcel is content-based,that means we just care about the content of excel. So FastExcel just read the cell string and other important information,Some Properities like color,font are not supported.Because we don't need to read,parse,store these additional information so FastExcel just need little memory.

    Table of ContentsAbout FastExcel

    FastExcel is a pure java excel read/write component.We provide reading and writing Excel[1]'97(-2003) (BIFF8[2]) file format and a low level API for compound document file format[3][4].It license under the term of LGPL. For more information contract

    How it works

    A workbook document with several sheets (BIFF5-BIFF8) is usually stored using the compound document file format (also known as "OLE2 storage file format" or "Microsoft Office compatible storage file format"). It contains several streams for different types of data.Depending on the document type, different names are used for the stream(s) they contain. BIFF5-BIFF8 workbook documents that are stored in a compound document file contain a stream in the root storage called the Workbook Stream. The name of this stream in the compound document file is "Book" for BIFF5 workbooks, and "Workbook" for BIFF8 workbooks.If a BIFF5-BIFF8 workbook document is stored as stream file, the entire stream is called the Workbook Stream. In BIFF5-BIFF8 Workbook Streams, the Workbook Globals Substream ist the leading part of the stream. It is followed by all Sheet Substreams in order of the sheets that are in the document. Common structure of a BIFF5-BIFF8 Workbook Stream:

    • Workbook Globals Substream (required)
    • First Sheet Substream (required)
    • Second Sheet Substream (optional)
    • Third Sheet Substream (optional)

    Most of the Excel streams or substreams are divided into records. Each record contains specific data for the various contents or features in a document. It consists of a header specifying the record type and size, followed by the record data. Common structure of a BIFF record:

    Offset Size Contents 0 2 Identifier 2 2 Size of the following data (sz) 4 sz Record data

    To read excel file.FastExcel parse these record and build a inner struct of excel file.The Record Parsers:

    • BOFParser
    • EOFParser
    • BoundSheetParser
    • SSTParser
    • IndexParser
    • DimensionParser
    • RowParser
    • LabelSSTParser
    • RKParser
    • MulRKParser
    • LabelParser
    • BoolerrParser
    • XFParser
    • FormatParser
    • DateModeParser
    • StyleParser
    • MulBlankParser
    • NumberParser
    • RStringParser
    Example

    public void testDump() throws ParserException, ReadException {
    Workbook workBook;
    workBook = FastExcel.createReadableWorkbook(new File("d:/write.xls"));
    workBook.open();
    Sheet s;
    s = workBook.getSheet(0);
    System.out.println("SHEET:"+s);
    for (int i = s.getFirstRow(); i <= s.getLastRow(); i++) {
    System.out.print(i+"#");
    for (int j = s.getFirstColumn(); j <=s.getLastColumn(); j++) {
    System.out.print(","+s.getCell(i, j));
    }
    System.out.println();
    }
    workBook.close();
    }Download

    click here

    References
    1. http://en.wikipedia.org/wiki/Microsoft_Excel.
    2. http://sc.openoffice.org/excelfileformat.pdf
    3. http://sc.openoffice.org/compdocfileformat.pdf
    4. http://blog.csdn.net/liangjingbo/archive/2008/09/03/2874959.aspx
  • 相关阅读:
    Multi-Tenancy模式,基础服务大规模扩张的时候,是应该推进了。
    Python中的tuple
    Create and Call HttpHandler in SharePoint
    各种数据库(oracle、mysql、sqlserver等)在Spring中数据源的配置和JDBC驱动包
    BNU 34986 Football on Table
    Effective JavaScript Item 31 优先使用Object.getPrototypeOf,而不是__proto__
    POJ 3080 Blue Jeans (后缀数组)
    HDU 2586 How far away ?(LCA模板 近期公共祖先啊)
    自己主动化的在程序中显示SVN版本号
    在Mac OS X中部署Tomcat的经验
  • 原文地址:https://www.cnblogs.com/danghuijian/p/4400796.html
Copyright © 2011-2022 走看看