Tema: Ms-word java
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/07/2012, 08:37
Erickvk
 
Fecha de Ingreso: septiembre-2007
Mensajes: 268
Antigüedad: 17 años, 2 meses
Puntos: 8
Ms-word java

InputStream objInputStream = this.getClass().getResourceAsStream("/"+SITEConstantes.CTE_RUTA_DIR_CONFIGURACION+SITECo nstantes.CTE_URL_PLANTILLA_WORLD);
POIFSFileSystem objPOIFSFileSystem = new POIFSFileSystem(objInputStream);
HWPFDocument objHWPFDocument = new HWPFDocument(objPOIFSFileSystem);
Range objRange = objHWPFDocument.getRange();
CharacterRun objCharacterRun = objRange.insertBefore("paso por aqui");
objCharacterRun.setBold(true);
objCharacterRun = objRange.insertAfter("prueba estilo");
objCharacterRun.setBold(false);
objCharacterRun.setFontSize(18);
hmResultado.put(INFOConstantes.CTE_OBJ_HWPF_DOCUME NT, objHWPFDocument);
String sResultado = this.enviarWord(hmResultado,PobjHttpServletRespons e);

Este es mi codigo y me esta dando error al realizar la instruccion

POIFSFileSystem objPOIFSFileSystem = new POIFSFileSystem(objInputStream);

El fichero existe, y lo he probado de mil manera con el fichero vacio, con algo metido, con algun word que tengo por hay. Guardandolo con cualquier posibilidad que da, docx, doc, dot, dotm.

Me salta esta excepcion.

16:28:41,019 INFO [STDOUT] [204804 16:28:41 INFO.INFOInformesSrv.generarInformeAnalisisNormali zado] <INFO> Inicio de ejecucion del metodo [INFO.INFOInformesSrv.generarInformeAnalisisNormali zado]
16:28:47,486 INFO [STDOUT] org.apache.poi.poifs.filesystem.OfficeXmlFileExcep tion: The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)
16:28:47,502 INFO [STDOUT] at org.apache.poi.poifs.storage.HeaderBlock.<init>(He aderBlock.java:131)
16:28:47,502 INFO [STDOUT] at org.apache.poi.poifs.storage.HeaderBlock.<init>(He aderBlock.java:104)
16:28:47,502 INFO [STDOUT] at org.apache.poi.poifs.filesystem.POIFSFileSystem.<i nit>(POIFSFileSystem.java:138)
16:28:47,502 INFO [STDOUT] at INFO.INFOInformesSrv.generarInformeAnalisisNormali zado(INFOInformesSrv.java:334)
16:28:47,502 INFO [STDOUT] at INFO.INFOInformesSrv.realizaAccion(INFOInformesSrv .java:166)
16:28:47,502 INFO [STDOUT] at SITE.SITEGestionSrv.controlaAccion(SITEGestionSrv. java:211)
16:28:47,502 INFO [STDOUT] at SITE.SITEGestionSrv.service(SITEGestionSrv.java:10 4)
16:28:47,502 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
16:28:47,502 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252)
16:28:47,502 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
16:28:47,502 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:81)
16:28:47,502 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:202)
16:28:47,502 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
16:28:47,502 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:213)
16:28:47,518 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:178)
16:28:47,518 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve .invoke(CustomPrincipalValve.java:39)
16:28:47,518 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(SecurityAssociationValve.java:153)
16:28:47,518 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.inv oke(JaccContextValve.java:59)
16:28:47,518 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:126)
16:28:47,518 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:105)
16:28:47,518 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:107)
16:28:47,518 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:148)
16:28:47,518 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:856)
16:28:47,518 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:744)
16:28:47,518 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:527)
16:28:47,518 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread .run(MasterSlaveWorkerThread.java:112)
16:28:47,518 INFO [STDOUT] at java.lang.Thread.run(Unknown Source)


Muchas gracias por las molestias.