@PublicAPI public interface IDocumentReader
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the office document stream.
|
java.util.List<MoleculeMap> |
getAllStructures()
Reads all the molecules from the given document
|
chemaxon.formats.documents.jchemoffice.BatchProcessingException |
getExceptions()
Gives back all exceptions occurred while processing the document.
|
boolean |
isDocumentJCO()
Determines if the document contains JCO structure.
|
MoleculeMap |
isObjectJCO(java.lang.Object range)
Determines if the given POI object can be handled as a JCO object with
molecule content.
|
java.util.List<MoleculeMap> getAllStructures() throws java.lang.Exception
java.lang.Exception
boolean isDocumentJCO()
MoleculeMap isObjectJCO(java.lang.Object range)
Example how to use the isObjectJCO from PowerPoint:
XMLSlideShow pptx = new XMLSlideShow(inputStream); XSLFShape groupShape = pptx.getSlides().get(0).getShapes().get(0); XSLFShape pictureShape = null; ListinnerShapes = ((XSLFGroupShape) groupShape).getShapes(); for (XSLFShape innerShape : innerShapes) { if (innerShape.getClass().getName().equals("org.apache.poi.xslf.usermodel.XSLFPictureShape")) { pictureShape = innerShape; } } inputStream.close(); IDocumentReader reader = DocumentHandlerFactory.CreateReader(inputStream); -- Check group shape MoleculeMap map = reader.isObjectJCO(groupShape); -- or Check picture shape MoleculeMap map = reader.isObjectJCO(pictureShape);
Example how to use the isObjectJCO from Word:
XWPFDocument doc = new XWPFDocument(inputStream); XWPFParagraph paragraph = doc.getTables().get(0).getRow(0).getTableCells().get(0).getParagraphs().get(0); XWPFRun run = paragraph.getRuns().get(0); inputStream.close(); IDocumentReader reader = DocumentHandlerFactory.CreateReader(inputStream); -- Check the paragraph MoleculeMap mapPicture = reader.isObjectJCO(paragraph); -- Or check the run MoleculeMap mapPicture = reader.isObjectJCO(run); inputStream.close(); reader.close();
range
- - The POI object (i.e.: groupShape, pictureShape, paragraph,
run)void close() throws java.io.IOException
java.io.IOException
chemaxon.formats.documents.jchemoffice.BatchProcessingException getExceptions()