ファイルが1904年始まりの設定かどうか。
@param sheet 判定対象のシート。
@return true:1904年始まり
@throws IllegalArgumentException  {@literal sheet == null.}
3077
public static boolean isDateStart1904(final Sheet sheet) {
        ArgUtils.notNull(sheet, "sheet");
        
        if(sheet instanceof SheetImpl) {
            try {
                Field field = SheetImpl.class.getDeclaredField("nineteenFour");
                field.setAccessible(true);
                
                boolean value = field.getBoolean(sheet);
                return value;
                
            } catch (NoSuchFieldException | SecurityException e) {
                logger.warn("fail access field SheetImpl#nineteenFour", e);
                return false;
                
            } catch (IllegalArgumentException | IllegalAccessException e) {
                logger.warn("fail invoke field SheetImpl#nineteenFour", e);
                return false;
            }
            
        }
        
        return false;
    }
216368
public static List<Map<String, Object>> handleSheetToMapList(Sheet sheet) throws ReadExcelException {
        List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>();
        // 得到Sheet里的列名
        List<String> columnList = ReadExcelUtils.getColumnOfSheet(sheet);
        for (int i = 2; i < sheet.getLastRowNum() + 1; i++) {
            Map<String, Object> beanMap = new HashMap<String, Object>();
            // 得到行
            Row row = sheet.getRow(i);
            // 遍历列
            for (int j = 0; j < row.getLastCellNum(); j++) {
                // 获取单元格
                Cell cell = row.getCell(j);
                if (cell != null) {
                    // 单元格对应列名
                    String key = columnList.get(j);
                    // 单元格对应值
                    Object value = ReadExcelUtils.getCellValue(cell.getCellType(), cell);
                    // key-value pairs 放入map
                    if (value != null) {
                        beanMap.put(key, value);
                    }
                }
            }
            // 将每个beanMap放入List中
            if (!beanMap.isEmpty()) {
                listMap.add(beanMap);
            }
        }
        return listMap;
    }
979237
private void computeSheet(Map<TileRef, ColorRgba> colors, Integer sheet)
    {
        final SpriteTiled tiles = map.getSheet(sheet);
        final ImageBuffer tilesSurface = tiles.getSurface();
        final int tw = map.getTileWidth();
        final int th = map.getTileHeight();

        int number = 0;
        for (int i = 0; i < tilesSurface.getWidth(); i += tw)
        {
            for (int j = 0; j < tilesSurface.getHeight(); j += th)
            {
                final int h = number * tw % tiles.getWidth();
                final int v = number / tiles.getTilesHorizontal() * th;
                final ColorRgba color = UtilColor.getWeightedColor(tilesSurface, h, v, tw, th);

                if (!(NO_TILE.equals(color) || color.getAlpha() == 0))
                {
                    colors.put(new TileRef(sheet, number), color);
                }
                number++;
            }
        }
    }
572957
public static void fixChartSheetNameRef(Sheet sheet, String oldSheetName, String newSheetName) {
        val drawing = sheet.getDrawingPatriarch();
        if (!(drawing instanceof XSSFDrawing)) return;

        for (val chart : ((XSSFDrawing) drawing).getCharts()) {
            for (val barChart : chart.getCTChart().getPlotArea().getBarChartList()) {
                for (val ser : barChart.getSerList()) {
                    val val = ser.getVal();
                    if (val == null) continue;

                    val numRef = val.getNumRef();
                    if (numRef == null) continue;

                    val f = numRef.getF();
                    if (f == null) continue;

                    if (f.contains(oldSheetName)) {
                        numRef.setF(f.replace(oldSheetName, newSheetName));
                    }
                }
            }
        }
    }
956387
public static void removeOtherSheets(Sheet sheet) {
        val wb = sheet.getWorkbook();

        List<String> deletedNames = Lists.newArrayList();
        for (int i = 0; i < wb.getNumberOfSheets(); ++i) {
            val sheetName = wb.getSheetName(i);
            if (!sheetName.equals(sheet.getSheetName())) {
                deletedNames.add(sheetName);
            }
        }

        deletedNames.forEach(x -> wb.removeSheetAt(wb.getSheetIndex(x)));
    }
