向工作簿中写入beans，所有bean写在一个Sheet中,默认以bean中的所有属性作为标题且写入第0行，0-based。
日期格式采用默认类型。并输出到指定file中

@param file      指定Excel输出文件
@param excelType 输出Excel文件类型{@link #XLSX}或者{@link #XLS},此类型必须与file文件名后缀匹配
@param beans     指定写入的Beans(或者泛型为Map)
@throws WriteExcelException
354316
public static <T> void writeWorkBook(File file, int excelType, List<T> beans) throws WriteExcelException {
        WriteExcelUtils.writeWorkBook(file, excelType, beans, null);
    }
970663
private void writeBean(String currentIndent, String tagName, StringBuilder attrs, Class<?> propType, Bean value) throws IOException {
        if (value == null) {
            throw new IllegalArgumentException("Bean cannot be null");
        }
        output.append(currentIndent).append('<').append(tagName).append(attrs);
        if (value.getClass() != propType) {
            String typeStr = SerTypeMapper.encodeType(value.getClass(), settings, basePackage, knownTypes);
            appendAttribute(output, TYPE, typeStr);
        }
        if (willWriteBean(value)) {
            output.append('>').append(settings.getNewLine());
            writeBean(value, currentIndent + settings.getIndent());
            output.append(currentIndent).append('<').append('/').append(tagName).append('>').append(settings.getNewLine());
        } else {
            output.append('/').append('>').append(settings.getNewLine());
        }
    }
1073991
public static XLSReader readExcel(File file, Integer scale) throws ReadExcelException {
        POIFSFileSystem fs = null;
        XLSReader reader = null;
        try {
            fs = new POIFSFileSystem(file);
            reader = new XLSReader(fs, scale);
            reader.process();
        } catch (Exception e) {
            throw new ReadExcelException(e.getMessage());
        } finally {
            if (fs != null) {
                try {
                    fs.close();
                } catch (IOException e) {
                    throw new ReadExcelException(e.getMessage());
                }
            }
        }
        return reader;
    }
1145413
@Programmatic
    public Blob toExcel(final List<WorksheetContent> worksheetContents, final String fileName) {
        try {
            final File file = newExcelConverter().appendSheet(worksheetContents);
            return excelFileBlobConverter.toBlob(fileName, file);
        } catch (final IOException ex) {
            throw new ExcelService.Exception(ex);
        }
    }
313055
public void write(Bean bean, boolean rootType, OutputStream output) throws IOException {
        if (bean == null) {
            throw new NullPointerException("bean");
        }
        if (output == null) {
            throw new NullPointerException("output");
        }
        if (referencing) {
            if (!(bean instanceof ImmutableBean)) {
                throw new IllegalArgumentException(
                    "Referencing binary format can only write ImmutableBean instances: " + bean.getClass().getName());
            }
            new JodaBeanReferencingBinWriter(settings, output).write((ImmutableBean) bean);
        } else {
            new JodaBeanStandardBinWriter(settings, output).write(bean, rootType);
        }
    }
817458
public void fromXML(String file) throws DocumentException
    {
        SAXReader reader = new SAXReader();
        fromXML(reader.read(new StringReader(file)));
    }
1010753
public void writeToExcel(List<? extends Object> datas, boolean hasTitle,
                             String path) throws IOException {
        writeToExcel(datas, hasTitle, path, false);
    }
1052779
private void writePerData(T data) throws WriteExcelException {
        if (this.needInitSheet()) {
            this.initSheet();
        }
        //将data转换成Map数据结构
        Map<String, Object> mapBean = null;
        if (data instanceof Map) {
            mapBean = (Map<String, Object>) data;
        } else {
            mapBean = CommonUtils.toMap(data);
        }
        Row rowTemp = null;
        if (!this.isBlankLastRow || (this.isBlankLastRow && !this.isSkipBlankRow)) {
            //下移一行
            this.currentRowInSheet++;
            rowTemp = this.currentSheet.createRow(this.currentRowInSheet);
            if (this.defaultHeight > 0) {
                rowTemp.setHeightInPoints(this.defaultHeight);
            }
        } else {
            //上一行是空行,并且配置了需要跳过空行,即不需要写入空行
            rowTemp = this.lastRow;
        }
        boolean isBlankRow = !this.writePerRow(rowTemp, mapBean, data);
        if (!isBlankRow) {
            //非空行
            this.realRowInExcel++;
            this.isBlankLastRow = false;
        } else if (this.isSkipBlankRow) {
            //是空行并且不需要写入空行
            this.isBlankLastRow = true;
            this.lastRow = rowTemp;
        }
    }
183980
public static void write(final CharSequence data, final File file) throws IOException {
		Validate.notNull(file);
		Validate.notNull(data);

		try (BufferedWriter writer = Files.newBufferedWriter(file.toPath(), Charsets.UTF_8)) {
			writer.append(data);
		}
	}
288656
public void write(final T source) throws IOException {
        
        Objects.requireNonNull(source, "the bean to write should not be null.");
        
        // update the current row/line numbers
        super.incrementRowAndLineNo();
        
        final CsvContext context = new CsvContext(getLineNumber(), getRowNumber(), 1);
        context.setRowSource(Collections.emptyList());  // 空の値を入れる
        
        final CsvBindingErrors bindingErrors = new CsvBindingErrors(beanMappingCache.getOriginal().getType());
        
        // コールバックメソッドの実行（書き込み前）
        for(CallbackMethod callback : beanMappingCache.getOriginal().getPreWriteMethods()) {
            callback.invoke(source, context, bindingErrors, beanMappingCache.getOriginal());
        }
        
        // extract the bean values
        extractBeanValues(source, beanMappingCache.getNameMapping());
        context.setRowSource(new ArrayList<Object>(beanValues));
        
        Optional<SuperCsvRowException> rowException = Optional.empty();
        try {
            executeCellProcessors(processedColumns, beanValues, beanMappingCache.getCellProcessorsForWriting(), context);
            
        } catch(SuperCsvRowException e) {
            /*
             * カラムごとのCellProcessorのエラーの場合、別なValidatorで値を検証するために、
             * 後から判定を行うようにする。
             */
            rowException = Optional.of(e);
            
            final List<CsvError> errors = exceptionConverter.convert(e, beanMappingCache.getOriginal());
            bindingErrors.addAllErrors(errors);
            
        } catch(SuperCsvException e) {
            // convert exception and format to message.
            errorMessages.addAll(exceptionConverter.convertAndFormat(e, beanMappingCache.getOriginal()));
            throw e;
        }
        
        // レコード、Beanの入力値検証
        if(!beanMappingCache.getOriginal().isSkipValidationOnWrite()) {
            for(CsvValidator<T> validator : validators) {
                validator.validate(source, bindingErrors, new ValidationContext<>(context, beanMappingCache.getOriginal()));
            }
        }
        
        // エラーメッセージの変換
        processErrors(bindingErrors, context, rowException);
        
        // write the list
        super.writeRow(processedColumns);
        
        // コールバックメソッドの実行（書き込み後）
        for(CallbackMethod callback : beanMappingCache.getOriginal().getPostWriteMethods()) {
            callback.invoke(source, context, bindingErrors, beanMappingCache.getOriginal());
        }
        
        // エラーメッセージの変換
        processErrors(bindingErrors, context, rowException);
        
    }
209515
@SneakyThrows @SuppressWarnings("unchecked")
    private void processExcelRowsAnnotation(Field field, Object bean) {
        val excelRows = field.getAnnotation(ExcelRows.class);
        if (excelRows == null) return;

        if (!Generic.of(field.getGenericType()).isRawType(List.class)) return;

        val templateCell = findTemplateCell(excelRows);
        if (templateCell == null) {
            log.warn("unable to locate template cell for field {}", field);
            return; // 找不到模板单元格，直接忽略字段处理。
        }

        val list = (List<Object>) Fields.invokeField(field, bean);
        val itemSize = PoiUtil.shiftRows(sheet, list, templateCell.getRowIndex());
        if (itemSize > 0) {
            writeRows(templateCell, list);
            mergeRows(excelRows, templateCell, itemSize);
            mergeCols(excelRows, templateCell, itemSize);
        }
    }
925203
public void writeToExcel(List<? extends Object> datas, boolean hasTitle,
                             OutputStream outputStream, int inMemory,
                             boolean transverse) throws IOException {
        log.info("准备将数据写入excel");
        //这里使用SXSSFWorkbook而不是XSSFWorkbook，这样将会节省内存，但是内存中仅仅存在inMemory行数据，如果超出那么会将
        //index最小的刷新到本地，后续不能通过getRow方法获取到该行
        SXSSFWorkbook wb = new SXSSFWorkbook(inMemory);
        writeToExcel(datas, hasTitle, wb, transverse);
        log.info("数据写入excel完毕，准备写入本地文件");
        wb.write(outputStream);
        log.debug("删除临时文件，关闭Workbook");
        wb.dispose();
        wb.close();
    }
1074944
public void write2Stream(OutputStream os) throws Excel4JException {

        try {
            this.workbook.write(os);
        } catch (IOException e) {
            throw new Excel4JException(e);
        }
    }
161187
void writeSheet(Writer writer) throws WriterException {
        // create sheet
        this.sheet = workbook.createSheet(writer.sheetName());

        // setting styles
        CellStyle headerStyle = Constant.defaultHeaderStyle(workbook);
        CellStyle columnStyle = Constant.defaultColumnStyle(workbook);
        CellStyle titleStyle  = Constant.defaultTitleStyle(workbook);
        if (null != writer.titleStyle()) {
            titleStyle = writer.titleStyle().accept(workbook, titleStyle);
        }
        if (null != writer.headerStyle()) {
            headerStyle = writer.headerStyle().accept(workbook, headerStyle);
        }
        if (null != writer.cellStyle()) {
            columnStyle = writer.cellStyle().accept(workbook, columnStyle);
        }

        if (writer.isRaw()) {
            writer.sheetConsumer().accept(sheet);
        } else {
            // compute the Filed to be written
            Collection<?> rows   = writer.rows();
            Field[]       fields = rows.iterator().next().getClass().getDeclaredFields();

            this.fieldIndexes = new HashMap<>(fields.length);
            this.columns = new ArrayList<>();

            for (Field field : fields) {
                ExcelColumn column = field.getAnnotation(ExcelColumn.class);
                if (null != column) {
                    field.setAccessible(true);
                    fieldIndexes.put(column.index(), field);
                    columns.add(column);
                }
            }

            int colRowIndex = 0;
            // write title
            String title = writer.headerTitle();
            if (StringUtil.isNotEmpty(title)) {
                Integer maxColIndex = columns.stream()
                        .map(ExcelColumn::index)
                        .max(comparingInt(Integer::intValue))
                        .get();

                this.writeHeader(titleStyle, sheet, title, maxColIndex);
                colRowIndex = 1;
            }

            this.rowNum = writer.startRow();
            if (this.rowNum == 0) {
                this.rowNum = colRowIndex + 1;
            }

            try {
                // write column header
                this.writeColumnNames(colRowIndex, headerStyle);

                // write rows
                for (Object row : rows) {
                    this.writeRow(row, columnStyle);
                }
            } catch (Exception e) {
                log.error("write row fail", e);
            }
        }

        // write to OutputStream
        try (OutputStream os = outputStream) {
            workbook.write(os);
        } catch (Exception e) {
            throw new WriterException("workbook write to OutputStream error", e);
        }
    }
193911
public static boolean WriteXml(ExcelConfig dlExcel, String xmlPath) throws Exception {
        //写入xml
        return XmlUtil.toXml(dlExcel, new File(xmlPath));
    }
853917
public static <T> List<T> readExcelToBeans(File file, Class<T> clazz) throws ReadExcelException {
        return XLSReader.readExcelToBeans(file, null, clazz);
    }
826143
public void writeToExcel(List<? extends Object> datas, boolean hasTitle,
                             OutputStream outputStream, int inMemory) throws IOException {
        writeToExcel(datas, hasTitle, outputStream, inMemory, false);
    }