[java-l] generación de planilla excel en java

Tengo el siguiente procedimiento que genera una planilla excel:
&Path = "C:\Tomcat\webapps\SisCODJavaEnvironment\"

// Exports the contents of a grid (using the selected order and filters) to an Excel file.

&Random = Random() * 10000

&Filename = !"PublicTempStorage\Xls_Historico-" + &Random.ToString().Trim() + !".xls"

&PathFile = &Path.Trim() + &Filename.Trim()

&ExcelDocument.Open(&PathFile)
Do 'CheckStatus'
&ExcelDocument.Clear()

&CellRow = 1
&FirstColumn = 1

// Write titles
&ExcelDocument.Cells(&CellRow, &FirstColumn + 0).Text = 'Cód.'
&ExcelDocument.Cells(&CellRow, &FirstColumn + 1).Text = 'Artículo'
&ExcelDocument.Cells(&CellRow, &FirstColumn + 2).Text = 'Unidad'
&ExcelDocument.Cells(&CellRow, &FirstColumn + 3).Text = 'Variante'
&ExcelDocument.Cells(&CellRow, &FirstColumn + 4).Text = 'Medida Variante'
&ExcelDocument.Cells(&CellRow, &FirstColumn + 5).Text = 'Present.'
&ExcelDocument.Cells(&CellRow, &FirstColumn + 6).Text = 'Unidad Present'
&ExcelDocument.Cells(&CellRow, &FirstColumn + 7).Text = 'Código'
&ExcelDocument.Cells(&CellRow, &FirstColumn + 8).Text = 'Descripción'
&ExcelDocument.Cells(&CellRow, &FirstColumn + 9).Text = 'Operación'
&ExcelDocument.Cells(&CellRow, &FirstColumn + 10).Text = 'Registro'
&ExcelDocument.Cells(&CellRow, &FirstColumn + 11).Text = 'Fecha Movim'
&ExcelDocument.Cells(&CellRow, &FirstColumn + 12).Text = 'Hora'

For each
order LogCodId when &OrderedBy = 1
order LogCodDsc when &OrderedBy = 2
where LogUsuario = &Usuario
where LogCodId >= &LogCodId
where LogCodDsc like '%' + &LogCodDsc.Trim().ToUpper() + '%' when not &LogCodDsc.IsEmpty()
where LogFamId = &LogFamId when not &LogFamId.IsEmpty()
where LogSFaId = &LogSFaId when not &LogSFaId.IsEmpty()
where LogClaId = &LogClaId when not &LogClaId.IsEmpty()
where LogSClId = &LogSClId when not &LogSClId.IsEmpty()

// Write cell values
&CellRow += 1
&ExcelDocument.Cells(&CellRow, &FirstColumn + 0).Number = LogCodId
&ExcelDocument.Cells(&CellRow, &FirstColumn + 1).Text = LogCodDsc
&ExcelDocument.Cells(&CellRow, &FirstColumn + 2).Text = LogCodUniDsc
&ExcelDocument.Cells(&CellRow, &FirstColumn + 3).Text = LogVarDsc
&ExcelDocument.Cells(&CellRow, &FirstColumn + 4).Text = LogMedDscVar
&ExcelDocument.Cells(&CellRow, &FirstColumn + 5).Text = LogPreDsc
&ExcelDocument.Cells(&CellRow, &FirstColumn + 6).Text = LogCodUniDsc
&ExcelDocument.Cells(&CellRow, &FirstColumn + 7).Text = LogMedVArtCodigo
&ExcelDocument.Cells(&CellRow, &FirstColumn + 8).Text = LogMedVDscCodigo
&ExcelDocument.Cells(&CellRow, &FirstColumn + 9).Text = LogOperacion
&ExcelDocument.Cells(&CellRow, &FirstColumn + 9).Text = LogTipoReg
&ExcelDocument.Cells(&CellRow, &FirstColumn + 11).Date = LogFchMov
&ExcelDocument.Cells(&CellRow, &FirstColumn + 12).Text = LogHora
Endfor

&ExcelDocument.Save()
Do 'CheckStatus'
&ExcelDocument.Close()

Sub 'CheckStatus'
If (&ExcelDocument.ErrCode <> 0)
&Filename = ""
&ErrorMessage = &ExcelDocument.ErrDescription
&ExcelDocument.Close()
Return
Endif
Endsub

Si lo corre solo como main me genera la planilla.
Pero si lo corro desde el web-panel así:
Event 'DoExport'
Xls_Historico.Call(&Usuario, &OrderedBy, &cCodId, &cCodDsc, &cFamId,
&cSFaId, &cClaId, &cSClId, &ExcelFilename, &ErrorMessage)

If (&ExcelFilename <> "")
Link(&ExcelFilename)
Else
msg(&ErrorMessage)
Endif
EndEvent

Me da el siguiente error:

Estado HTTP 500 -


type Informe de Excepci�n

mensaje

descripci�n El servidor encontr� un error interno () que hizo que no pudiera rellenar este requerimiento.

excepci�n

javax.servlet.ServletException: java.lang.NoSuchMethodError: org.apache.poi.hssf.usermodel.HSSFCell.setEncoding(S)V  	at com.genexus.gxoffice.poi.ExcelCells.setText(Unknown Source)  	at xls_historico.privateExecute(xls_historico.java:109)  	at xls_historico.execute_int(xls_historico.java:90)  	at xls_historico.execute(xls_historico.java:63)  	at asocia2_impl.e164H2(asocia2_impl.java:1452)  	at asocia2_impl.evt4H2(asocia2_impl.java:435)  	at asocia2_impl.dispatchEvents(asocia2_impl.java:256)  	at appmasterpage_impl.evt012(appmasterpage_impl.java:245)  	at appmasterpage_impl.ws012(appmasterpage_impl.java:154)  	at appmasterpage_impl.webExecute(appmasterpage_impl.java:55)  	at asocia2_impl.webExecute(asocia2_impl.java:114)  	at com.genexus.webpanels.GXWebObjectBase.doExecute(Unknown Source)  	at asocia2.doExecute(asocia2.java:20)  	at com.genexus.webpanels.GXWebObjectStub.callExecute(Unknown Source)  	at com.genexus.webpanels.GXWebObjectStub.doPost(Unknown Source)  	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)  	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)  	at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:402)  	at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:170)  	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)  	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)  	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)  	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)  	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)  	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)  	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)  	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)  	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)  	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)  	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)  	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)  	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)  	at java.lang.Thread.run(Unknown Source)    	com.genexus.webpanels.GXWebObjectStub.callExecute(Unknown Source)  	com.genexus.webpanels.GXWebObjectStub.doPost(Unknown Source)  	javax.servlet.http.HttpServlet.service(HttpServlet.java:637)  	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)  	org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:402)  	org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:170)  	javax.servlet.http.HttpServlet.service(HttpServlet.java:637)  	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)  

nota La traza completa de la causa de este error se encuentra en los archivos de diario de Apache Tomcat/6.0.18.


Apache Tomcat/6.0.18

Lo corrí con el debug y el error da cuando intenta cargar la primer celda.

 

Espero que me puedan ayudar, ya que no se porque está cancelandose.

 

Desde ya gracias.

 

0 Response to "[java-l] generación de planilla excel en java"

Publicar un comentario