1274079
private static long getElapsedZeroTime(final Date date, final boolean isStartDate1904) {

        if(isStartDate1904) {
            return ExcelDateUtils.getExcelZeroDateTime(isStartDate1904);
        } else {
            if(ExcelDateUtils.MILLISECONDS_19000301 <= date.getTime()) {
                // 1900-03-01以降
                return ExcelDateUtils.MILLISECONDS_19000101 - TimeUnit.DAYS.toMillis(2);
            } else {
                return ExcelDateUtils.MILLISECONDS_19000101 - TimeUnit.DAYS.toMillis(1);
            }
        }

    }
221908
public static int getColumns(final Sheet sheet) {
        ArgUtils.notNull(sheet, "sheet");

        int minRowIndex = sheet.getFirstRowNum();
        int maxRowIndex = sheet.getLastRowNum();
        int maxColumnsIndex = 0;
        for(int i = minRowIndex; i <= maxRowIndex; i++) {
            final Row row = sheet.getRow(i);
            if(row == null) {
                continue;
            }

            final int column = row.getLastCellNum();
            if(column > maxColumnsIndex) {
                maxColumnsIndex = column;
            }
        }

        return maxColumnsIndex;
    }
440992
public static void setupExplicitListConstaint(final Sheet sheet, final String[] constraints,
            final Point startPosition, final Point endPosition) {

        ArgUtils.notNull(sheet, "sheet");
        ArgUtils.notEmpty(constraints, "constraints");
        ArgUtils.notNull(startPosition, "startPosition");
        ArgUtils.notNull(endPosition, "endPosition");

        final DataValidationHelper helper = sheet.getDataValidationHelper();
        final DataValidationConstraint constraint = helper.createExplicitListConstraint(constraints);
        setupConstaint(sheet, constraint, startPosition, endPosition);

    }
439962
public static int countNullCell(String preRef, String ref) {
		// excel2007最大行数是1048576，最大列数是16384，最后一列列名是XFD
		// 数字代表列，去掉列信息
		String preXfd = StrUtil.nullToDefault(preRef, "@").replaceAll("\\d+", "");
		String xfd = StrUtil.nullToDefault(ref, "@").replaceAll("\\d+", "");

		// A表示65，@表示64，如果A算作1，那@代表0
		// 填充最大位数3
		preXfd = StrUtil.fillBefore(preXfd, CELL_FILL_CHAR, MAX_CELL_BIT);
		xfd = StrUtil.fillBefore(xfd, CELL_FILL_CHAR, MAX_CELL_BIT);

		char[] preLetter = preXfd.toCharArray();
		char[] letter = xfd.toCharArray();
		// 用字母表示则最多三位，每26个字母进一位
		int res = (letter[0] - preLetter[0]) * 26 * 26 + (letter[1] - preLetter[1]) * 26 + (letter[2] - preLetter[2]);
		return res - 1;
	}
557040
@Override
    public XlsxWorksheet getSheet(int i)
    {
        XlsxWorksheet ret = null;
        if(sheets != null)
        {
            Sheet sheet = (Sheet)sheets.get(i);
            if(sheet != null)
                ret = getSheet(sheet.getName());
        }
        return ret;
    }
1018963
private void checkJodaSetYear() {
        int COUNT = COUNT_FAST;
        // Is it fair to use only MutableDateTime here? You decide.
        MutableDateTime dt = new MutableDateTime(GJChronology.getInstance());
        for (int i = 0; i < AVERAGE; i++) {
            start("Joda", "setYear");
            for (int j = 0; j < COUNT; j++) {
                dt.setYear(1972);
                if (dt == null) {System.out.println("Anti optimise");}
            }
            end(COUNT);
        }
    }
