POI,针对不同的Excel版本,使用enum SpreadsheetVersion定义了各自的约束。
见,poi源码:
package org.apache.poi.ss;
import org.apache.poi.ss.util.CellReference;
/**
* This enum allows spreadsheets from multiple Excel versions to be handled by the common code.
* <p>Properties of this enum correspond to attributes of the <i>spreadsheet</i> that are easily
* discernable to the user. It is not intended to deal with low-level issues like file formats.
*/
public enum SpreadsheetVersion {
/**
* Excel97 format aka BIFF8
* <ul>
* <li>允许的最大列数: 256 (2^8)</li>
* <li>允许的最大行: 64k (2^16)</li>
* <li>允许的公式个数: 30</li>
* <li>条件格式化单元格的个数: 3</li>
* <li>样式个数: 4000</li>
* <li>单元格内容的最大长度: 32767</li>
* </ul>
*/
EXCEL97(0x10000, 0x0100, 30, 3, 4000, 32767),
/**
* Excel2007
*
* <ul>
* <li><span style="font-family: Arial, Helvetica, sans-serif;">允许的最大列数:</span>16K (2^14)</li>
* <li>允许的最大行数: 1M (2^20)</li>
* <li>允许的公式个数: 255</li>
* <li>条件格式化单元格的个数:不受限
* (受限于Excel的可用内存)</li>
* <li>样式的个数: 64000</li>
* <li>单元格内容的最大长度: 32767</li>
* <ul>
*/
EXCEL2007(0x100000, 0x4000, 255, Integer.MAX_VALUE, 64000, 32767);
private final int _maxRows;
private final int _maxColumns;
private final int _maxFunctionArgs;
private final int _maxCondFormats;
private final int _maxCellStyles;
private final int _maxTextLength;
// .......其他代码.......
}