Class XSSFExcelExtractorDecorator
- All Implemented Interfaces:
OOXMLExtractor
- Direct Known Subclasses:
XSSFBExcelExtractorDecorator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classTurns formatted sheet events into HTMLprotected static classCaptures information on interesting tags, whilst delegating the main work to the formatting handler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.poi.ss.usermodel.DataFormatterprotected static org.apache.poi.xssf.usermodel.helpers.HeaderFooterHelperAllows access to headers/footers from raw xml stringsprotected Metadataprotected ParseContextprotected final List<org.apache.poi.openxml4j.opc.PackagePart> Fields inherited from class org.apache.tika.parser.microsoft.ooxml.AbstractOOXMLExtractor
config, EMBEDDED_RELATIONSHIPS, opcPackage -
Constructor Summary
ConstructorsConstructorDescriptionXSSFExcelExtractorDecorator(ParseContext context, org.apache.poi.openxml4j.opc.OPCPackage pkg, Locale locale) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDrawingHyperLinks(org.apache.poi.openxml4j.opc.PackagePart sheetPart) protected voidapplyEmbeddedAnchorMetadata(org.apache.poi.openxml4j.opc.PackagePart part, Metadata metadata) Hook for subclasses to apply anchor metadata (page or sheet numbers) to an embedded part's metadata, for paginated/sheeted containers.protected voidbuildXHTML(XHTMLContentHandler xhtml) Populates theXHTMLContentHandlerobject received as parameter.protected voidextractHeaderFooter(String hf, XHTMLContentHandler xhtml) protected voidextractHyperLinks(org.apache.poi.openxml4j.opc.PackagePart sheetPart, XHTMLContentHandler xhtml) protected List<org.apache.poi.openxml4j.opc.PackagePart> In Excel files, sheets have things embedded in them, and sheet drawings which have the imagesvoidgetXHTML(ContentHandler handler, Metadata metadata, ParseContext context) Parses the document into a sequence of XHTML SAX events sent to the given content handler.protected voidprocessDrawings(org.apache.poi.openxml4j.opc.PackagePart sheetPart, XHTMLContentHandler xhtml) voidprocessSheet(org.apache.tika.parser.microsoft.ooxml.TikaSheetContentsHandler sheetContentsHandler, org.apache.tika.parser.microsoft.ooxml.XSSFCommentsShim commentsShim, org.apache.tika.parser.microsoft.ooxml.XSSFStylesShim stylesShim, org.apache.tika.parser.microsoft.ooxml.XSSFSharedStringsShim stringsShim, InputStream sheetInputStream) Methods inherited from class org.apache.tika.parser.microsoft.ooxml.AbstractOOXMLExtractor
getEmbeddedPartMetadataMap, getJustFileName, handleEmbeddedFile, loadLinkedRelationships, safeGetRelatedPart
-
Field Details
-
hfHelper
protected static org.apache.poi.xssf.usermodel.helpers.HeaderFooterHelper hfHelperAllows access to headers/footers from raw xml strings -
formatter
protected final org.apache.poi.ss.usermodel.DataFormatter formatter -
sheetParts
-
drawingHyperlinks
-
metadata
-
parseContext
-
-
Constructor Details
-
XSSFExcelExtractorDecorator
public XSSFExcelExtractorDecorator(ParseContext context, org.apache.poi.openxml4j.opc.OPCPackage pkg, Locale locale)
-
-
Method Details
-
getMetadataExtractor
- Specified by:
getMetadataExtractorin interfaceOOXMLExtractor- Overrides:
getMetadataExtractorin classAbstractOOXMLExtractor- See Also:
-
getXHTML
public void getXHTML(ContentHandler handler, Metadata metadata, ParseContext context) throws SAXException, IOException, TikaException Description copied from interface:OOXMLExtractorParses the document into a sequence of XHTML SAX events sent to the given content handler.- Specified by:
getXHTMLin interfaceOOXMLExtractor- Overrides:
getXHTMLin classAbstractOOXMLExtractor- Throws:
SAXExceptionIOExceptionTikaException- See Also:
-
buildXHTML
Description copied from class:AbstractOOXMLExtractorPopulates theXHTMLContentHandlerobject received as parameter.- Specified by:
buildXHTMLin classAbstractOOXMLExtractor- Throws:
SAXExceptionIOException- See Also:
-
addDrawingHyperLinks
protected void addDrawingHyperLinks(org.apache.poi.openxml4j.opc.PackagePart sheetPart) -
extractHyperLinks
protected void extractHyperLinks(org.apache.poi.openxml4j.opc.PackagePart sheetPart, XHTMLContentHandler xhtml) throws SAXException - Throws:
SAXException
-
processDrawings
protected void processDrawings(org.apache.poi.openxml4j.opc.PackagePart sheetPart, XHTMLContentHandler xhtml) throws SAXException - Throws:
SAXException
-
getMainDocumentParts
protected List<org.apache.poi.openxml4j.opc.PackagePart> getMainDocumentParts() throws TikaExceptionIn Excel files, sheets have things embedded in them, and sheet drawings which have the images- Specified by:
getMainDocumentPartsin classAbstractOOXMLExtractor- Throws:
TikaException
-
applyEmbeddedAnchorMetadata
protected void applyEmbeddedAnchorMetadata(org.apache.poi.openxml4j.opc.PackagePart part, Metadata metadata) Description copied from class:AbstractOOXMLExtractorHook for subclasses to apply anchor metadata (page or sheet numbers) to an embedded part's metadata, for paginated/sheeted containers. Called fromAbstractOOXMLExtractor.handleEmbeddedFile(org.apache.poi.openxml4j.opc.PackagePart, org.apache.tika.sax.XHTMLContentHandler, java.lang.String, org.apache.tika.parser.microsoft.ooxml.EmbeddedPartMetadata, org.apache.tika.metadata.TikaCoreProperties.EmbeddedResourceType)after the basic metadata (relationship id, content type, etc.) has been written, before the embedded part is handed off to the recursing parser.Default is no-op — non-paginated containers (Word, Visio, ...) leave embedded resources without anchor metadata. Subclasses for paginated containers should override and invoke either
PageAnchoring.applyPageMetadata(org.apache.tika.metadata.Metadata, java.util.Collection<java.lang.Integer>)(presentations) orPageAnchoring.applySheetMetadata(org.apache.tika.metadata.Metadata, java.util.Collection<java.lang.Integer>)(spreadsheets) with the indices forpart. Letting each subclass own the write keeps the abstract class format-agnostic — pages vs. sheets is a per-format decision.The
PackagePart(not just its target URI) is supplied because relative target URIs differ depending on the relationship source (e.g.../media/image1.pngfrom a slide, or the same relative URI from an Excel drawing) and would not be stable lookup keys across sources. Subclasses can usepart.getPartName().getName()for a canonical absolute path.- Overrides:
applyEmbeddedAnchorMetadatain classAbstractOOXMLExtractor- Parameters:
part- the embedded part being emittedmetadata- metadata to enrich
-