1179169
public String getSheetName() {
		if (this.boundSheetRecords.size() > this.sheetIndex) {
			return this.boundSheetRecords.get(this.sheetIndex > -1 ? this.sheetIndex : this.curSheetIndex).getSheetname();
		}
		return null;
	}
340648
public static boolean removeMergedRange(final Sheet sheet, final CellRangeAddress mergedRange) {
        ArgUtils.notNull(sheet, "sheet");
        ArgUtils.notNull(mergedRange, "mergedRange");

        final String mergedAddress = mergedRange.formatAsString(sheet.getSheetName(), true);

        final int num = sheet.getNumMergedRegions();
        for(int i=0; i < num; i ++) {
            final CellRangeAddress range = sheet.getMergedRegion(i);
            final String rangeAddress = range.formatAsString(sheet.getSheetName(), true);
            if(rangeAddress.equals(mergedAddress)) {
                sheet.removeMergedRegion(i);
                return true;
            }
        }

        return false;
    }
126922
public static Cell findCell(Sheet sheet, String cellRefValue) {
        val cellRef = new CellReference(cellRefValue);
        val row = sheet.getRow(cellRef.getRow());
        if (row == null) {
            log.warn("unable to find row for " + cellRefValue);
            return null;
        }

        val cell = row.getCell(cellRef.getCol());
        if (cell == null) {
            log.warn("unable to find cell for " + cellRefValue);
        }

        return cell;
    }
455051
public boolean check() throws Exception {
        Document doc = Document.loadDocument(in);
        Meta metadata = doc.getOfficeMetadata();
        if (metadata != null) {
            title = metadata.getTitle();
            subject = metadata.getSubject();
            description = metadata.getDescription();
            initialCreator = metadata.getInitialCreator();
            creator = metadata.getCreator();
            language = metadata.getLanguage();
            editingCycles = metadata.getEditingCycles();
            creationDate = metadata.getCreationDate();
            modificationDate = metadata.getDcdate();
            if (metadata.getEditingDuration() != null) {
                Duration duration = metadata.getEditingDuration().getValue();
                editingTime = duration.getTimeInMillis(Calendar.getInstance()) / 1000;
            }
            printDate = metadata.getPrintDate();
            printedBy = metadata.getPrintedBy();
            if (metadata.getKeywords() != null) {
                keywords.addAll(metadata.getKeywords());
            }
            generator = metadata.getGenerator();
            if (metadata.getDocumentStatistic() != null) {
                pages = metadata.getDocumentStatistic().getPageCount();
            }
        }

        // document specific meta
        if (doc instanceof PresentationDocument) {
            PresentationDocument presentation = (PresentationDocument) doc;
            pages = presentation.getSlideCount();
        }

        if (doc instanceof SpreadsheetDocument) {
            SpreadsheetDocument spreadsheet = (SpreadsheetDocument) doc;
            sheets = spreadsheet.getSheetCount();
        }

        return true;
    }
492991
public static int shiftRows(Sheet sheet, List<?> list, int templateRowNum) {
        val itemSize = list == null ? 0 : list.size();
        return shiftRows(sheet, itemSize, templateRowNum);
    }
473160
public static Object getCellValue(HSSFCell cell) {
    if ((cell == null)) return null;
    switch (cell.getCellTypeEnum()) {
    case BLANK:
      return null;
    case STRING:
      return Strings.trim(cell.getRichStringCellValue().getString());
    case NUMERIC:
      if (DateUtil.isCellDateFormatted(cell)) {
        return cell.getDateCellValue();
      } else {
        return numberFormat.format(cell.getNumericCellValue());
      }
    case BOOLEAN:
      return (cell.getBooleanCellValue()) ? Boolean.TRUE : Boolean.FALSE;
    default:
      // cannot handle HSSFCell.CELL_TYPE_ERROR,HSSFCell.CELL_TYPE_FORMULA
      return null;
    }
  }