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

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

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

HSSFWorkbook.initDirectory介绍

暂无

代码示例

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

@Override
public int addOlePackage(byte[] oleData, String label, String fileName, String command)
throws IOException {
  // check if we were created by POIFS otherwise create a new dummy POIFS for storing the package data
  if (initDirectory()) {
    preserveNodes = true;
  }
  // get free MBD-Node
  int storageId = 0;
  DirectoryEntry oleDir = null;
  do {
    String storageStr = "MBD"+ HexDump.toHex(++storageId);
    if (!getDirectory().hasEntry(storageStr)) {
      oleDir = getDirectory().createDirectory(storageStr);
      oleDir.setStorageClsid(ClassIDPredefined.OLE_V1_PACKAGE.getClassID());
    }
  } while (oleDir == null);
  Ole10Native.createOleMarkerEntry(oleDir);
  
  Ole10Native oleNative = new Ole10Native(label, fileName, command, oleData);
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  oleNative.writeOut(bos);
  oleDir.createDocument(Ole10Native.OLE10_NATIVE, new ByteArrayInputStream(bos.toByteArray()));
  return storageId;
}

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

@Override
public int addOlePackage(byte[] oleData, String label, String fileName, String command)
throws IOException {
  // check if we were created by POIFS otherwise create a new dummy POIFS for storing the package data
  if (initDirectory()) {
    preserveNodes = true;
  }
  // get free MBD-Node
  int storageId = 0;
  DirectoryEntry oleDir = null;
  do {
    String storageStr = "MBD"+ HexDump.toHex(++storageId);
    if (!getDirectory().hasEntry(storageStr)) {
      oleDir = getDirectory().createDirectory(storageStr);
      oleDir.setStorageClsid(ClassIDPredefined.OLE_V1_PACKAGE.getClassID());
    }
  } while (oleDir == null);
  Ole10Native.createOleMarkerEntry(oleDir);
  
  Ole10Native oleNative = new Ole10Native(label, fileName, command, oleData);
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  oleNative.writeOut(bos);
  oleDir.createDocument(Ole10Native.OLE10_NATIVE, new ByteArrayInputStream(bos.toByteArray()));
  return storageId;
}

相关文章

HSSFWorkbook类方法