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

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

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

HSSFWorkbook.getDirectory介绍

暂无

代码示例

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

  1. /**
  2. * create shape tree from existing escher records tree
  3. */
  4. void buildShapeTree() {
  5. EscherContainerRecord dgContainer = _boundAggregate.getEscherContainer();
  6. if (dgContainer == null) {
  7. return;
  8. }
  9. EscherContainerRecord spgrConrainer = dgContainer.getChildContainers().get(0);
  10. List<EscherContainerRecord> spgrChildren = spgrConrainer.getChildContainers();
  11. for (int i = 0; i < spgrChildren.size(); i++) {
  12. EscherContainerRecord spContainer = spgrChildren.get(i);
  13. if (i != 0) {
  14. HSSFShapeFactory.createShapeTree(spContainer, _boundAggregate, this, _sheet.getWorkbook().getDirectory());
  15. }
  16. }
  17. }

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

  1. new FilteringDirectoryNode(getDirectory(), excepts)
  2. , new FilteringDirectoryNode(fs.getRoot(), excepts)
  3. );
  4. fs.getRoot().setStorageClsid(getDirectory().getStorageClsid());

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

  1. @Override
  2. public int addOlePackage(byte[] oleData, String label, String fileName, String command)
  3. throws IOException {
  4. // check if we were created by POIFS otherwise create a new dummy POIFS for storing the package data
  5. if (initDirectory()) {
  6. preserveNodes = true;
  7. }
  8. // get free MBD-Node
  9. int storageId = 0;
  10. DirectoryEntry oleDir = null;
  11. do {
  12. String storageStr = "MBD"+ HexDump.toHex(++storageId);
  13. if (!getDirectory().hasEntry(storageStr)) {
  14. oleDir = getDirectory().createDirectory(storageStr);
  15. oleDir.setStorageClsid(ClassIDPredefined.OLE_V1_PACKAGE.getClassID());
  16. }
  17. } while (oleDir == null);
  18. Ole10Native.createOleMarkerEntry(oleDir);
  19. Ole10Native oleNative = new Ole10Native(label, fileName, command, oleData);
  20. ByteArrayOutputStream bos = new ByteArrayOutputStream();
  21. oleNative.writeOut(bos);
  22. oleDir.createDocument(Ole10Native.OLE10_NATIVE, new ByteArrayInputStream(bos.toByteArray()));
  23. return storageId;
  24. }

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

  1. /**
  2. * Write out this workbook to the currently open {@link File} via the
  3. * writeable {@link POIFSFileSystem} it was opened as.
  4. *
  5. * <p>This will fail (with an {@link IllegalStateException} if the
  6. * Workbook was opened read-only, opened from an {@link InputStream}
  7. * instead of a File, or if this is not the root document. For those cases,
  8. * you must use {@link #write(OutputStream)} or {@link #write(File)} to
  9. * write to a brand new document.
  10. */
  11. @Override
  12. public void write() throws IOException {
  13. validateInPlaceWritePossible();
  14. final DirectoryNode dir = getDirectory();
  15. // Update the Workbook stream in the file
  16. DocumentNode workbookNode = (DocumentNode)dir.getEntry(
  17. getWorkbookDirEntryName(dir));
  18. POIFSDocument workbookDoc = new POIFSDocument(workbookNode);
  19. workbookDoc.replaceContents(new ByteArrayInputStream(getBytes()));
  20. // Update the properties streams in the file
  21. writeProperties();
  22. // Sync with the File on disk
  23. dir.getFileSystem().writeFilesystem();
  24. }

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

  1. DirectoryEntry oleRoot;
  2. try {
  3. DirectoryNode dn = _sheet.getWorkbook().getDirectory();
  4. if (dn == null) {
  5. throw new FileNotFoundException();

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

  1. /**
  2. * create shape tree from existing escher records tree
  3. */
  4. void buildShapeTree() {
  5. EscherContainerRecord dgContainer = _boundAggregate.getEscherContainer();
  6. if (dgContainer == null) {
  7. return;
  8. }
  9. EscherContainerRecord spgrConrainer = dgContainer.getChildContainers().get(0);
  10. List<EscherContainerRecord> spgrChildren = spgrConrainer.getChildContainers();
  11. for (int i = 0; i < spgrChildren.size(); i++) {
  12. EscherContainerRecord spContainer = spgrChildren.get(i);
  13. if (i != 0) {
  14. HSSFShapeFactory.createShapeTree(spContainer, _boundAggregate, this, _sheet.getWorkbook().getDirectory());
  15. }
  16. }
  17. }

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

  1. new FilteringDirectoryNode(getDirectory(), excepts)
  2. , new FilteringDirectoryNode(fs.getRoot(), excepts)
  3. );
  4. fs.getRoot().setStorageClsid(getDirectory().getStorageClsid());

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

  1. @Override
  2. public int addOlePackage(byte[] oleData, String label, String fileName, String command)
  3. throws IOException {
  4. // check if we were created by POIFS otherwise create a new dummy POIFS for storing the package data
  5. if (initDirectory()) {
  6. preserveNodes = true;
  7. }
  8. // get free MBD-Node
  9. int storageId = 0;
  10. DirectoryEntry oleDir = null;
  11. do {
  12. String storageStr = "MBD"+ HexDump.toHex(++storageId);
  13. if (!getDirectory().hasEntry(storageStr)) {
  14. oleDir = getDirectory().createDirectory(storageStr);
  15. oleDir.setStorageClsid(ClassIDPredefined.OLE_V1_PACKAGE.getClassID());
  16. }
  17. } while (oleDir == null);
  18. Ole10Native.createOleMarkerEntry(oleDir);
  19. Ole10Native oleNative = new Ole10Native(label, fileName, command, oleData);
  20. ByteArrayOutputStream bos = new ByteArrayOutputStream();
  21. oleNative.writeOut(bos);
  22. oleDir.createDocument(Ole10Native.OLE10_NATIVE, new ByteArrayInputStream(bos.toByteArray()));
  23. return storageId;
  24. }

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

  1. /**
  2. * Write out this workbook to the currently open {@link File} via the
  3. * writeable {@link POIFSFileSystem} it was opened as.
  4. *
  5. * <p>This will fail (with an {@link IllegalStateException} if the
  6. * Workbook was opened read-only, opened from an {@link InputStream}
  7. * instead of a File, or if this is not the root document. For those cases,
  8. * you must use {@link #write(OutputStream)} or {@link #write(File)} to
  9. * write to a brand new document.
  10. */
  11. @Override
  12. public void write() throws IOException {
  13. validateInPlaceWritePossible();
  14. final DirectoryNode dir = getDirectory();
  15. // Update the Workbook stream in the file
  16. DocumentNode workbookNode = (DocumentNode)dir.getEntry(
  17. getWorkbookDirEntryName(dir));
  18. POIFSDocument workbookDoc = new POIFSDocument(workbookNode);
  19. workbookDoc.replaceContents(new ByteArrayInputStream(getBytes()));
  20. // Update the properties streams in the file
  21. writeProperties();
  22. // Sync with the File on disk
  23. dir.getFileSystem().writeFilesystem();
  24. }

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

  1. DirectoryEntry oleRoot;
  2. try {
  3. DirectoryNode dn = _sheet.getWorkbook().getDirectory();
  4. if (dn == null) {
  5. throw new FileNotFoundException();

相关文章

HSSFWorkbook类方法