edu.uoc.tfc.j2ee.icampanario.grepresenta.useful.office
Class OfficeTools

java.lang.Object
  extended by edu.uoc.tfc.j2ee.icampanario.grepresenta.useful.office.OfficeTools

public class OfficeTools
extends java.lang.Object

Clase de utilidad para el tratamiendo de las plantillas OpenOffice

Author:
Ismael Campanario Cabrera

Constructor Summary
OfficeTools()
          Constructor
OfficeTools(java.lang.String markVariables, java.lang.String prefixTable, java.lang.String prefixImage, java.lang.String separatorRows, java.lang.String separatorCols)
          Constructor
 
Method Summary
static void convertToPdf(java.lang.String host, int port, java.io.InputStream inputOpenDocument, java.lang.String inputFormat, java.io.OutputStream outputPdf, java.lang.String outputFormat)
          Permite convertir un documento odt en pdf.
 byte[] getFreemarkerVars(java.lang.String host, int port, java.io.InputStream sourceDoc, java.util.Map<java.lang.String,java.lang.Object> varsMap)
           
 java.util.List getVariables(java.io.InputStream openDocument)
          Devuelve la lista de variables que hay en el documento.
 void replaceVars(java.io.InputStream openDocument, java.util.Map vars, java.io.OutputStream finalDocument)
          Reemplaza las variables de documento OpenOffice
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OfficeTools

public OfficeTools()
Constructor


OfficeTools

public OfficeTools(java.lang.String markVariables,
                   java.lang.String prefixTable,
                   java.lang.String prefixImage,
                   java.lang.String separatorRows,
                   java.lang.String separatorCols)
Constructor

Parameters:
markVariables - Marca para las variables
prefixTable - Prefijo para tablas
prefixImage - Prefijo para imágenes
separatorRows - Separador de columnas
separatorCols - Separador de filas
Method Detail

replaceVars

public void replaceVars(java.io.InputStream openDocument,
                        java.util.Map vars,
                        java.io.OutputStream finalDocument)
                 throws java.io.IOException,
                        org.jdom.JDOMException
Reemplaza las variables de documento OpenOffice

Parameters:
openDocument - Documento de OpenOffice tomado como referencia
vars - Mapa de variables y valores
finalDocument - Documento de OpenOffice con las variables sustituidas
Throws:
java.io.IOException
org.jdom.JDOMException

convertToPdf

public static void convertToPdf(java.lang.String host,
                                int port,
                                java.io.InputStream inputOpenDocument,
                                java.lang.String inputFormat,
                                java.io.OutputStream outputPdf,
                                java.lang.String outputFormat)
                         throws java.lang.Exception
Permite convertir un documento odt en pdf. Para ello hace uso de la librería JODConverter.

Parameters:
inputOpenDocument - OpenDocumento odt
outputPdf - Documento pdf
Throws:
java.lang.Exception

getVariables

public java.util.List getVariables(java.io.InputStream openDocument)
                            throws java.lang.Exception
Devuelve la lista de variables que hay en el documento. Usando la marca de variables indicada en el constructor o si no se ha indicado usa $$ por defecto

Parameters:
openDocument - Documento OpenOffice
Returns:
Lista de variables
Throws:
java.lang.Exception - Exception

getFreemarkerVars

public byte[] getFreemarkerVars(java.lang.String host,
                                int port,
                                java.io.InputStream sourceDoc,
                                java.util.Map<java.lang.String,java.lang.Object> varsMap)
                         throws java.lang.Exception
Parameters:
host -
port -
sourceDoc -
varsMap -
Returns:
Throws:
java.lang.Exception