org.alfresco.repo.content.transform
Class PoiHssfContentTransformer

java.lang.Object
  extended by org.alfresco.repo.content.transform.ContentTransformerHelper
      extended by org.alfresco.repo.content.transform.AbstractContentTransformer2
          extended by org.alfresco.repo.content.transform.TikaPoweredContentTransformer
              extended by org.alfresco.repo.content.transform.PoiHssfContentTransformer
All Implemented Interfaces:
ContentWorker, ContentTransformer

public class PoiHssfContentTransformer
extends TikaPoweredContentTransformer

Uses Apache Tika and Apache POI to perform conversions from Excel spreadsheets.

Will transform from Excel spreadsheets into Html, Xml or Text (space or comma separated)

Handles all sheets in the file.


Nested Class Summary
protected static class PoiHssfContentTransformer.CsvContentHandler
          A wrapper around the normal Tika BodyContentHandler, which causes things to be CSV encoded rather than tab separated
 
Field Summary
static java.lang.String WRONG_FORMAT_MESSAGE_ID
          Error message to delegate to NodeInfoBean
 
Fields inherited from class org.alfresco.repo.content.transform.TikaPoweredContentTransformer
LINE_BREAK, sourceMimeTypes
 
Constructor Summary
PoiHssfContentTransformer()
           
 
Method Summary
protected  org.xml.sax.ContentHandler getContentHandler(java.lang.String targetMimeType, java.io.Writer output)
          Returns an appropriate Tika ContentHandler for the requested content type.
protected  org.apache.tika.parser.Parser getParser()
          Returns the correct Tika Parser to process the document.
 boolean isExplicitTransformation(java.lang.String sourceMimetype, java.lang.String targetMimetype, TransformationOptions options)
          Make sure we win over openoffice when it comes to producing HTML
 boolean isTransformable(java.lang.String sourceMimetype, java.lang.String targetMimetype, TransformationOptions options)
          Can we do the requested transformation via Tika? We support transforming to HTML, XML, Text or CSV
 
Methods inherited from class org.alfresco.repo.content.transform.TikaPoweredContentTransformer
buildParseContext, transformInternal
 
Methods inherited from class org.alfresco.repo.content.transform.AbstractContentTransformer2
checkTransformable, getTransformationTime, recordTime, register, setRegistry, toString, transform, transform, transform
 
Methods inherited from class org.alfresco.repo.content.transform.ContentTransformerHelper
getMimetype, getMimetypeService, setExplicitTransformations, setMimetypeService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WRONG_FORMAT_MESSAGE_ID

public static final java.lang.String WRONG_FORMAT_MESSAGE_ID
Error message to delegate to NodeInfoBean

See Also:
Constant Field Values
Constructor Detail

PoiHssfContentTransformer

public PoiHssfContentTransformer()
Method Detail

getParser

protected org.apache.tika.parser.Parser getParser()
Description copied from class: TikaPoweredContentTransformer
Returns the correct Tika Parser to process the document. If you don't know which you want, use TikaAutoContentTransformer which makes use of the Tika auto-detection.

Specified by:
getParser in class TikaPoweredContentTransformer

isTransformable

public boolean isTransformable(java.lang.String sourceMimetype,
                               java.lang.String targetMimetype,
                               TransformationOptions options)
Can we do the requested transformation via Tika? We support transforming to HTML, XML, Text or CSV

Specified by:
isTransformable in interface ContentTransformer
Overrides:
isTransformable in class TikaPoweredContentTransformer
Parameters:
sourceMimetype - the source mimetype
options - the transformation options
Returns:
boolean true if this content transformer can satify the mimetypes and options specified, false otherwise

isExplicitTransformation

public boolean isExplicitTransformation(java.lang.String sourceMimetype,
                                        java.lang.String targetMimetype,
                                        TransformationOptions options)
Make sure we win over openoffice when it comes to producing HTML

Specified by:
isExplicitTransformation in interface ContentTransformer
Overrides:
isExplicitTransformation in class ContentTransformerHelper
Parameters:
sourceMimetype - the source mimetype
targetMimetype - the target mimetype
options - the transformation options
Returns:
boolean true if it is an explicit transformation, flase otherwise
See Also:
ContentTransformer.isExplicitTransformation(java.lang.String, java.lang.String, org.alfresco.service.cmr.repository.TransformationOptions)

getContentHandler

protected org.xml.sax.ContentHandler getContentHandler(java.lang.String targetMimeType,
                                                       java.io.Writer output)
                                                throws javax.xml.transform.TransformerConfigurationException
Description copied from class: TikaPoweredContentTransformer
Returns an appropriate Tika ContentHandler for the requested content type. Normally you'll let this work as default, but if you need fine-grained control of how the Tika events become text then override and supply your own.

Overrides:
getContentHandler in class TikaPoweredContentTransformer
Throws:
javax.xml.transform.TransformerConfigurationException


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.