org.apache.poi.hssf.usermodel.HSSFWorkbook.getInternalWorkbook()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.apache.poi.hssf.usermodel.HSSFWorkbook.getInternalWorkbook()方法的一些代码示例,展示了HSSFWorkbook.getInternalWorkbook()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFWorkbook.getInternalWorkbook()方法的具体详情如下:
包路径:org.apache.poi.hssf.usermodel.HSSFWorkbook
类名称:HSSFWorkbook
方法名:getInternalWorkbook

HSSFWorkbook.getInternalWorkbook介绍

暂无

代码示例

代码示例来源:origin: org.apache.poi/poi

public static void writeToFile(OutputStream fos, InputStream xlsWorkbook, boolean excludeWorkbookRecords, String[] params) throws IOException {
  HSSFWorkbook workbook = new HSSFWorkbook(xlsWorkbook);
  InternalWorkbook internalWorkbook = workbook.getInternalWorkbook();
  DrawingGroupRecord r = (DrawingGroupRecord) internalWorkbook.findFirstRecordBySid(DrawingGroupRecord.sid);
  StringBuilder builder = new StringBuilder();
  builder.append("<workbook>\n");
  String tab = "\t";
  if (!excludeWorkbookRecords && r != null) {
    r.decode();
    List<EscherRecord> escherRecords = r.getEscherRecords();
    for (EscherRecord record : escherRecords) {
      builder.append(record.toXml(tab));
    }
  }
  List<Integer> sheets = getSheetsIndexes(params, workbook);
  for (Integer i : sheets) {
    HSSFPatriarch p = workbook.getSheetAt(i).getDrawingPatriarch();
    if(p != null ) {
      builder.append(tab).append("<sheet").append(i).append(">\n");
      builder.append(p.getBoundAggregate().toXml(tab + "\t"));
      builder.append(tab).append("</sheet").append(i).append(">\n");
    }
  }
  builder.append("</workbook>\n");
  fos.write(builder.toString().getBytes(StringUtil.UTF8));
  fos.close();
  workbook.close();
}

代码示例来源:origin: ZuInnoTe/hadoopoffice

InternalWorkbook intWb = ((HSSFWorkbook)this.currentWorkbook).getInternalWorkbook();

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

public static void writeToFile(OutputStream fos, InputStream xlsWorkbook, boolean excludeWorkbookRecords, String[] params) throws IOException {
  HSSFWorkbook workbook = new HSSFWorkbook(xlsWorkbook);
  InternalWorkbook internalWorkbook = workbook.getInternalWorkbook();
  DrawingGroupRecord r = (DrawingGroupRecord) internalWorkbook.findFirstRecordBySid(DrawingGroupRecord.sid);
  StringBuilder builder = new StringBuilder();
  builder.append("<workbook>\n");
  String tab = "\t";
  if (!excludeWorkbookRecords && r != null) {
    r.decode();
    List<EscherRecord> escherRecords = r.getEscherRecords();
    for (EscherRecord record : escherRecords) {
      builder.append(record.toXml(tab));
    }
  }
  List<Integer> sheets = getSheetsIndexes(params, workbook);
  for (Integer i : sheets) {
    HSSFPatriarch p = workbook.getSheetAt(i).getDrawingPatriarch();
    if(p != null ) {
      builder.append(tab).append("<sheet").append(i).append(">\n");
      builder.append(p.getBoundAggregate().toXml(tab + "\t"));
      builder.append(tab).append("</sheet").append(i).append(">\n");
    }
  }
  builder.append("</workbook>\n");
  fos.write(builder.toString().getBytes(StringUtil.UTF8));
  fos.close();
  workbook.close();
}

代码示例来源:origin: openl-tablets/openl-tablets

@Override
public boolean isUse1904Windowing() throws ExcelParseException {
  try {
    initializeWorkbook();
    if (workbook instanceof XSSFWorkbook) {
      return ((XSSFWorkbook) workbook).isDate1904();
    } else if (workbook instanceof HSSFWorkbook) {
      return ((HSSFWorkbook) workbook).getInternalWorkbook().isUsing1904DateWindowing();
    }
    throw new UnsupportedOperationException("Unsupported workbook type");
  } catch (IOException e) {
    throw new ExcelParseException(e);
  }
}

代码示例来源:origin: docbleach/DocBleach

protected static void cleanupAndSaveExcel97(POIFSFileSystem fs, OutputStream outputStream)
  throws IOException {
 Workbook wb = WorkbookFactory.create(fs);
 if (wb instanceof HSSFWorkbook) {
  HSSFWorkbook hwb = (HSSFWorkbook) wb;
  InternalWorkbook internal = hwb.getInternalWorkbook();
  if (internal != null) {
   LOGGER.trace("# of Records: {}", internal.getNumRecords());
   removeObProjRecord(internal.getRecords());
   LOGGER.trace("# of Records: {}", internal.getNumRecords());
  }
 }
 wb.write(outputStream);
}

相关文章

HSSFWorkbook类方法