Visual Studio 2003 Sample project:
http://roxsu.tw.googlepages.com/webtimebar.zip
一直以來常用到後端 SQL 或 AP Server 大量長時間 運算的程序, User 老是以為當機, 找了好久, Web 版計時器始終沒有合用的, 後來只好自己利用 Ajax 完成了 這個不錯用的時間計時器.
Visual Studio 2003 Sample project:
http://roxsu.tw.googlepages.com/webtimebar.zip
Set Safety Off
Set Exact On
If Rpl_unicode("D:\RPT\", "D:\RPTS\")
Messagebox("Transfer OK!!")
Endif
Set Safety On
Function Rpl_unicode
Para wic, wicnew
olebig=Createobject('Hokoy.WordKit')
*!* 函式名稱 參數形式 傳回值形式
*!* GBtoBig5 GB Big5
*!* BIG5toGB Big5 GB
*!* GBtoUnicode GB Unicode
*!* Big5toUnicode Big5 Unicode
*!* UnicodetoGB Unicode GB
*!* UnicodetoBig5 Unicode Big5
*!* SCtoTC Unicode簡體字 Unicode繁體字
*!* TCtoSC Unicode繁體字 Unicode簡體字
Local LLC,MTXT,CTMP, MRPL
Local oCR As CRAXDRT.Application
Local oRpt As CRAXDRT.Report
If Para()<>2
=Messagebox('error',48,'error of path!!')
Return .F.
Endif
getfilenum=Adir(getfiles,wic+'*.rpt')
For ii=1 To getfilenum
Wait Wind 'process Prog: '+getfiles[ii,1] At 8,35 Nowait
*-------------------
oCR = Createobject("CrystalRuntime.Application")
oRpt = oCR.OpenReport(wic+ getfiles[ii,1])
For jj=1 To oRpt.Areas.Count
For kk=1 To oRpt.Areas.Item(jj).Sections.Count
For ll=1 To oRpt.Areas.Item(jj).Sections.Item(kk).ReportObjects.Count
yy = oRpt.Areas.Item(jj).Sections.Item(kk).ReportObjects.Item(ll)
If yy.Kind=2 && text obj
v_objn =0
v_hasobj=.F. && has obj in text?
*---------------save text - obj to array --------------------
If yy.FieldElements.Count>0
v_objn=yy.FieldElements.Count
v_hasobj=.T.
Dimension txtobj(v_objn,3)
For pp=1 To v_objn
txtobj(pp,1)=yy.FieldElements.Item(pp).FieldDefinition
txtobj(pp,3)=yy.FieldElements.Item(pp).Font.bold && 儲存BOLD狀態
Endfor
Endif
*---------------save text - obj to array -------------------
m.MTXT=Alltrim(yy.Text)
m.MRPL=m.MTXT && for replace
If Len(m.MRPL) > 0 && 一次轉換繁體->簡體UNICODE
v_uncode = olebig.TCtoSC(m.MRPL)
m.MRPL = v_uncode
Endif
If v_hasobj
*---------------save text - obj to text --------------------
For pp=1 To v_objn
txtobj(pp,2)=Atcc('[]',m.MRPL,pp) && 因為ADD用中文算字數所以用ATCC
Endfor
m.MRPL=Strtran(m.MRPL, '[]', '')
oRpt.Areas.Item(jj).Sections.Item(kk).ReportObjects.Item(ll).settext(m.MRPL)
For pp=1 To v_objn
yy.FieldElements.Add(txtobj(pp,2),txtobj(pp,1))
yy.FieldElements.Item(pp).Font.bold = txtobj(pp,3)
Endfor
*---------------save text - obj to text -------------------
Else
oRpt.Areas.Item(jj).Sections.Item(kk).ReportObjects.Item(ll).settext(m.MRPL)
Endif
oRpt.Areas.Item(jj).Sections.Item(kk).ReportObjects.Item(ll).Font.Name="SimSun"
If v_hasobj && bold 字型設定後才有效
For pp=1 To v_objn
yy.FieldElements.Item(pp).Font.bold = txtobj(pp,3)
Endfor
Endif
Endif
If yy.Kind=1
oRpt.Areas.Item(jj).Sections.Item(kk).ReportObjects.Item(ll).Font.Name="SimSun"
Endif
Endfor
Endfor
Endfor
oRpt.Save(Trim(wicnew)+ Alltrim(getfiles[ii,1]))
Endfor
Return .T.
Endfunc