Hi all,
I am getting exceptions while downloading Excel template. i think the problem is in one sheet if i remove that sheet i am able to download with some vb error messages like cannot read file etc., As per my knowledge in vb code for downloading i have changed code.
I have modified code for uploading excel sheet which is uploading successfully. But same template i am not able to download I cannot debug download vb code. Im new to VB please help me..
i have only changed 1 sheet named ThisWorksheet rest of the code (other sheets) is same as uploading template. here is my VB code in ThisWorksheet
Private Sub Workbook_Open()
''Copying Components Amonunt and Cost
Dim sh As Worksheet
For Each sh In Worksheets
If sh.name = "fromjXLS" Then
Sheets("Questionnaire").Range("C2").Value = sh.Range("A2").Value
Sheets("Questionnaire").Range("C3").Value = sh.Range("A3").Value
Sheets("Questionnaire").Range("C6").Value = sh.Range("A4").Value
Sheets("Questionnaire").Range("C7").Value = sh.Range("A5").Value
Sheets("Questionnaire").Range("F7").Value = sh.Range("A6").Value
Sheets("Questionnaire").Range("C8").Value = sh.Range("A7").Value
Sheets("Questionnaire").Range("F8").Value = sh.Range("A8").Value
Sheets("Questionnaire").Range("C9").Value = sh.Range("A9").Value
Sheets("Questionnaire").Range("C10").Value = sh.Range("A10").Value
Sheets("Questionnaire").Range("F10").Value = sh.Range("A11").Value
Sheets("Questionnaire").Range("C11").Value = sh.Range("A12").Value
Sheets("Questionnaire").Range("F11").Value = sh.Range("A13").Value
Sheets("Questionnaire").Range("C12").Value = sh.Range("A14").Value
Sheets("Questionnaire").Range("F12").Value = sh.Range("A15").Value
Sheets("Questionnaire").Range("C13").Value = sh.Range("A16").Value
Sheets("Questionnaire").Range("C14").Value = sh.Range("A17").Value
Sheets("Questionnaire").Range("C15").Value = sh.Range("A18").Value
Sheets("Questionnaire").Range("C16").Value = sh.Range("A19").Value
Sheets("Questionnaire").Range("C17").Value = sh.Range("A20").Value
Sheets("Questionnaire").Range("C18").Value = sh.Range("A21").Value
Sheets("Questionnaire").Range("E15").Value = sh.Range("A22").Value
Sheets("Questionnaire").Range("E16").Value = sh.Range("A23").Value
Sheets("Questionnaire").Range("E17").Value = sh.Range("A24").Value
Sheets("Questionnaire").Range("E18").Value = sh.Range("A25").Value
Sheets("Questionnaire").Range("E19").Value = sh.Range("A26").Value
Sheets("Questionnaire").Range("F15").Value = sh.Range("A27").Value
Sheets("Questionnaire").Range("F16").Value = sh.Range("A28").Value
Sheets("Questionnaire").Range("F17").Value = sh.Range("A29").Value
Sheets("Questionnaire").Range("F18").Value = sh.Range("A30").Value
Sheets("Questionnaire").Range("F19").Value = sh.Range("A31").Value
Sheets("Questionnaire").Range("C22").Value = sh.Range("A32").Value
Sheets("Questionnaire").Range("C23").Value = sh.Range("A33").Value
Sheets("Questionnaire").Range("C24").Value = sh.Range("A34").Value
Sheets("Questionnaire").Range("C25").Value = sh.Range("A35").Value
Sheets("Questionnaire").Range("C26").Value = sh.Range("A36").Value
Sheets("Questionnaire").Range("C27").Value = sh.Range("A37").Value
Sheets("Questionnaire").Range("F27").Value = sh.Range("A38").Value
Sheets("Questionnaire").Range("C28").Value = sh.Range("A39").Value
Sheets("Questionnaire").Range("F28").Value = sh.Range("A40").Value
Sheets("Questionnaire").Range("C29").Value = sh.Range("A41").Value
Sheets("Questionnaire").Range("F29").Value = sh.Range("A42").Value
Sheets("Questionnaire").Range("C30").Value = sh.Range("A43").Value
Sheets("Questionnaire").Range("F30").Value = sh.Range("A44").Value
Sheets("Questionnaire").Range("C31").Value = sh.Range("A41").Value
Sheets("Questionnaire").Range("F31").Value = sh.Range("A42").Value
Sheets("Questionnaire").Range("C34").Value = sh.Range("A43").Value
Sheets("Questionnaire").Range("F34").Value = sh.Range("A44").Value
Sheets("Questionnaire").Range("B36").Value = sh.Range("A45").Value
End If
' If (sh.Range("A85").Value <> 0) Then
' Sheets("Questionnaire").Range("J47").Value = sh.Range("A85").Value
' End If
' If (Trim(sh.Range("A104").Value) = "True") Then
' Sheets("toCSV").Range("B104").Value = True
'Else
' Sheets("toCSV").Range("B104").Value = False
' End If
'If (Trim(sh.Range("A105").Value) = "True") Then
' Sheets("toCSV").Range("B105").Value = True
' Else
' Sheets("toCSV").Range("B105").Value = False
'End If
' If (Trim(sh.Range("A106").Value) = "True") Then
' Sheets("toCSV").Range("B106").Value = True
' Else
' Sheets("toCSV").Range("B106").Value = False
' End If
' If (Trim(sh.Range("A107").Value) = "True") Then
' Sheets("toCSV").Range("B107").Value = True
' Else
' Sheets("toCSV").Range("B107").Value = False
' End If
' Sheets("Questionnaire").Range("J56").Value = sh.Range("A92").Value
' Sheets("Questionnaire").Range("J57").Value = sh.Range("A93").Value
' Sheets("toCSV").Range("B121").Value = sh.Range("A111").Value ' this line of code is for putting 'NNNNNN' value.
' Dim i As Integer
' Dim j As Integer
' i = 33
' j = 28
' k = 35
' Do While i < 70 And j < 36 And k < 38
' If Len(Trim(sh.Range("A" & i).Value)) > 0 Then
' Dim l As Integer
' Dim token As Integer
' token = 0
' ' For l = 15 To 31
' If Trim(sh.Range("A" & i).Value) = Trim(Sheets("Questionnaire").Cells(28, l).Value) Then
' token = 1
' End If
' Next
'If token = 1 Then
' Sheets("Questionnaire").Range("E" & j).Value = _
' sh.Range("A" & (i)).Value
' Sheets("Questionnaire").Range("F" & j).Value = _
' sh.Range("A" & (i + 1)).Value
' Sheets("Questionnaire").Range("G" & j).Value = _
' sh.Range("A" & (i + 2)).Value
' If Sheets("Questionnaire").Range("I" & j).Value <> _
' sh.Range("A" & (i + 3)).Value Then
' Sheets("Questionnaire").Range("J" & j).Value = _
' sh.Range("A" & (i + 3)).Value
' End If
' j = j + 1
' Else
' Sheets("Questionnaire").Range("E" & k).Value = _
' sh.Range("A" & (i)).Value 'this is for custom comp1-custom comp3 columns
' Sheets("Questionnaire").Range("G" & k).Value = _
' sh.Range("A" & (i + 1)).Value
' Sheets("Questionnaire").Range("J" & k).Value = _
' sh.Range("A" & (i + 2)).Value
' k = k + 1
' End If
' i = i + 4
' Else
' i = 70
' End If
' Loop
For i = 3 To 10
'prepend a $ symbol to trigger proper formatting
Dim temp As String
temp = "$" & Sheets("fromCSV").Range("B" & i).Value
Sheets("fromCSV").Range("B" & i).Value = temp
Next
Application.DisplayAlerts = False
'sh.Delete
Application.DisplayAlerts = True
'End If
Next
''Counting customer acknoldgement 'orinally commented
Call customer_acknoledgement.init_ack_check_boxes 'not required
Call customer_acknoledgement.init_acknoledgement
Call saveOldValues
Sheets("Questionnaire").Activate
Sheets("Questionnaire").Range("A1").Select
Call Sheet1.Worksheet_Activate
End Sub
01-08-2009 08:55:31 IST,INFO,Application,com.cypress.webapps.vp.controller.servlet.DownloadServlet,,,"customer_name: downlaod"
01-08-2009 08:55:31 IST,INFO,Application,com.cypress.webapps.vp.controller.servlet.DownloadServlet,,,"application_name: tertg"
Size of bean138
01-08-2009 08:55:31 IST,ERROR,Application,org.apache.catalina.core.StandardWrapperValve,,,"Servlet.service() for servlet Download Servlet threw exception"
java.lang.ArrayIndexOutOfBoundsException: 9
at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:491)
at org.apache.poi.util.LittleEndian.getShort(LittleEndian.java:52)
at org.apache.poi.hssf.record.TextObjectRecord.processFontRuns(TextObjectRecord.java:140)
at org.apache.poi.hssf.record.TextObjectRecord.processContinueRecord(TextObjectRecord.java:131)
at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:188)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:163)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:130)
at net.sf.jxls.transformer.XLSTransformer.transformXLS(XLSTransformer.java:221)
at net.sf.jxls.transformer.XLSTransformer.transformXLS(XLSTransformer.java:201)
at com.cypress.webapps.vp.controller.servlet.DownloadServlet.processRequest(DownloadServlet.java:219)
at com.cypress.webapps.vp.controller.servlet.DownloadServlet.doGet(DownloadServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.cypress.webapps.vp.controller.filter.RMIAuthenticationFilter.doFilter(RMIAuthenticationFilter.java:121)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.cypress.utils.core.controller.filter.DBConnectionFilter.doFilter(DBConnectionFilter.java:80)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)