Friedger Müffke
Mon, 10 Mar 2008 03:45:58 -0700
Hi, could you please post a running applet that shows the performance issue? I have tried to assemble something that might be similar to your application. The applet finished within less than have a second. I fills some cells and saves it to "test.xls". See attached curl file. Friedger
Hello gurusI met a critical performance issue in calling methods/properties of Excel.Application(ActiveXObject) for creating excel files in a Curl applet. This applet is converted from a Visual Basic(6.0) application, so the methods/properties used by the Curl applet is completely the same with the original VBapplication.With the VB application, creating the xls file costs about twenty seconds, while in Curl, creating the same xls file (containing the same data, the same formatted style) costs about 120 seconds. So, calling methods/properties in Curl applet used about six times long time comparing with the VB application. Attached files are copied from the project codes in VB and Curl accordingly. Note the two applications in VB and Curl are identical in the meaning of function and codes logic. Codes in attached files are called in a for loop of another method/sub. Also note that it has been proved that procs like Variant-to-Boolean, vb-var-diff are not related with this performance issue. Does anyone know any reason about this big difference ? Are there any way to accelerate my Curl applet on outputting excel files with Excel.Application ActiveXObject ? The attached files are encoded in utf-8. Thank you.
{curl 6.0 applet}
{curl-file-attributes character-encoding = "utf8"}
{import * from CURL.GRAPHICS.ACTIVEX}
{define-class ExcelTest
field g_xlApp:#ActiveXObject
field xlSheetReport: any
field w_lngRDLine:int = 1
field w_lngRDLineNo:int = 1
field wb:any
{method public {init}:void
{set self.g_xlApp = {ActiveXObject ProgId= "Excel.Application"}}
set self.wb = {self.g_xlApp.Workbooks.Add}
{set self.xlSheetReport = self.g_xlApp.ActiveSheet}
}
{method public {psubSheetSet_Detail }:void
||ãã£ãã¼ã«ç·¨é
{let with-1:any = self.xlSheetReport}
||NO.
||â».ãç¶ããªãã¯ã
{set {with-1.Cells self.w_lngRDLine, 1}.Value = self.w_lngRDLineNo}
||åºé¨èª²ã³ã¼ã
||-- {if {Variant-to-Boolean {vb-var-diff {self.w_typRD.get-value self.w_lngRDCount}.TENBUKA_CD, vbNullString}} then
||-- ||â».ãç¶ããªãã¯ã
||-- {set {with-1.Cells self.w_lngRDLine, 2}.Value = {self.w_typRD.get-value self.w_lngRDCount}.TENBUKA_CD}
||-- }
||-- ||é¨èª²åºæ
||-- {if {Variant-to-Boolean {vb-var-diff {self.w_typRD.get-value self.w_lngRDCount}.TENBUKA_RK, vbNullString}} then
||-- ||â».ãç¶ããªãã¯ã
||-- {set {with-1.Cells self.w_lngRDLine, 3}.Value = {self.w_typRD.get-value self.w_lngRDCount}.TENBUKA_RK}
||-- }
||-- ||å¥ç´å
ã³ã¼ã
||-- {if {Variant-to-Boolean {vb-var-diff {self.w_typRD.get-value self.w_lngRDCount}.KEIYAKU_CD, vbNullString}} then
||-- ||â».ãç¶ããªãã¯ã
||-- {set {with-1.Cells self.w_lngRDLine, 4}.Value = {self.w_typRD.get-value self.w_lngRDCount}.KEIYAKU_CD}
||-- }
||-- ||å¥ç´å
å
||-- {if {Variant-to-Boolean {vb-var-diff {self.w_typRD.get-value self.w_lngRDCount}.KEIYAKU_NM, vbNullString}} then
||-- ||â».ãç¶ããªãã¯ã
||-- {set {with-1.Cells self.w_lngRDLine, 5}.Value = {self.w_typRD.get-value self.w_lngRDCount}.KEIYAKU_NM}
||-- }
||-- ||åå¼å½¢æ
||-- {if {Variant-to-Boolean {vb-var-diff {self.w_typRD.get-value self.w_lngRDCount}.TORIKEI_KBN, vbNullString}} then
||-- ||â».ãç¶ããªãã¯ã
||-- {set {with-1.Cells self.w_lngRDLine, 6}.Value = {g_objConsTori.Item {self.w_typRD.get-value self.w_lngRDCount}.TORIKEI_KBN}.Value}
||-- }
||-- ||ï¼ï¼¦
||-- {if {Variant-to-Boolean {vb-var-diff {self.w_typRD.get-value self.w_lngRDCount}.MF_KBN, " "}} then
||-- ||â».ãç¶ããªãã¯ã
||-- {set {with-1.Cells self.w_lngRDLine, 7}.Value = {g_objConsMF.Item {self.w_typRD.get-value self.w_lngRDCount}.MF_KBN}.Value}
||-- }
||-- ||å¥ç´çªå·
||â».ãç¶ããªãã¯ã
||REV
||â».ãç¶ããªãã¯ã
{set {with-1.Cells self.w_lngRDLine, 9}.Value = "ABC"}
||éå§æ¥
||â».ãç¶ããªãã¯ã
{set {with-1.Cells self.w_lngRDLine, 10}.Value = {{proc {}:String
let byref-1:{FastArray-of String} = {{FastArray-of String} "XYZ"}
let ret:String = "RET"
{return ret}}}}
||ï¼²
{if false then
else
||-- {if {Variant-to-Boolean {vb-var-equal {Trim {self.w_typRD.get-value self.w_lngRDCount}.REMARK}, "1"}} then
||-- ||â».ãç¶ããªãã¯ã
||-- {set {with-1.Cells self.w_lngRDLine, 11}.Value = "*"}
||-- else
||-- ||â».ãç¶ããªãã¯ã
||-- {set {with-1.Cells self.w_lngRDLine, 11}.Value = {self.w_typRD.get-value self.w_lngRDCount}.REMARK}
||-- }
}
||å®è¡é«å·®é¡
||â».ãç¶ããªãã¯ã
{set {with-1.Cells self.w_lngRDLine, 12}.Value = 100.0}
||ç²å©çï¼å¤æ´åï¼
||â».ãç¶ããªãã¯ã
{set {with-1.Cells self.w_lngRDLine, 13}.Value = 200.0}
||ç²å©çï¼å¤æ´å¾ï¼
||â».ãç¶ããªãã¯ã
{set {with-1.Cells self.w_lngRDLine, 14}.Value = 300.0
}
||ç²å©çï¼å·®é¡ï¼
||â».ãç¶ããªãã¯ã
{set {with-1.Cells self.w_lngRDLine, 15}.Value = 400.0
}
{set self.w_lngRDLine = self.w_lngRDLine + 1}
{set self.w_lngRDLineNo = self.w_lngRDLineNo + 1}
}
{method public {save}:void
{self.wb.SaveAs "test.xls"}
}
}
{DateTime}
{value
def t = {ExcelTest}
{t.init}
{t.psubSheetSet_Detail}
{t.save}
t
}
{DateTime}