12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194 |
- $PBExportHeader$n_dw2xls_requestor.sru
- forward
- global type n_dw2xls_requestor from nonvisualobject
- end type
- end forward
- global type n_dw2xls_requestor from nonvisualobject
- end type
- global n_dw2xls_requestor n_dw2xls_requestor
- type prototypes
- end prototypes
- type variables
- Private:
- DataWindow idw_Requestor
- Datastore ids_Requestor
- DataWindowChild idwc_Requestor
- DataStore ids_Composite
- Object ipo_Type
-
- DWObject idwo_Parent
- Boolean ib_Child =False
- Boolean ib_Nested=False
- Int ii_GroupLevels //分组数
- Boolean ib_Detail_Begin
- Int ii_Rows_Per_Detail=1
- Long il_RowCount
-
- Boolean ib_PrintPreview =False
- Int ii_PrintColumns
- Int ii_PrintColumnsWidth
-
- Int ii_HeaderCount //交叉报表表头区数目
- String is_Processing
- String is_Units
- Long il_X, il_Y //如果当前对象是子数据窗口,则保存子数据窗口的位置
- Long il_X2 ,il_Y2
- Long il_Header_BeginY =60000
- String is_Header_BeginBand ="header"
-
- Long il_BKColor
- Boolean ib_GroupNewPage[]
-
-
- n_dw2xls_band inv_Bands[] //所有带区对象
- n_dw2xls_Object inv_ChildReports[]
- n_dw2xls_Object inv_NestReports[]
- n_dw2xls_Layout inv_Layout
- n_dw2xls_winApi inv_Api
- n_dw2xls_Progress inv_Progress
- n_dw2xls_Expression inv_Exps[]
- Long il_LastExpUpdateRow
-
- Int ii_FirstColumn =30000
- Int ii_LastColumn
- CONSTANT String DW2XLS_BANDCOLOR ='dw2xls_bandcolor'
- CONSTANT String DW2XLS_SKIPBORDER = "dw2xls_skipborder"
- CONSTANT String DW2XLS_VERSION='4.5.2012.1105' //当前程序的版本号,用于版本跟踪
- /*---------------------------------------------------------------------------------
- 程序如有问题需要反馈,请与我联系,谢谢!
-
- 黄国酬
- EMAIL: huanggc@163.com
- QQ: 46875483
- HTTP: www.dw2xls.com
- ------------------------------------------------------------------------------------*/
-
- end variables
- forward prototypes
- public function string of_describe (readonly string as_syntax)
- public function double of_getitemnumber (readonly long al_row, readonly string as_name)
- public function string of_getitemstring (readonly long al_row, readonly string as_name)
- public function n_dw2xls_band of_getband (readonly string as_name)
- public function string of_describe (readonly string as_name, readonly string as_property)
- public subroutine of_getproperty (readonly string as_name, readonly string as_property, ref string as_value, ref string as_exp)
- public function boolean of_containtband (string as_name)
- public function string of_modify (readonly string as_syntax)
- public function String of_getprocessing ()
- public function String of_getunits ()
- public function long of_rowcount ()
- public function datetime of_getitemdatetime (readonly long al_row, readonly string as_name)
- public function date of_getitemdate (readonly long al_row, readonly string as_name)
- public subroutine of_getdwinfo ()
- private function integer of_getobjects ()
- public function time of_getitemtime (readonly long al_row, readonly string as_name)
- public function Boolean of_ischild ()
- public function string of_evaluate (long al_row, string as_exp)
- public subroutine of_getproperty (readonly string as_property, ref string as_value, ref string as_exp)
- public function long of_parsetoarray (string as_source, string as_delimiter, ref string as_array[])
- protected function long of_lastpos (string as_source, string as_target, long al_start)
- protected function long of_lastpos (string as_source, string as_target)
- public function long of_arraytostring (readonly string as_source[], readonly string as_delimiter, ref string as_ref_string)
- public function string of_replaceall (readonly string as_oldstr, readonly string as_findstr, readonly string as_repstr)
- public subroutine of_dataformat (ref string as_format, ref string as_exp, string as_coltype)
- public function long of_findgroupchange (readonly long al_row, readonly integer ai_level)
- public subroutine of_getrowindetail ()
- public subroutine of_getsparse ()
- public function string of_getnextband (readonly string as_name)
- public subroutine of_setrow (long al_row)
- public function n_dw2xls_layout of_getlayout ()
- public subroutine of_registcolumninfo ()
- public subroutine of_getcolrowinfo ()
- public function Long of_getbkcolor ()
- public function string of_gettext (readonly long al_row, readonly string as_name, string as_coltype, readonly string as_format)
- public function integer of_setrequestor (powerobject apo, ref n_dw2xls_progress anv_progress)
- private function integer of_setrequestor (powerobject apo, ref n_dw2xls_progress anv_progress, ref n_dw2xls_layout anv_layout)
- public function Boolean of_isdetail_begin ()
- public subroutine of_groupcalc ()
- public function string of_getheader_beginband ()
- public function Boolean of_checkoutpictures ()
- public function integer of_clipboard (readonly string as_name)
- public subroutine of_setwinapi (n_dw2xls_winapi anv_api)
- public function n_dw2xls_winapi of_getwinapi ()
- public function Boolean of_iscancel ()
- public function Boolean of_isdatawindowchild ()
- public function boolean of_iswritepictures ()
- public function boolean of_iswritebkcolor ()
- public subroutine of_updatecolumninfo ()
- public subroutine of_write_printsetting (readonly unsignedlong al_hsheet)
- public function double of_getitemnumber (readonly long al_row, readonly integer ai_column)
- public function string of_getitemstring (readonly long al_row, readonly integer ai_column)
- public function datetime of_getitemdatetime (readonly long al_row, readonly integer ai_column)
- public function date of_getitemdate (readonly long al_row, readonly integer ai_column)
- public function time of_getitemtime (readonly long al_row, readonly integer ai_column)
- public subroutine of_addexpression (ref string as_exp)
- public subroutine of_updateexpvalues (readonly long al_row)
- public function string of_getexpvalue (readonly string as_exp, readonly integer ai_rowindetail)
- public subroutine of_updatereport (readonly long al_row, readonly string as_name, ref n_dw2xls_requestor anv_report)
- public function Boolean of_isvalid_dwomaster ()
- public function string of_getdisplayvalue (readonly long al_row, readonly integer ai_colid, readonly string as_name, readonly boolean ab_isclone, readonly string as_editstyle, readonly string as_coltype)
- public function Integer of_getchild (string as_name, ref datawindowchild adwc)
- public function integer of_getchild (readonly long al_row, readonly string as_name, ref dwobject dwo)
- public function boolean of_isnested ()
- public subroutine of_updatenestreport ()
- public subroutine of_registcolumninfo_1 ()
- public subroutine of_registcolumninfo_2 ()
- public subroutine of_registcolumninfo_3 ()
- public subroutine of_getobjectposition (readonly string as_band, readonly string as_type, readonly string as_name, ref long ai_x1, ref long ai_y1, ref long ai_x2, ref long ai_y2, ref string as_x1_exp, ref string as_y1_exp, ref string as_x2_exp, ref string as_y2_exp)
- public function Long of_getbandheight (readonly string as_band)
- public function long of_getreport_x1 ()
- public function Long of_getheader_beginy ()
- public function Long of_getcontrolheight ()
- public function Long of_getcontrolwidth ()
- public function Long of_getreport_x2 ()
- public function boolean of_initialreport (n_dw2xls_object anv_object, readonly long ai_x, readonly long ai_y, readonly long ai_x2, readonly long ai_y2)
- public function integer of_getfirstcolumn ()
- public function integer of_getlastcolumn ()
- public subroutine of_setfirstcolumn (readonly integer ai_column)
- public subroutine of_setlastcolumn (readonly integer ai_column)
- public function integer of_getarguments (readonly long al_row, readonly string as_arguments, string as_nestarguments, ref any aa_argvalue[], ref string as_argtype[])
- public function long of_output (readonly unsignedlong al_hsheet, readonly long al_beginrow)
- public function integer of_getobject_x1 (readonly string as_name)
- public function integer of_getobject_x2 (readonly string as_name)
- end prototypes
- public function string of_describe (readonly string as_syntax);
- String ls_Result
- Try
- Choose Case ipo_Type
- Case DataWindow!
- ls_Result= idw_Requestor.Describe(as_Syntax)
- Case DataStore!
- ls_Result= ids_Requestor.Describe(as_Syntax)
- Case DataWindowChild!
- ls_Result= idwc_Requestor.Describe(as_Syntax)
- END CHOOSE
-
- IF ( Left(ls_Result,1)="'" AND Right(ls_Result,1)="'" ) OR &
- ( Left(ls_Result,1)='"' AND Right(ls_Result,1)='"' ) Then
-
- ls_Result = Mid(ls_Result,2, Len(ls_Result) -2)
- END IF
- Catch(DWRunTimeError dwError)
- Return ""
- Catch(RuntimeError er)
- Return ""
- END TRY
-
- Return ls_Result
- end function
- public function double of_getitemnumber (readonly long al_row, readonly string as_name);IF al_Row<=0 OR al_Row>il_RowCount Then
- Return 0
- END IF
- Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.GetItemNumber(al_Row,as_Name)
- Case DataStore!
- Return ids_Requestor.GetItemNumber(al_Row,as_Name)
- Case DataWindowChild!
- Return idwc_Requestor.GetItemNumber(al_Row,as_Name)
- END CHOOSE
- Return 0
- end function
- public function string of_getitemstring (readonly long al_row, readonly string as_name);IF al_Row<=0 OR al_Row>il_RowCount Then
- Return""
- END IF
- Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.GetItemString(al_Row,as_Name)
- Case DataStore!
- Return ids_Requestor.GetItemString(al_Row,as_Name)
- Case DataWindowChild!
- Return idwc_Requestor.GetItemString(al_Row,as_Name)
- END CHOOSE
- Return ""
- end function
- public function n_dw2xls_band of_getband (readonly string as_name);Int li
- For li=1 To UpperBound(inv_Bands)
- IF inv_Bands[li].OF_GetName() = as_Name Then
- Return inv_Bands[li]
- END IF
- Next
- li = UpperBound(inv_Bands)+1
- inv_Bands[li] = Create n_dw2xls_Band
- inv_Bands[li].OF_SetRequestor(This, as_Name )
-
- Return inv_Bands[li]
- end function
- public function string of_describe (readonly string as_name, readonly string as_property);Return OF_Describe(as_Name+"."+as_Property)
- end function
- public subroutine of_getproperty (readonly string as_name, readonly string as_property, ref string as_value, ref string as_exp);String ls_Band
- OF_GetProperty(as_Name+"."+as_Property, as_Value, as_Exp)
- IF as_Exp<>'' AND OF_RowCount()>0 Then
- ls_Band =OF_Describe(as_Name+".Band")
- IF Pos(ls_Band,"header")>0 OR ls_Band="foreground" OR ls_Band="background" Then
- as_Value =OF_Evaluate(1, as_Exp)
- as_Exp=""
- ELSEIF ls_Band="summary" OR ls_Band="footer" Then
- as_Value = OF_Evaluate(OF_RowCount(), as_Exp)
- as_Exp=""
- END IF
- END IF
- IF as_Exp<>"" AND Lower(as_Property)<>"visible" Then
- OF_AddExpression(as_Exp)
- END IF
-
- end subroutine
- public function boolean of_containtband (string as_name);Int li
- For li=1 To UpperBound(inv_Bands)
- IF inv_Bands[li].OF_GetName() = as_Name Then
- Return TRUE
- END IF
- Next
- Return False
- end function
- public function string of_modify (readonly string as_syntax);TRY
- Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.Modify(as_Syntax)
- Case DataStore!
- Return ids_Requestor.Modify(as_Syntax)
- Case DataWindowChild!
- Return idwc_Requestor.Modify(as_Syntax)
- END CHOOSE
- Catch(DWRunTimeError dwError)
- MessageBox("OF_Modify Error",dwError.Text+"~r~n~r~nSyntax:~r~n"+as_Syntax,Exclamation!)
- Return "!"
- Catch(RunTimeError er)
- MessageBox("OF_Modify Error",er.Text+"~r~n~r~nSyntax:~r~n"+as_Syntax,Exclamation!)
- Return "!"
- END TRY
- Return "!"
- end function
- public function String of_getprocessing ();Return is_Processing
- end function
- public function String of_getunits ();Return is_Units
- end function
- public function long of_rowcount ();//Choose Case ipo_Type
- // Case DataWindow!
- // Return idw_Requestor.RowCount()
- // Case DataStore!
- // Return ids_Requestor.RowCount()
- // Case DataWindowChild!
- // Return idwc_Requestor.RowCount()
- //END CHOOSE
- Return il_RowCount
- end function
- public function datetime of_getitemdatetime (readonly long al_row, readonly string as_name);
- IF al_Row<=0 OR al_Row>il_RowCount Then
- Return DateTime(1900-01-01,00:00:00)
- END IF
- Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.GetItemDateTime(al_Row,as_Name)
- Case DataStore!
- Return ids_Requestor.GetItemDateTime(al_Row,as_Name)
- Case DataWindowChild!
- Return idwc_Requestor.GetItemDateTime(al_Row,as_Name)
- END CHOOSE
- Return DateTime(1900-01-01,00:00:00)
- end function
- public function date of_getitemdate (readonly long al_row, readonly string as_name);IF al_Row<=0 OR al_Row>il_RowCount Then
- Return 1900-01-01
- END IF
- Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.GetItemDate(al_Row,as_Name)
- Case DataStore!
- Return ids_Requestor.GetItemDate(al_Row,as_Name)
- Case DataWindowChild!
- Return idwc_Requestor.GetItemDate(al_Row,as_Name)
- END CHOOSE
- Return Date(1900-01-01)
- end function
- public subroutine of_getdwinfo ();string ls_Temp
- int li,li_pos,li_Pos2,li_groupcount
-
- is_Processing = OF_Describe("DataWindow.Processing")
- is_Units = OF_Describe("DataWindow.Units")
- il_BKColor = inv_Api.OF_GetColor( Long(OF_Describe("DataWindow.Color")) )
- IF is_Processing="4" Then
- OF_Modify("DataWindow.Crosstab.StaticMode=Yes")
- END IF
- ls_Temp=OF_Describe("datawindow.bands")
- li_pos=1
- Do While li_pos>0
- li_pos=Pos(ls_Temp,"header.",li_pos)
- IF li_pos>0 Then
- ii_GroupLevels++
- li_pos++
- END IF
- Loop
- li_pos=1
- Do While li_pos>0
- li_pos=Pos(ls_Temp,"header[",li_pos)
- IF li_pos>0 Then
- ii_HeaderCount++
- li_pos++
- END IF
- Loop
- IF ii_GroupLevels >0 Then
- ls_Temp=OF_Describe("datawindow.syntax")
- li_Pos=Pos(ls_Temp,"group(level=1 ")
- IF li_Pos>0 Then
- ls_Temp=Mid(ls_Temp,li_Pos)
- li_Pos =1
- li=1
- END IF
-
- Do While li_Pos>0
- li_Pos2=Pos(ls_Temp,"group(level="+String(li+1) )
- IF li_Pos2>0 Then
- li_Pos= pos(Mid(ls_Temp,li_Pos2 - li_Pos),"newpage=yes")
- ELSE
- li_Pos= pos(ls_Temp,"newpage=yes",li_Pos)
- END IF
-
- IF li_Pos>0 Then
- ib_GroupNewPage[li]=True
- ELSE
- ib_GroupNewPage[li]=False
- END IF
-
- li_Pos=li_Pos2
- li++
- Loop
- END IF
- IF ii_GroupLevels>0 Then
- OF_GroupCalc()
- END IF
- end subroutine
- private function integer of_getobjects ();Long li,lj, li_cnt
- Long li_x1, li_y1, li_x2 , li_y2 ,li_Temp, li_Last_X2
- String ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp
- Long li_BandHeight
- String ls_Name, ls_Objects[] , ls_Crosstab_Columns[], ls_Band , ls_Type, ls_Value, ls_Exp,ls_Border
- Boolean lb_ForeGround ,lb_BandAutoHeight , lb_SkipBorder
- n_dw2xls_Band lnv_Band
- n_dw2xls_Object lnv_Object
- n_dw2xls_line lnv_Line ,lnv_Line2
- n_dw2xls_line lnv_LinesEmpty[]
- li_cnt =OF_ParseToArray(OF_Describe("DataWindow.Objects"),"~t",ls_Objects)
- IF is_Processing="4" Then
- OF_ParseToArray(OF_Describe("DataWindow.Crosstab.Columns"),",",ls_Crosstab_Columns)
- is_Header_BeginBand ="header[2]"
- ELSEIF is_Processing='3' Then
- li_BandHeight=30000
- END IF
- //对于表格形式的数据窗口,先取得最后可视列的位置
- IF is_Processing='1' OR is_Processing='4' Then
- For li=1 To li_cnt
- ls_Name = ls_Objects[li]
-
- ls_Band = OF_Describe(ls_Name, "Band")
- IF ls_Band<>"detail" Then
- Continue
- END IF
- OF_GetProperty(ls_Name, "Visible", ls_Value , ls_Exp)
- IF ( ls_Value='0' AND ls_Exp="" ) OR Trim(ls_Exp)='0' Then
- Continue
- END IF
- li_x1 = Long(OF_Describe(ls_Name+".x"))
- li_X2 = li_X1 + Long(OF_Describe(ls_Name+".Width"))
-
- IF li_X2>li_Last_X2 Then
- li_Last_X2 = li_X2
- END IF
- NEXT
-
- IF is_Units='1' Then
- li_Last_X2 = PixelsToUnits(li_Last_X2, XPixelsToUnits!)
- ELSEIF is_Units='2' Then
- li_Last_X2 = PixelsToUnits(inv_Api.OF_InchToPixels(li_Last_X2/1000 ) , XPixelsToUnits!)
- ELSEIF is_Units='3' Then
- li_Last_X2 = PixelsToUnits(inv_Api.OF_CMToPixels(li_Last_X2 /1000), XPixelsToUnits!)
- END IF
-
- IF li_Last_X2<0 AND is_Units<>'0' Then
- li_Last_X2 +=65536
- END IF
-
- //如果子数据窗口是一个Crosstab类型的数据窗口,则Report的位置要根据新的位置更新
- IF ib_Child AND is_Processing='4' Then
- il_X2 = il_X + li_Last_X2
- END IF
-
- END IF
-
- For li=1 To li_cnt
- ls_Name = ls_Objects[li]
-
- ls_Type = OF_Describe(ls_Name,"Type")
- ls_Band = OF_Describe(ls_Name, "Band")
- IF ls_Band="?" OR ls_Band="!" Then
- Continue
- END IF
-
- OF_GetProperty(ls_Name, "Visible", ls_Value , ls_Exp)
- IF ( ls_Value='0' AND ls_Exp="" ) OR Trim(ls_Exp)='0' Then
- Continue
- END IF
- IF ( is_Processing='1' OR is_Processing='4' ) Then
-
- ls_Border = OF_Describe(ls_Name,"Border")
- IF ls_Border='4' AND ( ls_Band="foreground" OR ls_Band="background" ) Then
- OF_GetObjectPosition(ls_Band , ls_Type,ls_Name, li_x1, li_y1, li_x2,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp )
- IF li_x1<100 AND (li_X2+100)>li_Last_X2 Then
- IF li_Y2<il_Header_BeginY AND li_Y2>0 Then
- il_Header_BeginY = li_Y2
- END IF
- END IF
- END IF
-
- IF ( ls_Band="foreground" OR ls_Band="background" ) AND ls_Type="text" Then
- IF OF_Describe(ls_Name+".Text")="" Then
- Continue
- END IF
- END IF
-
- IF ls_Name="sys_lastcol" AND ls_Band='detail' Then
- Continue
- END IF
-
- IF is_Processing="1" Then
- IF ls_Band="header" AND ( ls_Type="text" OR ls_Type="column" OR ls_Type="compute" ) Then
- li_Y1 = Long(OF_Describe(ls_Name+".Y"))
- IF li_Y1<il_Header_BeginY Then
- il_Header_BeginY = li_Y1
- END IF
- END IF
- ELSEIF is_Processing="4" AND Pos(ls_Band,"header")>0 Then
- For lj=1 To UpperBound(ls_Crosstab_Columns)
- IF ls_Name =ls_Crosstab_Columns[lj]+"_t" Then
- li_Y1 = Long(OF_Describe(ls_Name+".Y"))
- IF li_Y1<il_Header_BeginY Then
- il_Header_BeginY = li_Y1
- is_Header_BeginBand = ls_Band
- END IF
- Exit
- END IF
- NEXT
- END IF
- END IF
-
- IF ls_Band="foreground" OR ls_Band="background" Then
- IF is_Processing='4' Then
- ls_Band="header[1]"
- ELSE
- ls_Band="header"
- END IF
- lb_ForeGround =TRUE
- ELSE
- lb_ForeGround=False
- END IF
-
- IF is_Processing<>'3' Then
- lb_BandAutoHeight =False
- IF Not lb_ForeGround Then
- IF OF_Describe("DataWindow."+ls_Band+".Height.AutoSize")="yes" Then
- lb_BandAutoHeight =TRUE
- END IF
- END IF
-
- li_BandHeight =OF_GetBandHeight(ls_Band)
- IF li_BandHeight=0 AND lb_BandAutoHeight=False Then
-
- //如果隐藏了细节区,则直接注册登记列的起止位置
- IF is_Processing='1' OR is_Processing='4' AND ls_Band="detail" Then
- li_X1= OF_GetObject_X1( ls_Name)
- IF OF_IsChild() Then
- inv_Layout.OF_RegistObject(li_X1 ,TRUE )
- ELSE
- inv_Layout.OF_RegistColumn(li_X1)
- END IF
- END IF
-
- Continue
- END IF
- END IF
- //无效的计算公式
- IF ls_Type="compute" Then
- ls_Value=OF_Describe(ls_Name+".ColType")
- IF ls_Value="" OR ls_Value="!" OR ls_Value="?" Then
- Continue
- END IF
- END IF
-
- IF Lower(OF_Describe(ls_Name+".tag"))=DW2XLS_BANDCOLOR Then
- lnv_Band = OF_GetBand(ls_Band)
- IF ls_Type="rectangle" OR ls_Type="roundrectangle" Then
- OF_GetProperty(ls_Name, "Brush.Color", ls_Value , ls_Exp)
- ELSE
- OF_GetProperty(ls_Name, "BackGround.Color", ls_Value , ls_Exp)
- END IF
- lnv_Band.OF_SetBKColor(Long(ls_Value), ls_Exp)
- Continue
- END IF
- IF Pos(Lower(OF_Describe(ls_Name+".tag")),DW2XLS_SKIPBORDER)>0 Then
- lb_SkipBorder =TRUE
- ELSE
- lb_SkipBorder =False
- END IF
-
- Choose Case ls_Type
- Case "line","rectangle","roundrectangle"
-
- //如果是Grid或Crosstab形式的数据窗口,则忽略线条
- IF is_Processing="1" OR is_Processing="4" OR lb_SkipBorder Then
- Continue
- END IF
-
- OF_GetObjectPosition(ls_Band , ls_Type,ls_Name, li_x1, li_y1, li_x2,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp )
- IF li_y1>li_BandHeight AND lb_BandAutoHeight=False Then
- Continue
- END IF
-
- IF li_y2>li_BandHeight AND lb_BandAutoHeight=False Then
- li_Y2= li_BandHeight
- END IF
-
- lnv_Band = OF_GetBand(ls_Band)
- li_x1 = li_x1 +il_x
- li_x2 = li_x2 +il_x
-
- IF ib_Child Then
- IF li_X1>il_x2 Then
- Continue
- END IF
-
- IF li_X2>il_x2 Then
- li_X2 = il_x2
- END IF
- END IF
-
- IF ls_Type="line" Then
- IF ( li_x2 - li_x1)>=100 AND (li_y2 - li_y1)<=5 Then //横线
- lnv_Line =Create n_dw2xls_Line
- lnv_Line.VisibleExp = ls_Exp
- lnv_Line.OF_SetPosition(li_x1, li_y1, li_x2 ,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp)
- lnv_Line.OF_SetRequestor(This, ls_Type, ls_Name, TRUE )
- lnv_Band.OF_AddHLine(lnv_Line)
-
- ELSEIF (li_y2 - li_y1)>=50 AND (li_x2 - li_x1)<=5 Then //竖线
- lnv_Line =Create n_dw2xls_Line
- lnv_Line.VisibleExp = ls_Exp
- lnv_Line.OF_SetPosition(li_x1, li_y1, li_x2 ,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp)
- lnv_Line.OF_SetRequestor(This, ls_Type, ls_Name,FALSE )
- lnv_Band.OF_AddVLine(lnv_Line)
- END IF
- ELSE
- IF ( li_x2 - li_x1)>=100 AND (li_y2 - li_y1)>=50 Then //当成四条线
- lnv_Line =Create n_dw2xls_Line
- lnv_Line.VisibleExp = ls_Exp
- lnv_Line.OF_SetPosition(li_x1, li_y1, li_x2 ,li_y1 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp) //上
- lnv_Line.OF_SetRequestor(This, ls_Type, ls_Name , TRUE )
- lnv_Band.OF_AddHLine(lnv_Line)
-
- lnv_Line =Create n_dw2xls_Line
- lnv_Line.VisibleExp = ls_Exp
- lnv_Line.OF_SetPosition(li_x1, li_y2, li_x2 ,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp) //下
- lnv_Line.OF_SetRequestor(This, ls_Type, ls_Name ,TRUE )
- lnv_Band.OF_AddHLine(lnv_Line)
-
- lnv_Line =Create n_dw2xls_Line
- lnv_Line.VisibleExp = ls_Exp
- lnv_Line.OF_SetPosition(li_x1, li_y1, li_x1 ,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp) //左
- lnv_Line.OF_SetRequestor(This, ls_Type, ls_Name,FALSE )
- lnv_Band.OF_AddVLine(lnv_Line)
-
- lnv_Line =Create n_dw2xls_Line
- lnv_Line.VisibleExp = ls_Exp
- lnv_Line.OF_SetPosition(li_x2, li_y1, li_x2 ,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp) //右
- lnv_Line.OF_SetRequestor(This, ls_Type, ls_Name, FALSE )
- lnv_Band.OF_AddVLine(lnv_Line)
-
- ELSEIF ( li_x2 - li_x1)>=100 AND (li_y2 - li_y1)<30 Then //当成一条横线
- lnv_Line =Create n_dw2xls_Line
- lnv_Line.VisibleExp = ls_Exp
- lnv_Line.OF_SetPosition(li_x1, li_y1, li_x2 ,li_y1 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y1_Exp)
- lnv_Line.OF_SetRequestor(This, ls_Type, ls_Name ,TRUE )
- lnv_Band.OF_AddHLine(lnv_Line)
- ELSEIF ( li_x2 - li_x1)<30 AND (li_y2 - li_y1)>=50 Then //当成一条竖线
- lnv_Line =Create n_dw2xls_Line
- lnv_Line.VisibleExp = ls_Exp
- lnv_Line.OF_SetPosition(li_x1, li_y1, li_x1 ,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X1_Exp, ls_Y2_Exp)
- lnv_Line.OF_SetRequestor(This, ls_Type, ls_Name ,FALSE )
- lnv_Band.OF_AddVLine(lnv_Line)
- END IF
- END IF
- Continue
-
- Case "ole","ellipse","oval" ,"tableblob" , "button","groupbox" //以下对象不支持 //
- Continue
- Case Else
-
- OF_GetObjectPosition(ls_Band , ls_Type,ls_Name, li_x1, li_y1, li_x2,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp )
-
- IF (li_x2 - li_x1)<=10 Then //如果对象的位置在数据窗口上是看不见的,则不处理该对象
- Continue
- END IF
-
- IF (li_y2 - li_y1)<=10 Then
- IF OF_Describe(ls_name,"Height.AutoSize")<>"yes" Then
- Continue
- END IF
- END IF
-
- IF li_y1>=li_BandHeight AND lb_BandAutoHeight=False Then
- Continue
- END IF
-
- IF li_y2>li_BandHeight AND lb_BandAutoHeight=False Then
- li_Y2= li_BandHeight
- END IF
-
-
- IF ( is_Processing='1' OR is_Processing='4' ) AND lb_ForeGround=False Then
- IF li_X1>li_Last_X2 Then //超出Grid的显示列的范围,则表示该对象对象数据列是被隐藏了
- Continue
- END IF
- IF (li_x2 - li_x1)<=30 Then //所在的列宽度大小了,也不导出了
- Continue
- END IF
- END IF
-
- ls_Border =OF_Describe(ls_Name+".Border")
- li_x1 = li_x1 +il_x
- li_x2 = li_x2 +il_x
-
- IF ib_Child Then
- IF ( li_X1+20)>=il_x2 Then
- Continue
- END IF
-
- IF li_X2>il_x2 Then
- li_X2 = il_x2
- END IF
- END IF
-
- IF ( ls_Border="2" OR ls_Border='4' ) AND is_Processing<>"1" AND is_Processing<>"4" AND &
- lb_SkipBorder=False AND( ls_Type="text" OR ls_Type="column" or ls_Type="compute" ) Then
-
- IF ( li_x2 - li_x1)>=100 AND (li_y2 - li_y1)>=50 Then
- lnv_Band = OF_GetBand(ls_Band)
- IF ls_Border="2" Then
- lnv_Line =Create n_dw2xls_Line
- lnv_Line.VisibleExp = ls_Exp
- lnv_Line.OF_SetPosition(li_x1, li_y1, li_x1 ,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp) //左
- lnv_Line.OF_SetRequestor(This, ls_Type, ls_Name , False )
- lnv_Band.OF_AddVLine(lnv_Line)
-
- lnv_Line =Create n_dw2xls_Line
- lnv_Line.VisibleExp = ls_Exp
- lnv_Line.OF_SetPosition(li_x2, li_y1, li_x2 ,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp) //右
- lnv_Line.OF_SetRequestor(This, ls_Type, ls_Name,False)
- lnv_Band.OF_AddVLine(lnv_Line)
-
- lnv_Line =Create n_dw2xls_Line
- lnv_Line.VisibleExp = ls_Exp
- lnv_Line.OF_SetPosition(li_x1, li_y1, li_x2 ,li_y1 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp) //上
- lnv_Line.OF_SetRequestor(This, ls_Type, ls_Name ,TRUE )
- lnv_Band.OF_AddHLine(lnv_Line)
- END IF
- lnv_Line =Create n_dw2xls_Line
- lnv_Line.VisibleExp = ls_Exp
-
- lnv_Line.OF_SetPosition(li_x1, li_y2, li_x2 ,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp) //下
- lnv_Line.OF_SetRequestor(This, ls_Type, ls_Name ,TRUE )
- lnv_Band.OF_AddHLine(lnv_Line)
- END IF
- END IF
- END CHOOSE
-
- //如果文本对象只是用于设置边框,则在输出时忽略该对象
- IF ls_Type="text" AND ( ls_Border='2' OR ls_Border='4' ) Then
- IF OF_Describe(ls_Name+".Text")="" Then
- Continue
- END IF
- END IF
-
- lnv_Band = OF_GetBand(ls_Band)
- IF lnv_Band.OF_ExistsObject(ls_Name) Then
- Continue
- END IF
-
- lnv_Object = Create n_dw2xls_Object
-
- lnv_Object.IsForeGround = lb_ForeGround
- lnv_Object.VisibleExp = ls_Exp
- lnv_Object.SkipBorder = lb_SkipBorder
- lnv_Object.OF_SetPosition(li_x1, li_y1, li_x2 ,li_y2 ,ls_X1_Exp , ls_Y1_Exp, ls_X2_Exp, ls_Y2_Exp) //必须先设置位置信息
- lnv_Object.OF_SetRequestor(This,lnv_Band, ls_Type, ls_Name)
-
- IF ib_Child Then
- IF ( lnv_Object.OF_GetTextRect_X1()+30)>il_x2 Then //显示的内容超过子数据窗口的显示范围
- Continue
- END IF
- END IF
-
- lnv_Band.OF_AddObject(lnv_Object)
-
- IF (ls_Y1_Exp<>'' OR ls_Y2_Exp<>'') AND is_Processing<>'1' AND is_Processing<>'4' Then
- lnv_Band.OF_SetDynamicRowInfo(TRUE)
- END IF
- Next
- //表头区边线设置的开始位置
- IF il_Header_BeginY=60000 Then
- il_Header_BeginY =0
- ELSE
- IF is_Units='1' Then
- il_Header_BeginY = PixelsToUnits(il_Header_BeginY, YPixelsToUnits!)
- ELSEIF is_Units='2' Then
- il_Header_BeginY = PixelsToUnits( inv_Api.OF_InchToPixels(il_Header_BeginY /1000), YPixelsToUnits!)
- ELSEIF is_Units='3' Then
- il_Header_BeginY = PixelsToUnits( inv_Api.OF_CMToPixels(il_Header_BeginY /1000), YPixelsToUnits!)
- END IF
-
- IF il_Header_BeginY<=0 AND is_Units<>'0' Then
- il_Header_BeginY+=65535
- END IF
-
- END IF
- //根据数据字段的位置,调整一下列标题的位置
- IF is_Processing="0" Then
- IF OF_ContaintBand("header") AND OF_ContaintBand("detail") Then
- lnv_Band = OF_GetBand("detail")
- IF lnv_Band.OF_GetVLinesCount()<3 Then //如果有线条,则按线条来处理位置,不自动调整
- OF_GetBand("header").OF_AdjustPosition(lnv_Band)
- END IF
- END IF
- //ELSEIF is_Processing='1' OR is_Processing='4' Then
- // For li=1 To UpperBound(inv_Bands)
- // inv_Bands[li].OF_AdjustPosition()
- // Next
- END IF
- //把带区的最后一条横边线,复制到下一带区,作为上边线
- IF is_Processing<>'1' AND is_Processing<>'4' THEN
- For li=1 To UpperBound(inv_Bands)
-
- //如果当前带区没有横线, 则不需要复制了
- IF UpperBound(inv_Bands[li].inv_HLines)<=0 Then
- Continue
- END IF
-
- ls_Name = OF_GetNextBand(inv_Bands[li].OF_GetName() )
- IF Not OF_ContaintBand(ls_Name) Then
- COntinue
- END IF
- li_Y2 = inv_Bands[li].OF_GetBandHeight()
- lnv_Band = OF_GetBand(ls_Name)
-
- For lj=1 TO UpperBound(inv_Bands[li].inv_HLines)
- lnv_Line = inv_Bands[li].inv_HLines[lj]
- IF lnv_Line.IsClone=False AND (lnv_Line.Y1 +inv_Layout.ii_RowSpace)>li_Y2 Then
- lnv_Line2 = Create n_dw2xls_Line
- lnv_Line2.IsClone =TRUE
- lnv_Line2.OF_SetPosition(lnv_Line.X1, 0, lnv_Line.X2, 0,lnv_Line.X1_Exp,"",lnv_Line.X2_Exp,"" )
- lnv_Line2.OF_SetRequestor(This, lnv_Line.ObjType,lnv_Line.Name, TRUE )
- lnv_Band.OF_AddHLine(lnv_Line2)
- END IF
- Next
-
- //把下一带区的上边线,复制到上一带区作下边线
- For lj=1 To UpperBound(lnv_Band.inv_HLines)
- lnv_Line = lnv_Band.inv_HLines[lj]
- IF lnv_Line.IsClone=False AND (lnv_Line.Y1 -inv_Layout.ii_RowSpace)<=0 Then
- lnv_Line2 = Create n_dw2xls_Line
- lnv_Line2.IsClone =TRUE
- lnv_Line2.OF_SetPosition(lnv_Line.X1, li_Y2, lnv_Line.X2,li_Y2,lnv_Line.X1_Exp ,"",lnv_Line.X2_Exp,"" )
- lnv_Line2.OF_SetRequestor(This, lnv_Line.ObjType,lnv_Line.Name,TRUE )
- inv_Bands[li].OF_AddHLine(lnv_Line2)
- END IF
- Next
- Next
- END IF
- OF_GetRowInDetail()
- OF_GetSparse()
- Return 1
- end function
- public function time of_getitemtime (readonly long al_row, readonly string as_name);IF al_Row<=0 OR al_Row>il_RowCount Then
- Return 00:00:00
- END IF
- Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.GetItemTime(al_Row,as_Name)
- Case DataStore!
- Return ids_Requestor.GetItemTime(al_Row,as_Name)
- Case DataWindowChild!
- Return idwc_Requestor.GetItemTime(al_Row,as_Name)
- END CHOOSE
- Return Time(00:00:00)
- end function
- public function Boolean of_ischild ();Return ib_Child
- end function
- public function string of_evaluate (long al_row, string as_exp);/*----------------------------------------------------------------------------
- 求指定表达式的值
-
- 返回值是字符串类型
- 如果计算有错误,返回空值
-
-
- 应用示例:
- long l_sum
- int li_page,li_pagecount
- l_sum=long(of_getvalud("1+30+120",1))
- li_page=integer(of_getvale("page()",1))
- li_pagecount=integer(of_getvalue("pagecount()",1))
-
-
- ------------------------------------------------------------------------------*/
- String ls_ret
- Int li_Pos
- string ls_temp
- ls_temp = as_exp
- Try
- as_exp=Trim(as_exp)
- IF Left(as_exp,1)="'" AND Right(as_exp,1)="'" Then
- as_exp=Mid(as_exp,2,Len(as_exp) -2)
- ELSE
- IF Left(as_exp,1)='"' AND Right(as_exp,1)='"' Then
- as_exp=Mid(as_exp,2,Len(as_exp) -2)
- END IF
- END IF
-
- as_exp=OF_ReplaceAll(as_exp,"'",'"' ) //把单引号换成双引号
- ls_ret=OF_describe("Evaluate('"+as_exp+"', " +string(al_row)+ ")")
-
- IF ls_ret="?" OR ls_ret="!" THEN
- ls_ret=""
- END IF
-
- Catch(DWRuntimeError dwEr)
- MessageBox("OF_Evaluate Error" ,dwer.text+"~r~n~r~n"+ls_temp , Exclamation! )
- Return ""
- Catch(RunTimeError er)
- MessageBox("OF_Evaluate Error" ,er.text+"~r~n~r~n"+ls_temp, Exclamation! )
- Return ""
- END TRY
- Return ls_ret
- end function
- public subroutine of_getproperty (readonly string as_property, ref string as_value, ref string as_exp);long ll_pos
- as_Value = OF_Describe(as_Property)
- as_Exp=""
- IF as_Value <> "!" AND as_Value <> "?" and as_Value <> "" Then
- ll_pos = pos(lower(as_Value), "~t")
- IF ll_pos > 0 Then
- as_Exp = right(as_Value, len(as_Value) - ll_pos)
- IF right(as_Exp, 1) = "~"" Then
- as_Exp = Trim(left(as_Exp, len(as_Exp) - 1))
- End IF
- as_Value = left(as_Value, ll_pos - 1)
- IF left(as_Value, 1) = "~"" Then
- as_Value = right(as_Value, len(as_Value) - 1)
- End IF
- End IF
- as_Value = Trim(as_Value)
- else
- as_Value=""
- as_Exp=""
- End IF
- //如果表达式是一个数值,则为该表达式的值作为属性的具体值
- IF IsNumber(as_Exp) Then
- as_Value = as_Exp
- as_Exp =""
- End IF
- end subroutine
- public function long of_parsetoarray (string as_source, string as_delimiter, ref string as_array[]);long ll_DelLen, ll_Pos, ll_Count, ll_Start, ll_Length
- string ls_holder
- String ls_Temp[]
- as_array= ls_Temp //清空原数组
- //Check for NULL
- IF IsNull(as_source) or IsNull(as_delimiter) Then
- long ll_null
- SetNull(ll_null)
- Return ll_null
- End If
- //Check for at leat one entry
- If Trim (as_source) = '' Then
- Return 0
- End If
- //Get the length of the delimeter
- ll_DelLen = Len(as_Delimiter)
- ll_Pos = Pos(Upper(as_source), Upper(as_Delimiter))
- //Only one entry was found
- if ll_Pos = 0 then
- as_Array[1] = as_source
- return 1
- end if
- //More than one entry was found - loop to get all of them
- ll_Count = 0
- ll_Start = 1
- Do While ll_Pos > 0
-
- //Set current entry
- ll_Length = ll_Pos - ll_Start
- ls_holder = Mid (as_source, ll_start, ll_length)
- // Update array and counter
- ll_Count ++
- as_Array[ll_Count] = ls_holder
-
- //Set the new starting position
- ll_Start = ll_Pos + ll_DelLen
- ll_Pos = Pos(Upper(as_source), Upper(as_Delimiter), ll_Start)
- Loop
- //Set last entry
- ls_holder = Mid (as_source, ll_start, Len (as_source))
- // Update array and counter if necessary
- if Len (ls_holder) > 0 then
- ll_count++
- as_Array[ll_Count] = ls_holder
- end if
- //Return the number of entries found
- Return ll_Count
- end function
- protected function long of_lastpos (string as_source, string as_target, long al_start);
- Long ll_Cnt, ll_Pos
- //Check for Null Parameters.
- IF IsNull(as_source) or IsNull(as_target) or IsNull(al_start) Then
- SetNull(ll_Cnt)
- Return ll_Cnt
- End If
- //Check for an empty string
- If Len(as_Source) = 0 Then
- Return 0
- End If
- // Check for the starting position, 0 means start at the end.
- If al_start=0 Then
- al_start=Len(as_Source)
- End If
- //Perform find
- For ll_Cnt = al_start to 1 Step -1
- ll_Pos = Pos(as_Source, as_Target, ll_Cnt)
- If ll_Pos = ll_Cnt Then
- //String was found
- Return ll_Cnt
- End If
- Next
- //String was not found
- Return 0
- end function
- protected function long of_lastpos (string as_source, string as_target);//不直接使用LastPos,是因为PB6.5版本不支持LastPos函数
- Return of_LastPos (as_source, as_target, Len(as_Source))
- end function
- public function long of_arraytostring (readonly string as_source[], readonly string as_delimiter, ref string as_ref_string);
- long ll_DelLen, ll_Pos, ll_Count, ll_ArrayUpBound
- string ls_holder
- boolean lb_EntryFound = False
- //Get the array size
- ll_ArrayUpBound = UpperBound(as_source[])
- //Check parameters
- IF IsNull(as_delimiter) or (Not ll_ArrayUpBound>0) Then
- Return -1
- End If
- //Reset the Reference string
- as_ref_string = ''
- For ll_Count = 1 to ll_ArrayUpBound
- //Do not include any entries that match an empty string
- If as_source[ll_Count] <> '' Then
- If Len(as_ref_string) = 0 Then
- //Initialize string
- as_ref_string = as_source[ll_Count]
- else
- //Concatenate to string
- as_ref_string = as_ref_string + as_delimiter + as_source[ll_Count]
- End If
- End If
- Next
- return 1
- end function
- public function string of_replaceall (readonly string as_oldstr, readonly string as_findstr, readonly string as_repstr);long ll_Pos,ll_F,ll_R
- String ls_Result
- ll_F=Len(as_FindStr)
- ll_R=Len(as_RepStr)
- ls_Result = as_OldStr
- ll_Pos=Pos(ls_Result ,as_FindStr )
- DO WHILE ll_Pos<>0
- ls_Result=Replace(ls_Result,ll_Pos,ll_F, as_RepStr)
- ll_Pos=Pos(ls_Result, as_FindStr,ll_Pos+ll_R)
- LOOP
- RETURN ls_Result
- end function
- public subroutine of_dataformat (ref string as_format, ref string as_exp, string as_coltype);long ll_pos
- long ll_cnt
- string ls_arr[]
- long ll_i
- IF Not IsValid(inv_Api) Then
- inv_Api = Create n_dw2xls_WinApi
- End IF
- as_Format = Trim(as_Format)
- IF Right(as_Format,1)=";" Then
- as_Format = Left(as_Format,Len(as_Format) -1)
- End IF
- ll_pos = pos(as_format, "@")
- IF ll_pos > 0 Then
- as_format = "[general]"
- End IF
- ll_pos = pos(lower(as_format), "[general]")
- Do While ll_pos > 0
- IF as_ColType = "date" Then
- as_format = Replace(as_format, ll_pos, 9, inv_Api.OF_Get_ShortDateFormat() )
- ELSEIF as_ColType = "datetime" Then
- as_format = Replace(as_format, ll_pos, 9, inv_Api.OF_Get_ShortDateFormat()+' ' + inv_Api.OF_Get_TimeFormat() )
- ELSEIF as_ColType = "time" Then
- as_format = Replace(as_format, ll_pos, 9, inv_Api.OF_Get_TimeFormat() )
- ELSEIF Left(as_ColType,8)="decimal(" Then
- ll_cnt = Long(Mid(as_ColType,9,Len(as_ColType) -9))
- IF ll_cnt>0 Then
- as_Format="0"+inv_Api.OF_Get_DecmialSeparator()+Fill("0", ll_cnt)
- Else
- as_Format= "0"
- END IF
- ELSEIF as_ColType="decimal" Then //没有小位数, 则缺省为2位(实际要取控制面板的小数位置)
- as_Format= inv_Api.OF_Get_DecimalFormat()
- Else
- as_format = Replace(as_format, ll_pos, 9, "@")
- End IF
- ll_pos = pos(lower(as_format), "[general]")
- Loop
- ll_pos = pos(lower(as_format), "[currency]")
- Do While ll_pos > 0
- as_format = Replace(as_format, ll_pos, 10, inv_Api.OF_Get_CurrentFormat() )
- ll_pos = pos(lower(as_format), "[currency]")
- Loop
- ll_pos = pos(lower(as_format), "[longdate]")
- Do While ll_pos > 0
- as_format = Replace(as_format, ll_pos, 11, inv_Api.OF_Get_LongDateFormat() )
- ll_pos = pos(lower(as_format), "[longdate]")
- Loop
- ll_pos = pos(lower(as_format), "[shortdate]")
- Do While ll_pos > 0
- as_format = Replace(as_format, ll_pos, 11, inv_Api.OF_Get_ShortDateFormat() )
- ll_pos = pos(lower(as_format), "[shortdate]")
- Loop
- ll_pos = pos(lower(as_format), "[date]")
- Do While ll_pos > 0
- as_format = Replace(as_format, ll_pos, 6, inv_Api.OF_Get_ShortDateFormat() )
- ll_pos = pos(lower(as_format), "[date]")
- Loop
- ll_pos = pos(lower(as_format), "[time]")
- Do While ll_pos > 0
- as_format = Replace(as_format, ll_pos, 6, inv_Api.OF_Get_TimeFormat() )
- ll_pos = pos(lower(as_format), "[time]")
- Loop
- as_format = of_replaceAll(as_format, "'", "~"")
- as_format =of_replaceAll(as_format, "@", "General")
-
- IF pos(as_format, ";") > 0 Then
- ll_cnt = of_parsetoarray(as_format, ";", ls_arr)
- as_format =""
-
- IF ll_cnt > 3 Then
- ll_cnt = 3
- End IF
-
- For ll_i= 1 To ll_cnt
- IF ll_i=1 Then
- as_format=ls_arr[ll_i]
- ELSE
- as_format+=";"+ls_arr[ll_i]
- END IF
- Next
- End IF
- ll_pos = pos(lower(as_format), "~t")
- IF ll_pos > 0 Then
- as_exp = right(as_format, len(as_format) - ll_pos)
- IF right(as_exp, 1) = "~"" Then
- as_exp =Trim(left(as_exp, len(as_exp) - 1))
- End IF
- as_format = left(as_format, ll_pos - 1)
- IF left(as_format, 1) = "~"" Then
- as_format = right(as_format, len(as_format) - 1)
- End IF
- End IF
- end subroutine
- public function long of_findgroupchange (readonly long al_row, readonly integer ai_level);Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.FindGroupChange(al_Row, ai_Level )
- Case DataStore!
- Return ids_Requestor.FindGroupChange(al_Row, ai_Level )
- Case DataWindowChild!
- Return idwc_Requestor.FindGroupChange(al_Row, ai_Level )
- END CHOOSE
- Return 0
- end function
- public subroutine of_getrowindetail ();Long li_Pos ,li_Pos2, li_Count
- Long li, li_RowInDetail
- String ls_Syntax, ls_Name, ls_Temp
- n_dw2xls_Band lnv_Band
- //如果数据窗口是N-UP类型,需要作以下处理
- ii_Rows_Per_Detail = Long(OF_Describe("datawindow.Rows_Per_Detail"))
- IF ii_Rows_Per_Detail<=1 Then
- ii_Rows_Per_Detail=1
- Return
- END IF
-
- // 修改为支持非Detail区的列对象也使用 row_in_detail 2011/10/08
- //IF Not OF_ContaintBand("detail") Then
- // RETURN
- //END IF
- //lnv_Band = OF_GetBand("detail")
- //虽然Column对象的Attributes属性里面包括为Row_In_Detail,但Describe无法读出来,所以需要通过分析语法或获得
- ls_Syntax=OF_Describe("datawindow.syntax")
- li_Pos=Pos(ls_Syntax,"column(")
- Do While li_Pos>0
- li_Pos2=Pos(ls_Syntax,"column(",li_Pos+5)
- IF li_Pos2=0 Then
- li_Count=1024
- ELSE
- li_Count=li_Pos2 - li_Pos -1
- END IF
-
- //读出该Column对象的语法
- ls_Temp=Mid(ls_Syntax,li_Pos ,li_Count)
-
- li_Pos=Pos(ls_Temp,"row_in_detail=")
- IF li_Pos<=0 Then
- li_Pos=li_Pos2
- Continue
- END IF
-
- li_Pos+=Len("row_in_detail=")
- li_Count=Pos(ls_Temp," ",li_Pos+1) -li_Pos
- li_RowInDetail=Long(Mid(ls_Temp,li_Pos,li_Count) ) //取得Row_In_Detail的值
-
- IF li_RowInDetail>1 Then
- //取得对象名称
- li_Pos=Pos(ls_Temp,"name=")+Len("name=")
- li_Count=Pos(ls_Temp," ",li_Pos+1) -li_Pos
- ls_Name=Lower(Trim(Mid(ls_Temp,li_Pos,li_Count) ))
-
- lnv_Band = OF_GetBand(OF_Describe(ls_Name+".Band") )
- For li=1 To UpperBound(lnv_Band.inv_Objects)
- IF lnv_Band.inv_Objects[li].Name=ls_Name Then
- lnv_Band.inv_Objects[li].RowInDetail = li_RowInDetail
- Exit
- END IF
- Next
- END IF
- li_Pos=li_Pos2
-
- Loop
- end subroutine
- public subroutine of_getsparse ();Long li , lj,li_Count
- String ls_Syntax, ls_Objects[]
- n_dw2xls_Band lnv_Band
- n_dw2xls_Object lnv_PriorSparseObject
- IF Not inv_Progress.ib_ProcessSparse Then Return
- ls_Syntax=OF_Describe("datawindow.sparse")
- IF ls_Syntax="" Then
- Return
- END IF
- IF Not OF_ContaintBand("detail") Then
- RETURN
- END IF
- lnv_Band = OF_GetBand("detail")
- li_Count=OF_ParseToArray(ls_Syntax,"~t",ls_Objects)
- For li=1 To li_Count
- For lj=1 To UpperBound(lnv_Band.inv_Objects)
- IF lnv_Band.inv_Objects[lj].Name = ls_Objects[li] Then
- lnv_Band.inv_Objects[lj].IsSparse =TRUE
- IF IsValid(lnv_PriorSparseObject) Then
- lnv_Band.inv_Objects[lj].inv_PriorSparseObject = lnv_PriorSparseObject
- END IF
-
- lnv_PriorSparseObject = lnv_Band.inv_Objects[lj]
- EXIT
- END IF
- Next
- Next
-
- end subroutine
- public function string of_getnextband (readonly string as_name);//取指定带区名称的下一个带区
- Int li
- String ls_Name
- IF as_Name="header" Then
- For li=1 TO ii_GroupLevels
- IF OF_ContaintBand("header."+String(li)) Then
- ls_Name = "header."+String(li)
- Exit
- END IF
- Next
-
- IF ls_Name="" Then
- ls_Name="detail"
- END IF
-
- ELSEIF as_Name="detail" Then
- For li=ii_GroupLevels TO 1 Step -1
- IF OF_ContaintBand("trailer."+String(li)) Then
- ls_Name = "trailer."+String(li)
- Exit
- END IF
- Next
- IF ls_Name="" Then
- ls_Name="summary"
- END IF
- ELSEIF as_Name="summary" Then
- ls_Name="footer"
-
- ELSEIF as_Name="footer" Then
- ls_Name=""
- ELSE
-
- END IF
- Return ls_Name
- end function
- public subroutine of_setrow (long al_row);Choose Case ipo_Type
- Case DataWindow!
- idw_Requestor.SetRow(al_Row)
- Case DataStore!
- ids_Requestor.SetRow(al_Row)
- Case DataWindowChild!
- idwc_Requestor.SetRow(al_Row)
- END CHOOSE
- end subroutine
- public function n_dw2xls_layout of_getlayout ();Return inv_Layout
- end function
- public subroutine of_registcolumninfo ();Int li
- IF ib_Child Then
- Return
- END IF
- OF_RegistColumnInfo_1()
- IF inv_Layout.il_first_x1<inv_Layout.il_last_x2 AND inv_Layout.il_first_x1>0 Then
- inv_Layout.OF_RegistObject(inv_Layout.il_first_x1,TRUE)
- END IF
- IF inv_Layout.il_last_x2>0 Then
- inv_Layout.OF_RegistObject(inv_Layout.il_last_x2,FALSE)
- END IF
- //第二步,注册有边框的对象
- OF_RegistColumnInfo_2()
- //第三步 注册右对齐的对象
- OF_RegistColumnInfo_3()
- //第四步,从整个数据窗口的对象布局,进一步判断和登记其它的对象
- inv_Layout.of_RegistColumnInfo()
- end subroutine
- public subroutine of_getcolrowinfo ();Int li
- IF ii_Rows_Per_Detail<=0 Then
- ii_Rows_Per_Detail =1
- END IF
- For li =1 To UpperBound( inv_Bands)
- inv_Bands[li].OF_GetColRowInfo()
- Next
- For li =1 To UpperBound( inv_Bands)
- inv_Bands[li].OF_SetCellBorder()
- inv_Bands[li].OF_CalcPictureOffset()
-
- IF ( inv_Layout.OF_IsNested()=False OR inv_Layout.OF_RowCount()=1) OR ib_Child=False Then
- IF inv_Bands[li].OF_GetName()="detail" Then
- inv_Layout.OF_IncreaseProgress_Data(Ceiling(OF_RowCount() /ii_Rows_Per_Detail ) )
- ELSE
- IF Pos(inv_Bands[li].OF_GetName(),".")=0 Then
- inv_Layout.OF_IncreaseProgress_Data(1)
- END IF
- END IF
- END IF
- Next
- end subroutine
- public function Long of_getbkcolor ();Return il_BKColor
- end function
- public function string of_gettext (readonly long al_row, readonly string as_name, string as_coltype, readonly string as_format);Any Data
- String ls_Result
- IF as_ColType="char" Then
- Data=OF_GetItemString(al_Row,as_Name)
- Return Data
- ELSEIF as_ColType="datetime" Then
- Data =OF_GetItemDateTime(al_Row,as_Name)
- ELSEIF as_ColType="date" Then
- Data = OF_GetItemDate(al_Row,as_Name)
- ELSEIF as_ColType="time" THEN
- Data=OF_GetItemTime(al_Row,as_Name)
- ELSE
- Data=OF_GetItemNumber(al_Row,as_Name)
- END IF
- IF IsNull(Data) Then
- Return ""
- ELSE
- IF Pos(as_Format,"@")>0 OR Pos(Lower(as_Format),"general")>0 Then
- ls_Result = String(Data)
- ELSE
- ls_Result= String(Data, as_Format)
- IF ls_Result="" Then
- ls_Result =String(Data)
- END IF
- END IF
- END IF
- Return ls_Result
- end function
- public function integer of_setrequestor (powerobject apo, ref n_dw2xls_progress anv_progress);IF Not IsValid(apo) Then
- Return -1
- END IF
-
- IF apo.TypeOF() <>DataWindow! AND &
- apo.TypeOF() <> DataStore! AND &
- apo.TypeOF() <> DataWindowChild! Then
-
- Return -1
- END IF
- IF IsValid(inv_Layout) Then
- Destroy inv_Layout
- END IF
- IF Not IsValid(anv_Progress) Then
- anv_Progress =Create n_dw2xls_Progress
- END IF
- inv_Layout =Create n_dw2xls_Layout
- IF OF_SetRequestor(apo,anv_Progress, inv_Layout ) <>1 Then
- Destroy inv_Layout
- Return -1
- END IF
- OF_RegistColumnInfo() //登记列的位置
- inv_Layout.OF_GetColumnInfo() //得到各个列的起止位置
- OF_GetColRowInfo() //判断各个对象输出的行列位置
- OF_UpdateColumnInfo() //如果原来登记列的宽度 ,不能完整显示文本对象,则更新列的宽度,使期可以完整显示
- Return 1
- end function
- private function integer of_setrequestor (powerobject apo, ref n_dw2xls_progress anv_progress, ref n_dw2xls_layout anv_layout);String ls_DataObject
- Blob lblob_State
- ipo_Type = apo.TypeOF()
- Choose Case ipo_Type
- Case DataWindow!
- idw_Requestor = apo
- il_RowCount = idw_Requestor.RowCount()
- Case DataStore!
- ids_Requestor = apo
- il_RowCount = ids_Requestor.RowCount()
- Case DataWindowChild!
- idwc_Requestor = apo
- il_RowCount = idwc_Requestor.RowCount()
- Case Else
- Return -1
- END CHOOSE
- //0 - (Default) Form, group, n-up, or tabular
- //1 - Grid
- //2 - Label
- //3 - Graph
- //4 - Crosstab
- //5 - Composite
- //6 - OLE
- //7 - RichText
- //8 - TreeView
- //9 - TreeView with Grid
- is_Processing = OF_Describe("DataWindow.Processing")
- IF is_Processing='2' OR Long(is_Processing)>5 Then
- Return -1
- END IF
- IF OF_Describe("DataWindow.Nested")="yes" Then
- ib_Nested =TRUE
-
- IF Not ib_Child Then //主数据窗口对象是否Nested 类型的
- anv_Layout.OF_SetNested(TRUE )
- END IF
- END IF
- IF Not ib_Child Then //主数据窗口的记录数
- anv_Layout.OF_SetRowCount(il_RowCount)
-
- //判断是否PSR文件
- IF ipo_Type=DataWindow! Then
- ls_DataObject = idw_Requestor.DataObject
- ELSEIF ipo_Type=DataStore! Then
- ls_DataObject = ids_Requestor.DataObject
- END IF
- END IF
- inv_Progress = anv_progress
- inv_Layout=anv_Layout
- of_GetDWInfo()
- IF Of_GetObjects() <>1 Then
- Return -1
- END IF
- Return 1
- end function
- public function Boolean of_isdetail_begin ();Return ib_Detail_Begin
- end function
- public subroutine of_groupcalc ();Choose Case ipo_Type
- Case DataWindow!
- idw_Requestor.GroupCalc()
- Case DataStore!
- ids_Requestor.GroupCalc()
- Case DataWindowChild!
- idwc_Requestor.GroupCalc()
- END CHOOSE
- end subroutine
- public function string of_getheader_beginband ();Return is_Header_BeginBand
- end function
- public function Boolean of_checkoutpictures ();Return inv_Layout.OF_CheckWritePictures()
- end function
- public function integer of_clipboard (readonly string as_name);Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.Clipboard(as_name)
- Case DataStore!
- Return ids_Requestor.Clipboard(as_name)
- Case DataWindowChild!
- Datastore lds
- Int li_Result
- lds =Create Datastore
- lds.Create(idwc_Requestor.Describe("DataWindow.Syntax"))
- li_Result= lds.Clipboard(as_name)
- Destroy lds
- Return li_Result
- END CHOOSE
- Return -1
- end function
- public subroutine of_setwinapi (n_dw2xls_winapi anv_api);inv_Api = anv_Api
- end subroutine
- public function n_dw2xls_winapi of_getwinapi ();IF Not IsValid(inv_Api) Then
- inv_Api = Create n_dw2xls_winapi
- END IF
- Return inv_Api
- end function
- public function Boolean of_iscancel ();IF IsValid(inv_Progress) Then
- Return inv_Progress.ib_Cancel
- END IF
- Return False
- end function
- public function Boolean of_isdatawindowchild ();Return ipo_Type=DataWindowChild!
- end function
- public function boolean of_iswritepictures ();IF IsValid(inv_Progress) Then
- Return inv_Progress.ib_WritePictures
- END IF
- Return False
- end function
- public function boolean of_iswritebkcolor ();IF IsValid(inv_Progress) Then
- Return inv_Progress.ib_WriteBKColor
- END IF
- RETURN FALSE
- end function
- public subroutine of_updatecolumninfo ();Int li
- For li =1 To UpperBound( inv_Bands)
- inv_Bands[li].OF_UpdateColumnInfo()
- Next
- inv_Layout.OF_UpdateColumnInfo()
- end subroutine
- public subroutine of_write_printsetting (readonly unsignedlong al_hsheet);Double ld_Margin_Left, ld_Margin_Top, ld_Margin_Right ,ld_Margin_Bottom
- Int li_PaperSize ,li_Copies ,li_Scale ,li_PrintColors ,li_Orientation
- ld_Margin_Left =Long(OF_Describe("DataWindow.Print.Margin.Left"))
- ld_Margin_Right = Long(OF_Describe("DataWindow.Print.Margin.Right"))
- ld_Margin_Top = Long(OF_Describe("DataWindow.Print.Margin.Top"))
- ld_Margin_Bottom = Long(OF_Describe("DataWindow.Print.Margin.Bottom"))
- IF is_Units='0' Then
- ld_Margin_Left = inv_Api.OF_PixelsToInch( UnitsToPixels(ld_Margin_Left, XUnitsToPixels!) )
- ld_Margin_Right = inv_Api.OF_PixelsToInch( UnitsToPixels(ld_Margin_Right, XUnitsToPixels!) )
- ld_Margin_Top = inv_Api.OF_PixelsToInch( UnitsToPixels(ld_Margin_Top, YUnitsToPixels!) )
- ld_Margin_Bottom = inv_Api.OF_PixelsToInch( UnitsToPixels(ld_Margin_Bottom, YUnitsToPixels!) )
- ELSEIF is_Units='1' Then
- ld_Margin_Left = inv_Api.OF_PixelsToInch( ld_Margin_Left )
- ld_Margin_Right = inv_Api.OF_PixelsToInch( ld_Margin_Right )
- ld_Margin_Top = inv_Api.OF_PixelsToInch( ld_Margin_Top )
- ld_Margin_Bottom = inv_Api.OF_PixelsToInch( ld_Margin_Bottom )
- ELSEIF is_Units='2' Then
- ld_Margin_Left = ld_Margin_Left /1000
- ld_Margin_Right = ld_Margin_Right /1000
- ld_Margin_Top = ld_Margin_Top /1000
- ld_Margin_Bottom = ld_Margin_Bottom /1000
- ELSEIF is_Units='3' Then
- ld_Margin_Left = inv_Api.OF_CmToInch( ld_Margin_Left /1000 )
- ld_Margin_Right = inv_Api.OF_CmToInch( ld_Margin_Right /1000)
- ld_Margin_Top = inv_Api.OF_CmToInch( ld_Margin_Top/1000 )
- ld_Margin_Bottom = inv_Api.OF_CmToInch( ld_Margin_Bottom/1000 )
- END IF
- li_PaperSize = Long(OF_Describe("DataWindow.Print.Paper.Size"))
- li_Copies = Long(OF_Describe("DataWindow.Print.Copies"))
- li_Scale = Long(OF_Describe("DataWindow.Print.Scale"))
- IF li_Scale=0 Then
- li_Scale = Long(OF_Describe("DataWindow.Zoom"))
- END IF
- IF li_Scale<10 AND li_Scale>0 Then
- li_Scale =10
- ELSEIF li_Scale>400 Then
- li_Scale =400
- END IF
- li_Orientation= Long(OF_Describe("DataWindow.Print.Orientation"))
- IF OF_Describe("DataWindow.Print.Color")='1' Then
- li_PrintColors =1
- ELSE
- li_PrintColors =0
- END IF
- inv_Api.SetMargin(al_hSheet, ld_Margin_Left, ld_Margin_Right, ld_Margin_Top, ld_Margin_Bottom)
- inv_Api.SetPaperSize(al_hSheet, li_PaperSize)
- inv_Api.SetPrintScale(al_hSheet, li_Scale)
- inv_Api.SetPrintCopies(al_hSheet, li_Copies)
- inv_Api.SetOrientation(al_hSheet, li_Orientation)
- inv_Api.SetPrintColor(al_hSheet, li_PrintColors)
- end subroutine
- public function double of_getitemnumber (readonly long al_row, readonly integer ai_column);IF al_Row<=0 OR al_Row>il_RowCount Then
- Return 0
- END IF
- Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.Object.Data[al_Row, ai_Column]
- Case DataStore!
- Return ids_Requestor.Object.Data[al_Row, ai_Column]
- Case DataWindowChild!
- Return idwc_Requestor.GetItemNumber(al_Row,ai_Column)
- END CHOOSE
- Return 0
- end function
- public function string of_getitemstring (readonly long al_row, readonly integer ai_column);IF al_Row<=0 OR al_Row>il_RowCount Then
- Return""
- END IF
- Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.Object.Data[al_Row, ai_Column]
- Case DataStore!
- Return ids_Requestor.Object.Data[al_Row, ai_Column]
- Case DataWindowChild!
- Return idwc_Requestor.GetItemString(al_Row,ai_Column)
- END CHOOSE
- Return ""
- end function
- public function datetime of_getitemdatetime (readonly long al_row, readonly integer ai_column);
-
- IF al_Row<=0 OR al_Row>il_RowCount Then
- Return DateTime(1900-01-01,00:00:00)
- END IF
- Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.Object.Data[al_Row,ai_Column]
- Case DataStore!
- Return ids_Requestor.Object.Data[al_Row,ai_Column]
- Case DataWindowChild!
- Return idwc_Requestor.GetItemDateTime(al_Row,ai_Column)
- END CHOOSE
- Return DateTime(1900-01-01,00:00:00)
- end function
- public function date of_getitemdate (readonly long al_row, readonly integer ai_column);IF al_Row<=0 OR al_Row>il_RowCount Then
- Return 1900-01-01
- END IF
- Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.Object.Data[al_Row,ai_Column]
- Case DataStore!
- Return ids_Requestor.Object.Data[al_Row,ai_Column]
- Case DataWindowChild!
- Return idwc_Requestor.GetItemDate(al_Row,ai_Column)
- END CHOOSE
- Return 1900-01-01
- end function
- public function time of_getitemtime (readonly long al_row, readonly integer ai_column);IF al_Row<=0 OR al_Row>il_RowCount Then
- Return 00:00:00
- END IF
- Choose Case ipo_Type
- Case DataWindow!
- Return idw_Requestor.Object.Data[al_Row,ai_Column]
- Case DataStore!
- Return ids_Requestor.Object.Data[al_Row,ai_Column]
- Case DataWindowChild!
- Return idwc_Requestor.GetItemTime(al_Row,ai_Column)
- END CHOOSE
- Return 00:00:00
- end function
- public subroutine of_addexpression (ref string as_exp);Int li,li_cnt
- Boolean lb_Space //前面字符是否空格
- Boolean lb_Str1, lb_Str2 //单引号和双引号
- String ls_NewExp, ls_Opt
- n_dw2xls_Expression lnv_Exp
- //格式化表达式
- as_Exp = Trim(as_Exp)
- IF Left(as_exp,1)="'" AND Right(as_exp,1)="'" Then
- as_exp=Mid(as_exp,2,Len(as_exp) -2)
- ELSE
- IF Left(as_exp,1)='"' AND Right(as_exp,1)='"' Then
- as_exp=Mid(as_exp,2,Len(as_exp) -2)
- END IF
- END IF
- as_exp=OF_ReplaceAll(as_exp,"'",'"' ) //把单引号换成双引号
- li_cnt = Len(as_Exp)
- For li=1 To li_cnt
- ls_Opt = Mid(as_Exp,li,1)
- IF lb_Space AND ls_Opt=" " Then
- Continue
- END IF
-
- IF ls_Opt="'" Then
- lb_Str1 =Not lb_Str1
- lb_Space=False
- ELSEIF ls_Opt='"' Then
- lb_Str2 = Not lb_Str2
- lb_Space=False
- ELSE
- IF ls_Opt=" " Then
- lb_Space=TRUE
- ELSE
- lb_Space=False
- END IF
- END IF
-
- IF lb_Str1=False AND lb_Str2=False AND lb_Space=False Then
- ls_NewExp += Lower(ls_Opt)
- ELSE
- ls_NewExp +=ls_Opt
- END IF
- Next
- IF ls_NewExp="" Then
- as_Exp=""
- Return
- END IF
- li_cnt = UpperBound(inv_Exps)
- For li=1 To li_cnt
- IF inv_Exps[li].Expression = ls_NewExp Then
- as_Exp = ls_NewExp
- Return
- END IF
- NEXT
- lnv_Exp = Create n_dw2xls_Expression
- lnv_Exp.Expression= ls_NewExp
- inv_Exps[li_cnt+1] = lnv_Exp
- as_Exp = ls_NewExp
- end subroutine
- public subroutine of_updateexpvalues (readonly long al_row);Int li ,lj,li_cnt
- Long li_Row
- String ls_Value
- IF al_Row=il_LastExpUpdateRow Then
- Return
- END IF
- il_LastExpUpdateRow =al_Row
- li_cnt = UpperBound(inv_Exps)
- For li=1 To li_cnt
- For lj=1 TO ii_Rows_Per_Detail
- li_Row = al_Row+ii_Rows_Per_Detail -1
- IF li_Row<=il_RowCount Then
-
- //改成直接Describe,避免重复对字符串进行格式化处理
- //inv_Exps[li].is_Values[lj]=OF_Evaluate(li_Row, inv_Exps[li].Expression)
- ls_Value=OF_describe("Evaluate('"+ inv_Exps[li].Expression+"', " +string(li_Row)+ ")")
- IF ls_Value="!" OR ls_Value="?" Then
- ls_Value=""
- END IF
- inv_Exps[li].is_Values[lj] =ls_Value
- END IF
- Next
- Next
- end subroutine
- public function string of_getexpvalue (readonly string as_exp, readonly integer ai_rowindetail);Int li,li_cnt
- String ls_Result
- Try
- li_cnt =UpperBound(inv_Exps)
-
- For li=1 To li_cnt
- IF inv_Exps[li].Expression= as_Exp Then
- IF ai_RowInDetail<=UpperBound(inv_Exps[li].is_Values) Then
- ls_Result= inv_Exps[li].is_Values[ai_RowInDetail]
- END IF
- Exit
- END IF
- Next
-
- Catch(RunTimeError er)
- ls_Result=""
- END TRY
- Return ls_Result
- end function
- public subroutine of_updatereport (readonly long al_row, readonly string as_name, ref n_dw2xls_requestor anv_report);String ls_Data,ls_Syntax
- Any la_Args[]
- String ls_ArgTypes[]
- n_dw2xls_DataStore lds
- DWObject dwo
- ls_Data = OF_Describe(as_Name+".Band")
- IF ls_Data="header" OR ls_Data="summary" OR ls_Data="footer" Then
- Return
- END IF
- IF Not IsValid(anv_report) Then
- Return
- END IF
- IF Not IsValid(anv_report.ids_Requestor) Then
- Return
- END IF
- IF OF_GetChild(al_Row,as_Name,dwo)=1 Then
- anv_report.ids_Requestor.Reset()
- anv_report.il_RowCount =0
-
- TRY
- //anv_report.ids_Requestor.ImportString(dwo.Object.DataWindow.Data)
- anv_report.ids_Requestor.Create(anv_report.ids_Requestor.Describe("DataWindow.Syntax")+"~r~n"+String(dwo.Object.DataWindow.Syntax.Data))
- anv_Report.il_RowCount =anv_Report.ids_Requestor.RowCount()
- IF anv_Report.il_RowCount=0 Then
- IF anv_Report.ids_Requestor.Describe("DataWindow.Processing")='5' Then
- anv_Report.ids_Requestor.InsertRow(0)
- anv_Report.il_RowCount =1
- END IF
- END IF
- anv_Report.idwo_Parent = dwo
- anv_Report.ids_Requestor.GroupCalc()
- anv_report.OF_UpdateNestReport()
- anv_Report.ib_Detail_Begin =TRUE
- Catch(RunTimeError er)
-
- END TRY
- ELSE
- anv_report.ids_Requestor.Reset()
- anv_report.il_RowCount =0
- IF OF_GetArguments(al_Row, anv_report.ids_Requestor.Describe("DataWindow.Table.Arguments"), OF_Describe(as_Name+".Nest_Arguments"), la_Args ,ls_ArgTypes )>0 Then
- anv_report.ids_Requestor.Dynamic OF_Retrieve(la_Args , ls_ArgTypes )
- anv_report.il_RowCount =anv_report.ids_Requestor.RowCount()
- END IF
- IF anv_Report.il_RowCount=0 Then
- IF anv_Report.ids_Requestor.Describe("DataWindow.Processing")='5' Then
- anv_Report.ids_Requestor.InsertRow(0)
- anv_Report.il_RowCount =1
- END IF
- END IF
- anv_Report.ids_Requestor.GroupCalc()
- anv_report.OF_UpdateNestReport()
- anv_Report.ib_Detail_Begin =TRUE
- END IF
- end subroutine
- public function Boolean of_isvalid_dwomaster ();Return IsValid(idwo_Parent)
- end function
- public function string of_getdisplayvalue (readonly long al_row, readonly integer ai_colid, readonly string as_name, readonly boolean ab_isclone, readonly string as_editstyle, readonly string as_coltype);Long li_Row
- String ls_Value , ls_DataColumn, ls_DisplayColumn
- DataWindowChild dwc
- Try
- IF ab_IsClone AND as_EditStyle="dddw" Then
-
- Choose Case as_ColType
- Case "char"
- ls_Value = OF_GetItemString(al_Row,as_Name)
- Case "date"
- ls_Value = String(OF_GetItemDate(al_Row,as_Name))
- Case "datetime"
- ls_Value =String(OF_GetItemDateTime(al_Row,as_Name))
- Case "time"
- ls_Value = String(OF_GetItemTime(al_Row,as_Name))
- Case Else
- ls_Value =String(OF_GetItemNumber(al_Row,as_Name))
- END CHOOSE
-
- ls_DataColumn =OF_Describe(as_Name+".DDDW.DataColumn")
- ls_DisplayColumn =OF_Describe(as_Name+".DDDW.DisplayColumn")
- IF ls_Value<>"" AND IsNull(ls_Value)=False AND &
- ls_DataColumn<>ls_DisplayColumn AND ls_DataColumn<>"" AND ls_DataColumn<>"!" Then
- OF_GetChild(as_Name, dwc)
- IF IsValid(dwc) Then
- IF as_ColType="char" OR as_ColType="date" OR as_ColType="datetime" OR as_ColType="time" Then
- li_Row = dwc.Find(ls_DataColumn+"='"+ls_Value+"' ",1,dwc.RowCount())
- ELSE
- li_Row = dwc.Find(ls_DataColumn+"="+ls_Value,1,dwc.RowCount())
- END IF
- IF li_Row>0 Then
- ls_Value = dwc.Describe("Evaluate('"+ls_DisplayColumn+"',"+String(li_Row)+")")
- END IF
- END IF
- END IF
- ELSE
- IF ai_ColID>0 Then
- ls_Value= OF_Describe("Evaluate('LookUpDisplay(#"+String(ai_ColID)+") ', " +string(al_row)+ ")")
- ELSE
- ls_Value= OF_Describe("Evaluate('LookUpDisplay(#"+as_Name+") ', " +string(al_row)+ ")")
- END IF
- END IF
- Catch(DWRuntimeError dwEr)
- Messagebox('OF_GetDisplayValue Error',dwEr.text+"~r~n~r~nRow:"+String(al_Row)+" Name:"+as_Name ,Exclamation! )
- Catch(RunTimeError er)
- Messagebox('OF_GetDisplayValue Error',er.text+"~r~n~r~nRow:"+String(al_Row)+" Name:"+as_Name ,Exclamation! )
- END TRY
- Return ls_Value
- end function
- public function Integer of_getchild (string as_name, ref datawindowchild adwc);Int li_Result
- li_Result =-1
- Choose Case ipo_Type
- Case DataWindow!
- li_Result= idw_Requestor.GetChild(as_Name, adwc)
- Case DataStore!
- li_Result= ids_Requestor.GetChild(as_Name, adwc)
- Case DataWindowChild!
- li_Result= idwc_Requestor.GetChild(as_Name, adwc)
- END CHOOSE
- Return li_Result
- end function
- public function integer of_getchild (readonly long al_row, readonly string as_name, ref dwobject dwo);Int li_Result
- li_Result =0
- IF IsValid(idwo_Parent) Then
- Try
- Choose Case Lower(as_Name)
- Case "dw_1"
- dwo=idwo_Parent.Object.dw_1[al_row]
- Case "dw_2"
- dwo=idwo_Parent.Object.dw_2[al_row]
- Case "dw_3"
- dwo=idwo_Parent.Object.dw_3[al_row]
- Case "dw_4"
- dwo=idwo_Parent.Object.dw_4[al_row]
- Case "dw_5"
- dwo=idwo_Parent.Object.dw_5[al_row]
- Case "dw_6"
- dwo=idwo_Parent.Object.dw_6[al_row]
- Case "dw_7"
- dwo=idwo_Parent.Object.dw_7[al_row]
- Case "dw_8"
- dwo=idwo_Parent.Object.dw_8[al_row]
- Case "dw_9"
- dwo=idwo_Parent.Object.dw_9[al_row]
- Case "dw_10"
- dwo=idwo_Parent.Object.dw_10[al_row]
- Case "dw_11"
- dwo=idwo_Parent.Object.dw_11[al_row]
- Case "dw_12"
- dwo=idwo_Parent.Object.dw_12[al_row]
- Case "dw_13"
- dwo=idwo_Parent.Object.dw_13[al_row]
- Case "dw_14"
- dwo=idwo_Parent.Object.dw_14[al_row]
- Case "dw_15"
- dwo=idwo_Parent.Object.dw_15[al_row]
- Case "dw_16"
- dwo=idwo_Parent.Object.dw_16[al_row]
- Case "dw_17"
- dwo=idwo_Parent.Object.dw_17[al_row]
- Case "dw_18"
- dwo=idwo_Parent.Object.dw_18[al_row]
- Case "dw_19"
- dwo=idwo_Parent.Object.dw_19[al_row]
- Case "dw_20"
- dwo=idwo_Parent.Object.dw_20[al_row]
- Case "dw_21"
- dwo=idwo_Parent.Object.dw_21[al_row]
- Case "dw_22"
- dwo=idwo_Parent.Object.dw_22[al_row]
- Case "dw_23"
- dwo=idwo_Parent.Object.dw_23[al_row]
- Case "dw_24"
- dwo=idwo_Parent.Object.dw_24[al_row]
- Case "dw_25"
- dwo=idwo_Parent.Object.dw_25[al_row]
- Case "dw_26"
- dwo=idwo_Parent.Object.dw_26[al_row]
- Case "dw_27"
- dwo=idwo_Parent.Object.dw_27[al_row]
- Case "dw_28"
- dwo=idwo_Parent.Object.dw_28[al_row]
- Case "dw_29"
- dwo=idwo_Parent.Object.dw_29[al_row]
- Case "dw_30"
- dwo=idwo_Parent.Object.dw_30[al_row]
- Case "dw_master"
- dwo=idwo_Parent.Object.dw_master[al_row]
- case "dw_main"
- dwo=idwo_Parent.Object.dw_main[al_row]
- Case "d_main"
- dwo=idwo_Parent.Object.d_main[al_row]
-
- END CHOOSE
- Catch(RunTimeError er1)
- li_Result = -1
- END TRY
-
- ELSEIF IsValid(idw_Requestor) Then
- Try
- Choose Case Lower(as_Name)
- Case "dw_1"
- dwo=idw_Requestor.Object.dw_1[al_row]
- Case "dw_2"
- dwo=idw_Requestor.Object.dw_2[al_row]
- Case "dw_3"
- dwo=idw_Requestor.Object.dw_3[al_row]
- Case "dw_4"
- dwo=idw_Requestor.Object.dw_4[al_row]
- Case "dw_5"
- dwo=idw_Requestor.Object.dw_5[al_row]
- Case "dw_6"
- dwo=idw_Requestor.Object.dw_6[al_row]
- Case "dw_7"
- dwo=idw_Requestor.Object.dw_7[al_row]
- Case "dw_8"
- dwo=idw_Requestor.Object.dw_8[al_row]
- Case "dw_9"
- dwo=idw_Requestor.Object.dw_9[al_row]
- Case "dw_10"
- dwo=idw_Requestor.Object.dw_10[al_row]
- Case "dw_11"
- dwo=idw_Requestor.Object.dw_11[al_row]
- Case "dw_12"
- dwo=idw_Requestor.Object.dw_12[al_row]
- Case "dw_13"
- dwo=idw_Requestor.Object.dw_13[al_row]
- Case "dw_14"
- dwo=idw_Requestor.Object.dw_14[al_row]
- Case "dw_15"
- dwo=idw_Requestor.Object.dw_15[al_row]
- Case "dw_16"
- dwo=idw_Requestor.Object.dw_16[al_row]
- Case "dw_17"
- dwo=idw_Requestor.Object.dw_17[al_row]
- Case "dw_18"
- dwo=idw_Requestor.Object.dw_18[al_row]
- Case "dw_19"
- dwo=idw_Requestor.Object.dw_19[al_row]
- Case "dw_20"
- dwo=idw_Requestor.Object.dw_20[al_row]
- Case "dw_21"
- dwo=idw_Requestor.Object.dw_21[al_row]
- Case "dw_22"
- dwo=idw_Requestor.Object.dw_22[al_row]
- Case "dw_23"
- dwo=idw_Requestor.Object.dw_23[al_row]
- Case "dw_24"
- dwo=idw_Requestor.Object.dw_24[al_row]
- Case "dw_25"
- dwo=idw_Requestor.Object.dw_25[al_row]
- Case "dw_26"
- dwo=idw_Requestor.Object.dw_26[al_row]
- Case "dw_27"
- dwo=idw_Requestor.Object.dw_27[al_row]
- Case "dw_28"
- dwo=idw_Requestor.Object.dw_28[al_row]
- Case "dw_29"
- dwo=idw_Requestor.Object.dw_29[al_row]
- Case "dw_30"
- dwo=idw_Requestor.Object.dw_30[al_row]
-
- Case "dw_master"
- dwo=idw_Requestor.Object.dw_master[al_row]
- Case "dw_main"
- dwo=idw_Requestor.Object.dw_main[al_row]
- Case "d_main"
- dwo=idw_Requestor.Object.d_main[al_row]
- END CHOOSE
- Catch(RunTimeError er2)
- li_Result = -1
- END TRY
-
- ELSEIF IsValid(ids_Requestor) Then
- Try
- Choose Case Lower(as_Name)
- Case "dw_1"
- dwo=ids_Requestor.Object.dw_1[al_row]
- Case "dw_2"
- dwo=ids_Requestor.Object.dw_2[al_row]
- Case "dw_3"
- dwo=ids_Requestor.Object.dw_3[al_row]
- Case "dw_4"
- dwo=ids_Requestor.Object.dw_4[al_row]
- Case "dw_5"
- dwo=ids_Requestor.Object.dw_5[al_row]
- Case "dw_6"
- dwo=ids_Requestor.Object.dw_6[al_row]
- Case "dw_7"
- dwo=ids_Requestor.Object.dw_7[al_row]
- Case "dw_8"
- dwo=ids_Requestor.Object.dw_8[al_row]
- Case "dw_9"
- dwo=ids_Requestor.Object.dw_9[al_row]
- Case "dw_10"
- dwo=ids_Requestor.Object.dw_10[al_row]
- Case "dw_11"
- dwo=ids_Requestor.Object.dw_11[al_row]
- Case "dw_12"
- dwo=ids_Requestor.Object.dw_12[al_row]
- Case "dw_13"
- dwo=ids_Requestor.Object.dw_13[al_row]
- Case "dw_14"
- dwo=ids_Requestor.Object.dw_14[al_row]
- Case "dw_15"
- dwo=ids_Requestor.Object.dw_15[al_row]
- Case "dw_16"
- dwo=ids_Requestor.Object.dw_16[al_row]
- Case "dw_17"
- dwo=ids_Requestor.Object.dw_17[al_row]
- Case "dw_18"
- dwo=ids_Requestor.Object.dw_18[al_row]
- Case "dw_19"
- dwo=ids_Requestor.Object.dw_19[al_row]
- Case "dw_20"
- dwo=ids_Requestor.Object.dw_20[al_row]
- Case "dw_21"
- dwo=ids_Requestor.Object.dw_21[al_row]
- Case "dw_22"
- dwo=ids_Requestor.Object.dw_22[al_row]
- Case "dw_23"
- dwo=ids_Requestor.Object.dw_23[al_row]
- Case "dw_24"
- dwo=ids_Requestor.Object.dw_24[al_row]
- Case "dw_25"
- dwo=ids_Requestor.Object.dw_25[al_row]
- Case "dw_26"
- dwo=ids_Requestor.Object.dw_26[al_row]
- Case "dw_27"
- dwo=ids_Requestor.Object.dw_27[al_row]
- Case "dw_28"
- dwo=ids_Requestor.Object.dw_28[al_row]
- Case "dw_29"
- dwo=ids_Requestor.Object.dw_29[al_row]
- Case "dw_30"
- dwo=ids_Requestor.Object.dw_30[al_row]
-
- Case "dw_master"
- dwo=ids_Requestor.Object.dw_master[al_row]
- Case "dw_main"
- dwo=idw_Requestor.Object.dw_main[al_row]
- Case "d_main"
- dwo=idw_Requestor.Object.d_main[al_row]
- END CHOOSE
- Catch(RunTimeError er3)
- li_Result = -1
- END TRY
- END IF
-
- IF IsValid(dwo) AND li_Result=0 Then
- li_Result=1
- END IF
-
- Return li_Result
- end function
- public function boolean of_isnested ();Return ib_Nested
- end function
- public subroutine of_updatenestreport ();Int li
- For li=1 To UpperBound(inv_NestReports)
- OF_UpdateReport(1,inv_NestReports[li].Name ,inv_NestReports[li].inv_Report )
- Next
- end subroutine
- public subroutine of_registcolumninfo_1 ();Int li
- //先取得对象的边线信息
- For li=1 TO UpperBound(inv_Bands)
- inv_Bands[li].OF_GetObjectBorderInfo()
- Next
- //第一步,先注册细节区的对象
- IF OF_ContaintBand("detail") Then
- OF_GetBand("detail").OF_RegistColumnInfo_1()
- ELSEIF is_Processing<>"1" AND is_Processing<>"4" Then
- For li=1 TO UpperBound(inv_Bands)
- inv_Bands[li].OF_RegistColumnInfo_1()
- Next
- END IF
- //处理子数据窗口
- For li=1 To UpperBound(inv_ChildReports)
- IF IsValid(inv_ChildReports[li].inv_Report) Then
- inv_ChildReports[li].inv_Report.OF_RegistColumnInfo_1()
- END IF
- Next
- For li=1 To UpperBound(inv_NestReports)
- IF IsValid(inv_NestReports[li].inv_Report) Then
- inv_NestReports[li].inv_Report.OF_RegistColumnInfo_1()
- END IF
- Next
- end subroutine
- public subroutine of_registcolumninfo_2 ();Int li
- //第二步,注册有边框和向右对齐的对象
- For li=1 TO UpperBound(inv_Bands)
- inv_Bands[li].OF_RegistColumnInfo_2()
- Next
- //处理子数据窗口
- For li=1 To UpperBound(inv_ChildReports)
- IF IsValid(inv_ChildReports[li].inv_Report) Then
- inv_ChildReports[li].inv_Report.OF_RegistColumnInfo_2()
- END IF
- Next
- For li=1 To UpperBound(inv_NestReports)
- IF IsValid(inv_NestReports[li].inv_Report) Then
- inv_NestReports[li].inv_Report.OF_RegistColumnInfo_2()
- END IF
- Next
- end subroutine
- public subroutine of_registcolumninfo_3 ();Int li
- //第二步,注册有边框和向右对齐的对象
- For li=1 TO UpperBound(inv_Bands)
- inv_Bands[li].OF_RegistColumnInfo_3()
- Next
- //处理子数据窗口
- For li=1 To UpperBound(inv_ChildReports)
- IF IsValid(inv_ChildReports[li].inv_Report) Then
- inv_ChildReports[li].inv_Report.OF_RegistColumnInfo_3()
- END IF
- Next
- For li=1 To UpperBound(inv_NestReports)
- IF IsValid(inv_NestReports[li].inv_Report) Then
- inv_NestReports[li].inv_Report.OF_RegistColumnInfo_3()
- END IF
- Next
- end subroutine
- public subroutine of_getobjectposition (readonly string as_band, readonly string as_type, readonly string as_name, ref long ai_x1, ref long ai_y1, ref long ai_x2, ref long ai_y2, ref string as_x1_exp, ref string as_y1_exp, ref string as_x2_exp, ref string as_y2_exp);Long li_Temp
- Long li_Row
- String ls_Value, ls_Exp
- ai_x1 = 0
- ai_y1=0
- ai_x2=0
- ai_y2=0
- as_x1_exp=""
- as_y1_exp=""
- as_x2_exp=""
- as_y2_exp=""
- IF as_Band="summary" OR as_Band="footer" Then
- li_Row =OF_RowCount()
- ELSE
- li_Row =1
- END IF
- Choose Case as_Type
- Case "line"
- OF_GetProperty(as_Name,"x1", ls_Value, ls_Exp)
- IF ls_Exp<>'' AND IsNumber(ls_Exp)=False Then
- as_x1_exp=ls_Exp
- ls_Exp = OF_Evaluate(li_Row, ls_Exp)
- END IF
-
- IF IsNumber(ls_Exp) Then
- ai_x1= Long(ls_Exp)
- ELSE
- ai_x1 = Long(ls_Value)
- END IF
-
- OF_GetProperty(as_Name,"y1", ls_Value, ls_Exp)
- IF ls_Exp<>'' AND IsNumber(ls_Exp)=False Then
- as_y1_exp=ls_Exp
- ls_Exp = OF_Evaluate(li_Row, ls_Exp)
- END IF
-
- IF IsNumber(ls_Exp) Then
- ai_y1 = Long(ls_Exp)
- ELSE
- ai_Y1 = Long(ls_Value)
- END IF
-
- OF_GetProperty(as_Name,"X2", ls_Value, ls_Exp)
-
- IF ls_Exp<>'' AND IsNumber(ls_Exp)=False Then
- as_x2_exp=ls_Exp
- ls_Exp = OF_Evaluate(li_Row, ls_Exp)
- END IF
-
- IF IsNumber(ls_Exp) Then
- ai_x2 = Long(ls_Exp)
- ELSE
- ai_x2= Long(ls_Value)
- END IF
-
- OF_GetProperty(as_Name,"Y2", ls_Value, ls_Exp)
- IF ls_Exp<>'' AND IsNumber(ls_Exp)=False Then
- as_y2_exp=ls_Exp
- ls_Exp = OF_Evaluate(li_Row, ls_Exp)
- END IF
-
- IF IsNumber(ls_Exp) Then
- ai_y2 = Long(ls_Exp)
- ELSE
- ai_Y2= Long(ls_Value)
- END IF
-
- IF ai_x1>ai_x2 Then
- li_Temp = ai_x1
- ai_x1 = ai_x2
- ai_x2 =li_Temp
- END IF
- IF ai_y1>ai_y2 Then
- li_Temp = ai_y1
- ai_y1 = ai_y2
- ai_y2 =li_Temp
- END IF
- Case Else
- OF_GetProperty(as_Name,"x", ls_Value, ls_Exp)
- IF ls_Exp<>'' AND IsNumber(ls_Exp)=False Then
- as_x1_exp=ls_Exp
- ls_Exp = OF_Evaluate(li_Row, ls_Exp)
- END IF
-
- IF IsNumber(ls_Exp) Then
- ai_x1 = Long(ls_Exp)
- ELSE
- ai_x1 = Long(ls_Value)
- END IF
-
- OF_GetProperty(as_Name,"y", ls_Value, ls_Exp)
- IF ls_Exp<>'' AND IsNumber(ls_Exp)=False Then
- as_y1_exp=ls_Exp
- ls_Exp = OF_Evaluate(li_Row, ls_Exp)
- END IF
-
- IF ls_Exp<>'' AND IsNumber(ls_Exp)=False Then
- ls_Exp = OF_Evaluate(li_Row, ls_Exp)
- END IF
-
- IF IsNumber(ls_exp) Then
- ai_y1 = Long(ls_Exp)
- ELSE
- ai_Y1 = Long(ls_Value)
- END IF
-
- OF_GetProperty(as_Name,"Width", ls_Value, ls_Exp)
- IF ls_Exp<>'' AND IsNumber(ls_Exp)=False Then
- as_x2_exp=ls_Exp
- ls_Exp = OF_Evaluate(li_Row, ls_Exp)
- END IF
-
- IF IsNumber( ls_exp) Then
- ai_x2 = ai_x1+ Long(ls_Exp)
- ELSE
- ai_x2=ai_x1+ Long(ls_Value)
- END IF
-
- OF_GetProperty(as_Name,"Height", ls_Value, ls_Exp)
- IF ls_Exp<>'' AND IsNumber(ls_Exp)=False Then
- as_y2_exp=ls_Exp
- ls_Exp = OF_Evaluate(li_Row, ls_Exp)
- END IF
-
- IF IsNumber(ls_Exp) Then
- ai_Y2=ai_Y1+ Long(ls_Exp)
- ELSE
- ai_y2 = ai_y1 + Long(ls_Value)
- END IF
-
- END CHOOSE
- IF ai_x1<0 Then
- ai_x1=0
- END IF
- IF ai_y1<0 Then
- ai_y1=0
- END IF
- IF ai_x2 <0 Then
- ai_x2 =0
- END IF
- IF ai_y2<0 Then
- ai_y2=0
- END IF
- IF is_Units='1' Then
- ai_x1 = PixelsToUnits(ai_X1, XPixelsToUnits!)
- ai_x2 = PixelsToUnits(ai_x2, XPixelsToUnits!)
- ai_y1 = PixelsToUnits(ai_y1, YPixelsToUnits!)
- ai_y2 = PixelsToUnits(ai_y2, YPixelsToUnits!)
- ELSEIF is_Units='2' Then
- ai_x1 = PixelsToUnits(inv_Api.OF_InchToPixels(ai_X1/1000 ) , XPixelsToUnits!)
- ai_x2 = PixelsToUnits(inv_Api.OF_InchToPixels(ai_x2/1000) , XPixelsToUnits!)
- ai_y1 = PixelsToUnits(inv_Api.OF_InchToPixels(ai_y1 /1000 ) , YPixelsToUnits!)
- ai_y2 = PixelsToUnits(inv_Api.OF_InchToPixels(ai_y2/1000 ), YPixelsToUnits!)
- ELSEIF is_Units='3' Then
- ai_x1 = PixelsToUnits(inv_Api.OF_CMToPixels(ai_X1 /1000), XPixelsToUnits!)
- ai_x2 = PixelsToUnits(inv_Api.OF_CMToPixels(ai_x2 /1000 ), XPixelsToUnits!)
- ai_y1 = PixelsToUnits(inv_Api.OF_CMToPixels(ai_y1 /1000 ), YPixelsToUnits!)
- ai_y2 = PixelsToUnits(inv_Api.OF_CMToPixels(ai_y2 /1000 ), YPixelsToUnits!)
- END IF
- IF is_Units<>'0' Then
- IF ai_x1<0 Then
- ai_x1+=65536
- END IF
- IF ai_y1<0 Then
- ai_y1+=65536
- END IF
- IF ai_x2 <0 Then
- ai_x2 +=65536
- END IF
- IF ai_y2<0 Then
- ai_y2+=65536
- END IF
- END IF
- IF as_Band<>"detail" AND Pos(as_Band,".")<=0 Then
- as_x1_exp=""
- as_y1_exp=""
- as_x2_exp=""
- as_y2_exp=""
- END IF
- end subroutine
- public function Long of_getbandheight (readonly string as_band);Long li_Height
- li_Height = Long(OF_Describe("DataWindow."+as_Band+".Height"))
- IF is_Units ='1' Then
- li_Height = PixelsToUnits(li_Height ,YPixelsToUnits!)
- ELSEIF is_Units='2' Then
- li_Height = PixelsToUnits(inv_Api.OF_InchToPixels( li_Height) /1000,YPixelsToUnits!)
- ELSEIF is_Units='3' Then
- li_Height = PixelsToUnits(inv_Api. OF_CMToPixels( li_Height )/1000,YPixelsToUnits!)
- END IF
- IF li_Height<0 and is_Units<>'0' Then
- li_Height+=65535
- END IF
- Return li_Height
- end function
- public function long of_getreport_x1 ();Return il_X
- end function
- public function Long of_getheader_beginy ();Return il_Header_BeginY
- end function
- public function Long of_getcontrolheight ();IF ipo_Type=DataWindow! Then
- Return idw_Requestor.Height
- ELSEIF ib_Child Then
- Return il_Y2 - il_Y
-
- ELSEIF is_Processing='3' Then
-
- END IF
- RETURN 0
- end function
- public function Long of_getcontrolwidth ();IF ipo_Type=DataWindow! Then
- Return idw_Requestor.Width
- ELSEIF ib_Child Then
- Return il_X2 - il_X
- END IF
- RETURN 0
- end function
- public function Long of_getreport_x2 ();Return il_X2
- end function
- public function boolean of_initialreport (n_dw2xls_object anv_object, readonly long ai_x, readonly long ai_y, readonly long ai_x2, readonly long ai_y2);String ls_Name , ls_Band, ls_Data, ls_Syntax
- Long li_Row , li_Result
- Any la_Args[]
- String ls_ArgTypes[]
- String ls_Processing
- n_dw2xls_DataStore lds
- n_dw2xls_Requestor lnv_Report
- DWObject dwo ,dwo2
- DataWindowChild dwc
- IF Not IsValid(anv_Object) Then
- Return False
- END IF
- ls_Band =anv_Object.inv_Band.OF_GetName()
- IF ls_Band="summary" OR ls_Band="footer" Then
- li_Row =anv_Object.inv_Requestor.OF_RowCount()
- ELSE
- IF anv_Object.inv_Requestor.OF_RowCount() >0 Then
- li_Row =1
- END IF
- END IF
- ls_Name = anv_Object.Name
- li_Result =0
- IF OF_GetChild(ls_Name, dwc) =1 Then
- li_Result = 1
- END IF
- IF li_Result=0 AND li_Row>0 Then
- IF OF_GetChild(li_Row,ls_Name, dwo)=1 Then
- Try
- lds = Create n_dw2xls_DataStore
- dwo2= dwo.Object //DataWindow.Syntax 和 DataWindow.Data同时使用dwo,会出错
- lds.Create(dwo.Object.DataWindow.Syntax+"~r~n"+String(dwo2.Datawindow.Syntax.Data) )
- lds.Modify("DataWindow.NoUserPrompt=yes")
- ls_Processing =lds.Describe("DataWindow.Processing")
- IF ls_Processing<>"!" AND ls_Processing<>"?" AND ls_Processing<>"" AND ls_Processing<>"2" AND Long(ls_Processing)<=5 Then
- lds.OF_SetRetrieveData(False)
- //为了让数据窗口的检索参数有值
- IF OF_GetArguments(li_Row, lds.Describe("DataWindow.Table.Arguments"), OF_Describe(ls_Name+".Nest_Arguments"), la_Args, ls_ArgTypes )>0 Then
- lds.OF_Retrieve(la_Args , ls_ArgTypes )
- END IF
- li_Result =2
- END IF
- Catch(RunTimeError er)
-
- END TRY
- END IF
- END IF
- IF li_Result =0 AND li_Row>0 Then
- lds = Create n_dw2xls_DataStore
- IF lds.OF_SetDataObject(OF_Describe(ls_Name+".DataObject")) Then
- ls_Processing =lds.Describe("DataWindow.Processing")
- IF ls_Processing<>"!" AND ls_Processing<>"?" AND ls_Processing<>"" AND ls_Processing<>"2" AND Long(ls_Processing)<=5 Then
- lds.Modify("DataWindow.NoUserPrompt=yes")
- lds.OF_SetRetrieveData(TRUE)
- IF OF_GetArguments(li_Row, lds.Describe("DataWindow.Table.Arguments"), OF_Describe(ls_Name+".Nest_Arguments"), la_Args , ls_ArgTypes )>0 Then
- lds.OF_Retrieve(la_Args , ls_ArgTypes )
- END IF
- li_Result =3
- END IF
- END IF
- END IF
- IF li_Result=0 Then
- IF IsValid(anv_Object.inv_Report) Then
- Destroy anv_Object.inv_Report
- END IF
- ELSE
- IF Not IsValid(anv_Object.inv_Report) Then
- anv_Object.Inv_Report = Create n_dw2xls_Requestor
- END IF
- lnv_Report =anv_Object.Inv_Report
- lnv_Report.il_x = ai_x
- lnv_Report.il_Y = ai_y
- lnv_Report.il_x2 = ai_x2
- lnv_Report.il_y2 = ai_y2
- lnv_Report.ib_Child =TRUE
- lnv_Report.OF_SetWinApi( OF_GetWinApi() )
- END IF
- IF li_Result=1 Then
- IF lnv_Report.OF_SetRequestor(dwc, inv_Progress, inv_Layout )=1 Then
- lnv_Report.il_RowCount =dwc.RowCount()
- inv_ChildReports[UpperBound(inv_ChildReports)+1] = anv_Object
- ELSE
- li_Result = -1
- END IF
-
- ELSEIF li_Result>1 AND IsValid(lds) Then
-
- lnv_Report.il_RowCount =lds.RowCount()
- IF lnv_Report.il_RowCount = 0 Then //如果子数据窗口是个复合类型的数据窗口,则记录可能为0
- IF lds.Describe("DataWindow.Processing")="5" THen
- lds.InsertRow(0)
- lnv_Report.il_RowCount =1
- ELSEIF ls_Band="summary" OR ls_Band="footer" Then
- lds.InsertRow(0)
- lnv_Report.il_RowCount =1
- END IF
- END IF
- lds.GroupCalc()
-
- IF li_Result=2 Then
- lnv_Report.idwo_Parent = dwo
- END IF
-
-
- IF lnv_Report.OF_SetRequestor(lds, inv_Progress, inv_Layout ) =1 Then
- inv_NestReports[UpperBound(inv_NestReports)+1]=anv_Object
- ELSE
- li_Result =-1
- END IF
- END IF
- IF li_Result>0 THEN
- Return TRUE
- ELSE
- Return False
- END IF
-
- end function
- public function integer of_getfirstcolumn ();Return ii_FirstColumn
- end function
- public function integer of_getlastcolumn ();Return ii_LastColumn
- end function
- public subroutine of_setfirstcolumn (readonly integer ai_column);ii_FirstColumn = ai_Column
- end subroutine
- public subroutine of_setlastcolumn (readonly integer ai_column);ii_LastColumn= ai_Column
- end subroutine
- public function integer of_getarguments (readonly long al_row, readonly string as_arguments, string as_nestarguments, ref any aa_argvalue[], ref string as_argtype[]);Int li , li_cnt,li_cnt2, li_Pos
- String ls_Name, ls_Type, ls_Value,ls_Args[] ,ls_NestArgs[]
- as_NestArguments = Trim(as_NestArguments)
- IF Left(as_NestArguments,1)="(" Then
- as_NestArguments = Mid(as_NestArguments,2, Len(as_NestArguments) -2)
- END IF
- IF as_Arguments<>"!" AND as_Arguments<>"" AND as_Arguments<>"?" Then
- li_cnt = OF_ParseToArray(as_Arguments,"~n",ls_Args)
- li_cnt2=OF_ParseToArray(as_NestArguments,",",ls_NestArgs)
-
- IF li_cnt<> li_cnt2 Then
- Return 0
- END IF
-
- For li=1 To li_cnt
-
- li_Pos=Pos(ls_Args[li],"~t")
- ls_Name=Left(ls_Args[li],li_Pos -1)
- ls_Type=Mid(ls_Args[li],li_Pos+1)
-
- ls_NestArgs[li] = Trim(ls_NestArgs[li])
-
- IF Left(ls_NestArgs[li],1)="(" Then
- ls_NestArgs[li] = Mid(ls_NestArgs[li],2, Len(ls_NestArgs[li]) -2)
- END IF
-
- IF Left(ls_NestArgs[li],1)='"' Then
- ls_NestArgs[li] = Mid(ls_NestArgs[li],2, Len(ls_NestArgs[li]) -2)
- END IF
-
- ls_Value=OF_Describe('evaluate("'+ls_NestArgs[li] +'",'+String(al_Row)+' )' )
- IF ls_Value="?" OR ls_Value="!" Then
- ls_Value=""
- END IF
-
- Choose Case ls_Type
- Case "string"
- aa_ArgValue[li]=ls_Value
-
- Case "number"
- aa_ArgValue[li]=Double(ls_Value)
- Case "decimal"
- aa_ArgValue[li]=Dec(ls_Value)
- Case "datetime"
- aa_ArgValue[li]=DateTime(blob(ls_Value))
- Case "date"
- aa_ArgValue[li]=Date(ls_Value)
- Case "time"
- aa_ArgValue[li]=Time(ls_Value)
- END CHOOSE
-
- as_argType[li] = ls_Type
-
- Next
- END IF
- Return li_cnt
- end function
- public function long of_output (readonly unsignedlong al_hsheet, readonly long al_beginrow);Int li,lj ,li_Increase,li_Height
- Long li_Row, li_CurRow ,li_RowCount ,li_Header_Rows
- Boolean lb_HasDetail, lb_TrailerFlag
- n_dw2xls_Band lnv_Band ,lnv_Detail
- //Nest类型的数据窗口,如果子数据窗口没有数据,在数据窗口上面是不显示内容的
- IF inv_Layout.OF_IsNested() AND ib_Child AND il_RowCount=0 Then
- Return al_beginrow
- END IF
-
- //初始化列宽,行高
- IF Not ib_Child Then
- inv_Layout.OF_Write_ColumnInfo(inv_Api, al_hSheet)
- END IF
-
- li_CurRow = al_beginrow
- li_RowCount = OF_RowCount()
- IF ( inv_Layout.OF_IsNested()=False OR inv_Layout.OF_RowCount()=1) OR ib_Child=False Then
- li_Increase =1
- ELSE
- li_Increase =0
- END IF
- For li=1 To UpperBound(inv_Bands)
- inv_Bands[li].OF_SortObject_Row()
- inv_Bands[li].OF_SetWorkSheet(al_hSheet)
- NEXT
- IF is_Processing="4" Then
- For li=1 To ii_HeaderCount
- IF of_containtband("header["+String(li)+"]" ) Then
- lnv_Band = OF_GetBand("header["+String(li)+"]" )
- IF li_RowCount>0 Then
- li_CurRow +=lnv_Band.OF_OutPut( 1, li_CurRow)
- ELSE
- li_CurRow +=lnv_Band.OF_OutPut(0 , li_CurRow)
- END IF
- END IF
- inv_Progress.OF_Progress(li_Increase )
- Next
- ELSE
- IF of_containtband("header") Then
- lnv_Band = OF_GetBand("header")
- IF li_RowCount>0 Then
- li_CurRow +=lnv_Band.OF_OutPut( 1, li_CurRow)
- ELSE
- li_CurRow +=lnv_Band.OF_OutPut(0 , li_CurRow)
- END IF
- inv_Progress.OF_Progress(li_Increase )
- END IF
- END IF
- li_Header_Rows = li_CurRow
- IF inv_Progress.ib_Cancel Then
- Return -1
- END IF
- IF of_containtband("detail") Then
- lnv_Detail= OF_GetBand("detail")
- lb_HasDetail =TRUE
-
- IF lnv_Detail.OF_RowCount()=1 AND ib_Child=False AND ib_Nested=False AND is_Processing<>'5' Then
- inv_Api.SetDefRowHeight(al_hSheet, lnv_Detail.OF_GetRowHeight(1) )
- END IF
- ELSE
- lb_HasDetail =FALSE
- IF ii_GroupLevels=1 AND of_containtband("trailer.1") Then
- lnv_Band = OF_GetBand("trailer.1")
- IF lnv_Band.OF_RowCount()=1 AND ib_Child=False AND ib_Nested=False AND is_Processing<>'5' Then
- li_Height= lnv_Band.OF_GetRowHeight(1)
- inv_Api.SetDefRowHeight( al_hSheet,li_Height)
- END IF
- END IF
- END IF
- //如果细节区没有对象,而且没有分组,则避免循环
- IF lb_HasDetail=False AND ii_GroupLevels<=0 Then
- li_RowCount =0
- END IF
- For li_Row=1 TO li_RowCount
-
- lb_TrailerFlag=False
- FOR li=1 To ii_GroupLevels
- IF inv_Progress.ib_Cancel Then
- Return -1
- END IF
-
- IF OF_FindGroupChange(li_Row,li)=li_Row Then //分组的开始
- IF li_Row<>1 AND Not lb_TrailerFlag Then //第一次,不用输出组的尾区
- lb_TrailerFlag=True
- For lj=ii_GroupLevels TO li Step -1 //组尾区的显示顺序,与组头区是倒过来的
- IF of_containtband("trailer."+String(lj)) Then
- lnv_Band = OF_GetBand("trailer."+String(lj ) )
- li_CurRow +=lnv_Band.OF_OutPut( li_Row -1 , li_CurRow)
- ib_Detail_Begin =TRUE
- END IF
-
- //是否按组分页打印
- IF lj<=UpperBound(ib_GroupNewPage) Then
- IF ib_GroupNewPage[lj] Then
- inv_Layout.OF_AddHPageBreak(li_CurRow) //保存分页的行号
- END IF
- END IF
- Next
- END IF
- IF of_containtband("header."+String(li)) Then
- lnv_Band = OF_GetBand("header."+String(li) )
- li_CurRow +=lnv_Band.OF_OutPut( li_Row , li_CurRow)
- ib_Detail_Begin =TRUE
- END IF
- END IF
- Next
-
- IF inv_Progress.ib_Cancel Then
- Return -1
- END IF
- IF lb_HasDetail Then
- li_CurRow += lnv_Detail.OF_OutPut( li_Row , li_CurRow)
-
- IF ib_Nested Then
- li_Height =lnv_Detail.OF_GetBottomSpaceHeight()
-
- IF li_Height>0 Then
- li_Height = ( UnitsToPixels(li_Height,YUnitsToPixels!)+2) *1440 /inv_Layout.ii_LOGPIXELSY
- li_CurRow++
- inv_Api.SetRowHeight(al_hSheet, li_CurRow, li_Height)
- END IF
- END IF
- END IF
- inv_Progress.OF_Progress(li_Increase )
- li_Row=li_Row+ii_Rows_Per_Detail -1
- ib_Detail_Begin =False
- Next
- IF inv_Progress.ib_Cancel Then
- Return -1
- END IF
- //输出所有组的最后一组脚尾区
- IF li_RowCount>0 Then
- FOR li=ii_GroupLevels To 1 Step -1
- IF of_containtband("trailer."+String(li) ) Then
- lnv_Band = OF_GetBand("trailer."+String(li) )
- li_CurRow +=lnv_Band.OF_OutPut( li_RowCount , li_CurRow)
- END IF
- NEXT
- END IF
-
- IF inv_Progress.ib_Cancel Then
- Return -1
- END IF
- li_RowCount = OF_RowCount()
- IF li_RowCount>0 Then
- IF of_containtband("summary") Then
- lnv_Band = OF_GetBand("summary")
- li_CurRow +=lnv_Band.OF_OutPut( li_RowCount , li_CurRow)
- inv_Progress.OF_Progress(li_Increase)
- END IF
- END IF
- IF inv_Progress.ib_Cancel Then
- Return -1
- END IF
-
- IF of_containtband("footer") Then
- lnv_Band = OF_GetBand("footer")
- li_CurRow +=lnv_Band.OF_OutPut( li_RowCount , li_CurRow)
- inv_Progress.OF_Progress(li_Increase)
- END IF
- //输出打印设置
- IF Not ib_Child Then
- inv_Layout.OF_Write_PageBreak(inv_Api, al_hSheet )
- OF_Write_PrintSetting(al_hSheet )
- IF li_Header_Rows>0 AND is_Processing<>'3' AND is_Processing<>'5' Then
- inv_Api.SetRepeatRows(al_hSheet, 0, li_Header_Rows)
-
- IF inv_Progress.ib_FreezeTitles Then
- inv_Api.SetFreeze(al_hSheet, li_Header_Rows ,0 )
- inv_Layout.ii_Freeze_Rows =li_Header_Rows
- END IF
- END IF
- END IF
- Return li_CurRow // -al_beginrow
- end function
- public function integer of_getobject_x1 (readonly string as_name);Int li_X
- String ls_Value ,ls_Exp
- OF_GetProperty(as_Name,"x", ls_Value, ls_Exp)
- IF ls_Exp<>'' AND IsNumber(ls_Exp)=False Then
- ls_Exp = OF_Evaluate(1, ls_Exp)
- END IF
- IF IsNumber(ls_Exp) Then
- li_X = Long(ls_Exp)
- ELSE
- li_X = Long(ls_Value)
- END IF
- IF li_X<0 Then
- li_X =0
- END IF
- IF is_Units='1' Then
- li_X = PixelsToUnits(li_X, XPixelsToUnits!)
- ELSEIF is_Units='2' Then
- li_X = PixelsToUnits(inv_Api.OF_InchToPixels(li_X/1000 ) , XPixelsToUnits!)
- ELSEIF is_Units='3' Then
- li_X = PixelsToUnits(inv_Api.OF_CMToPixels(li_X /1000), XPixelsToUnits!)
- END IF
- IF is_Units<>'0' Then
- IF li_X<0 Then
- li_X+=65536
- END IF
- END IF
- Return li_X
- end function
- public function integer of_getobject_x2 (readonly string as_name);Int li_X ,li_Width
- String ls_Value ,ls_Exp
- OF_GetProperty(as_Name,"x", ls_Value, ls_Exp)
- IF ls_Exp<>'' AND IsNumber(ls_Exp)=False Then
- ls_Exp = OF_Evaluate(1, ls_Exp)
- END IF
- IF IsNumber(ls_Exp) Then
- li_X = Long(ls_Exp)
- ELSE
- li_X = Long(ls_Value)
- END IF
- OF_GetProperty(as_Name,"Width", ls_Value, ls_Exp)
- IF ls_Exp<>'' AND IsNumber(ls_Exp)=False Then
- ls_Exp = OF_Evaluate(1, ls_Exp)
- END IF
- IF IsNumber(ls_Exp) Then
- li_Width = Long(ls_Exp)
- ELSE
- li_Width = Long(ls_Value)
- END IF
- IF li_X<0 Then
- li_X=0
- END IF
-
- IF li_Width<0 Then
- li_Width=0
- END IF
-
- IF is_Units='1' Then
- li_X = PixelsToUnits(li_X, XPixelsToUnits!)
- li_Width = PixelsToUnits(li_Width, XPixelsToUnits!)
- ELSEIF is_Units='2' Then
- li_X = PixelsToUnits(inv_Api.OF_InchToPixels(li_X/1000 ) , XPixelsToUnits!)
- li_Width = PixelsToUnits(inv_Api.OF_InchToPixels(li_Width/1000 ) , XPixelsToUnits!)
- ELSEIF is_Units='3' Then
- li_X = PixelsToUnits(inv_Api.OF_CMToPixels(li_X /1000), XPixelsToUnits!)
- li_Width = PixelsToUnits(inv_Api.OF_CMToPixels(li_Width /1000), XPixelsToUnits!)
- END IF
- IF is_Units<>'0' Then
- IF li_X<0 Then
- li_X+=65536
- END IF
-
- IF li_Width<0 Then
- li_Width+=65536
- END IF
-
- END IF
- Return li_X + li_Width
- end function
- on n_dw2xls_requestor.create
- call super::create
- TriggerEvent( this, "constructor" )
- end on
- on n_dw2xls_requestor.destroy
- TriggerEvent( this, "destructor" )
- call super::destroy
- end on
- event destructor;Int li
- IF IsValid(inv_Layout) Then
- Destroy inv_Layout
- END IF
- For li=1 To UpperBound( inv_Bands)
- Destroy inv_Bands[li]
- Next
- For li=1 To UpperBound( inv_Exps)
- Destroy inv_Exps[li]
- Next
- Try
- IF IsValid(ids_Composite) Then
- ids_Composite.Reset()
- Destroy ids_Composite
- END IF
-
- Catch(RunTimeError er)
-
- End TRY
- IF IsValid(ids_Requestor) AND ib_Child Then
- Destroy ids_Requestor
- END IF
- end event
|