tian_rose
Mon, 10 Mar 2008 07:12:25 -0700
Hi Friedger, Thank you for your reply. If only serveral cells are set and saved to a xls file, it may not cost long time, but there are about 1000 records X 20 columns large, so it costs much longer.
I'm sorry I cannot provide an executable sample because my
application used a complicated server side data source,
and I cannot simplify it for now.
--- Friedger M醇・fke <[EMAIL PROTECTED]> wrote:
> 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 gurus
> >
> > I 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 VB
> > application.
> >
> > 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}
> ||-- }
> ||-- ||MF
> ||-- {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}}}}
> ||R
> {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}
>
>