n_dw2xls_object.sru 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  1. $PBExportHeader$n_dw2xls_object.sru
  2. forward
  3. global type n_dw2xls_object from nonvisualobject
  4. end type
  5. end forward
  6. global type n_dw2xls_object from nonvisualobject
  7. end type
  8. global n_dw2xls_object n_dw2xls_object
  9. type prototypes
  10. end prototypes
  11. type variables
  12. Long x1 , y1 ,x2,y2
  13. Long Original_X1, Original_Y1, Original_x2, Original_Y2
  14. Long Width , Height
  15. String X_EXP , Y_Exp , Width_Exp , Height_Exp
  16. int startrow =1
  17. Int endrow=1
  18. Int startcol = 0
  19. Int endcol =0
  20. int rowInDetail =1
  21. int ObjSpace
  22. string name
  23. String objType
  24. string colType
  25. Int ColID
  26. Boolean IsCloneColumn //是否复制后的数据列,如例 数据列 Dept显示部门代码 dept_1是复制的列,用于显示部门名称
  27. Boolean IsGetDisplayValue
  28. String EditStyle
  29. Boolean CellHasMultiObjects
  30. Boolean DynamicPosition
  31. Boolean PositionChanged
  32. Boolean IsForeGround
  33. Boolean Visible=TRUE
  34. string visibleExp
  35. Boolean AutoHeight
  36. //字体属性
  37. string fontName
  38. string fontNameExp
  39. int fontsize
  40. string fontSizeExp
  41. boolean fontBold
  42. string fontBoldExp
  43. boolean fontUnderline
  44. String fontUnderlineExp
  45. boolean fontItalic
  46. String fontItalicExp
  47. Boolean fontStrikeout
  48. String fontStrikeoutExp
  49. String alignment
  50. string format
  51. string formatExp
  52. long color
  53. string colorExp
  54. Long bkColor
  55. String bkColorExp
  56. int halignment
  57. int vAlignment =1
  58. Boolean WrapText
  59. String BorderStyle='0'
  60. //增加对CheckBox 文本诉输出
  61. Boolean IsCheckBox
  62. Boolean CheckBox_LeftText
  63. String CheckBox_Text
  64. String CheckBox_On
  65. String CheckBox_Off
  66. //图片
  67. Boolean IsPicture
  68. Boolean IsGraph
  69. String PictureName
  70. String PictureExp
  71. Int Picture_OffsetX
  72. Int Picture_OffSetY
  73. Boolean NoContaint
  74. Boolean IsBorderOnly
  75. Boolean SkipBorder
  76. Boolean IsSparse
  77. Long LastWriteValueRow
  78. n_dw2xls_Object inv_PriorSparseObject
  79. Any PriorRowValue
  80. Boolean IsSlideup
  81. Long LastRow
  82. n_dw2xls_Object inv_SlideupObject[]
  83. n_dw2xls_Object inv_SlideLeftObject
  84. Int fontIndex=-1
  85. Int xfIndex=-1
  86. Boolean WritedFormat //是否已输入格式,用于判断是否用过GetXF来提高效率
  87. String Text
  88. String TextExp
  89. Int TextWidth
  90. Int TextHeight
  91. Int SpaceCharWidth
  92. Int SpaceCharHeight
  93. n_dw2xls_requestor inv_Requestor
  94. n_dw2xls_requestor inv_Report
  95. n_dw2xls_Band inv_Band
  96. //四条边线
  97. n_dw2xls_Line inv_LeftLine
  98. n_dw2xls_Line inv_RightLine
  99. n_dw2xls_Line inv_TopLine
  100. n_dw2xls_Line inv_BottomLine
  101. Boolean ib_HasBorder
  102. //与当前对象相靠近的对象
  103. n_dw2xls_object inv_LeftObject
  104. n_dw2xls_Object inv_RightObject
  105. n_dw2xls_Object inv_UpObject
  106. n_dw2xls_Object inv_DownObject
  107. n_dw2xls_Object inv_SlideLeftObjects[]
  108. end variables
  109. forward prototypes
  110. public subroutine of_setcoltype (string as_coltype)
  111. public subroutine of_setreport (n_dw2xls_requestor anv_report)
  112. public subroutine of_setrequestor (readonly n_dw2xls_requestor anv_requestor, readonly n_dw2xls_band anv_band, readonly string as_type, readonly string as_name)
  113. public function boolean of_updateposition (readonly long al_row)
  114. public subroutine of_addslideupobject (n_dw2xls_object anv_object)
  115. public function Long of_getlastrow ()
  116. public subroutine of_setposition (readonly long ai_x1, readonly long ai_y1, readonly long ai_x2, readonly long ai_y2, readonly string as_x_exp, readonly string as_y_exp, readonly string as_width_exp, readonly string as_height_exp)
  117. public function Long of_gettextrect_x1 ()
  118. public function Long of_gettextrect_x2 ()
  119. public function long of_gettextrect_y2 ()
  120. public function Long of_getlastwritevaluerow ()
  121. end prototypes
  122. public subroutine of_setcoltype (string as_coltype);IF as_ColType="?" OR as_ColType="!" Then
  123. as_ColType=""
  124. END IF
  125. IF Left(as_ColType,4)="char" Then
  126. ColType="char"
  127. ELSE
  128. ColType = as_ColType
  129. END IF
  130. Choose Case ColType
  131. Case 'char'
  132. PriorRowValue =''
  133. Case "datetime"
  134. PriorRowValue = DateTime(1900-01-01,00:00:00)
  135. Case "date"
  136. PriorRowValue = 1900-01-01
  137. Case "time"
  138. PriorRowValue=00:00:00
  139. Case Else
  140. PriorRowValue =0
  141. END CHOOSE
  142. end subroutine
  143. public subroutine of_setreport (n_dw2xls_requestor anv_report);inv_Report = anv_Report
  144. end subroutine
  145. public subroutine of_setrequestor (readonly n_dw2xls_requestor anv_requestor, readonly n_dw2xls_band anv_band, readonly string as_type, readonly string as_name);Long li_Row
  146. String ls_Value, ls_Exp
  147. n_dw2xls_Layout lnv_Layout
  148. n_dw2xls_WinApi lnv_Api
  149. IF Not IsValid(anv_requestor) THen
  150. Return
  151. END IF
  152. IF Not IsValid(anv_Band) THen
  153. Return
  154. END IF
  155. inv_Requestor = anv_requestor
  156. inv_Band = anv_Band
  157. lnv_Layout = anv_requestor.OF_GetLayout()
  158. lnv_Api = anv_Requestor.OF_GetWinApi()
  159. objType =Lower(Trim(as_Type))
  160. name = Lower(Trim( as_Name ))
  161. ls_Value =inv_Band.OF_GetName()
  162. IF inv_Requestor.OF_RowCount()=1 Then
  163. li_Row =1
  164. ELSEIF inv_Requestor.OF_RowCount()>1 Then
  165. IF ls_Value="summary" OR ls_Value="footer" Then
  166. li_Row =inv_Requestor.OF_RowCount()
  167. ELSEIF ls_Value="header" OR Pos(ls_Value,"header[")>0 Then
  168. li_Row =1
  169. END IF
  170. END IF
  171. ls_Value =anv_requestor.OF_Describe(name+".SlideUp")
  172. IF ls_Value='directlyabove' OR ls_Value ="allabove" Then
  173. IsSlideup=true
  174. ELSE
  175. IsSlideup=False
  176. END IF
  177. IF objType="report" Then
  178. IF Not anv_requestor.OF_InitialReport(This, This.X1, This.Y1, This.X2, This.Y2) Then
  179. Destroy inv_Report
  180. objType="tempobj"
  181. END IF
  182. Return
  183. ELSEIF objType="column" OR objType="compute" Then
  184. OF_SetColType( anv_requestor.OF_Describe(name+".ColType") )
  185. EditStyle =anv_Requestor.OF_Describe(name+".Edit.Style")
  186. IF EditStyle="ddlb" OR EditStyle="dddw" OR EditStyle="radiobuttons" Then
  187. IsGetDisplayValue =TRUE
  188. ELSE
  189. IF anv_Requestor.OF_Describe(name+".Edit.CodeTable")="yes" OR anv_Requestor.OF_Describe(name+".EditMask.CodeTable")="yes" Then
  190. IsGetDisplayValue =TRUE
  191. END IF
  192. END IF
  193. END IF
  194. IF IsGetDisplayValue Then
  195. PriorRowValue=""
  196. END IF
  197. //取对象的实际大小,跟x2 - X1不一定完全相同
  198. anv_requestor.OF_GetProperty(name,"Width", ls_Value, ls_Exp)
  199. Width = Long(ls_Value)
  200. anv_requestor.OF_GetProperty(name,"Height", ls_Value, ls_Exp)
  201. Height = Long(ls_Value)
  202. IF anv_requestor.OF_Describe(name,"Height.AutoSize")="yes" Then
  203. AutoHeight=TRUE
  204. ELSE
  205. AutoHeight=False
  206. END IF
  207. IF anv_requestor.OF_GetUnits()='1' Then
  208. Width = PixelsToUnits(Width, XPixelsToUnits!)
  209. Height = PixelsToUnits(Height, YPixelsToUnits!)
  210. ELSEIF anv_requestor.OF_GetUnits()='2' Then
  211. Width = PixelsToUnits(lnv_Api.OF_InchToPixels(Width/1000 ) , XPixelsToUnits!)
  212. Height = PixelsToUnits(lnv_Api.OF_InchToPixels(Height/1000) , YPixelsToUnits!)
  213. ELSEIF anv_requestor.OF_GetUnits()='3' Then
  214. Width = PixelsToUnits(lnv_Api.OF_CMToPixels(Width /1000), XPixelsToUnits!)
  215. Height = PixelsToUnits(lnv_Api.OF_CMToPixels(Height /1000 ), YPixelsToUnits!)
  216. END IF
  217. //字体属性
  218. anv_requestor.OF_GetProperty(name,"Font.Face", ls_Value, ls_Exp)
  219. FontName = ls_Value
  220. FontNameExp = ls_Exp
  221. anv_requestor.OF_GetProperty(name,"Font.Height", ls_Value, ls_Exp)
  222. fontSize = Long(ls_Value)
  223. IF FontSize>0 Then
  224. FontSize = lnv_Api.OF_GetFontSize(fontSize, inv_Requestor.OF_GetUnits())
  225. ELSE
  226. FontSize =Abs(FontSize)
  227. END IF
  228. FontSizeExp = ls_Exp
  229. anv_requestor.OF_GetProperty(name,"Font.Weight", ls_Value, ls_Exp)
  230. IF Long(ls_Value)>=700 Then
  231. fontBold=TRUE
  232. ELSE
  233. fontBold=False
  234. END IF
  235. fontBoldExp = ls_Exp
  236. anv_requestor.OF_GetProperty(name,"Font.Italic", ls_Value, ls_Exp)
  237. IF ls_Value="1" OR ls_Value="yes" Then
  238. fontItalic=TRUE
  239. ELSE
  240. fontItalic=False
  241. END IF
  242. fontItalicExp =ls_Exp
  243. anv_requestor.OF_GetProperty(name,"Font.Underline", ls_Value, ls_Exp)
  244. IF ls_Value="1" OR ls_Value="yes" Then
  245. fontUnderline=TRUE
  246. ELSE
  247. fontUnderline=False
  248. END IF
  249. fontUnderlineExp =ls_Exp
  250. anv_requestor.OF_GetProperty(name,"Font.Strikethrough", ls_Value, ls_Exp)
  251. IF ls_Value="1" OR ls_Value="yes" Then
  252. fontStrikeout=TRUE
  253. ELSE
  254. fontStrikeout=False
  255. END IF
  256. fontStrikeoutExp =ls_Exp
  257. IF EditStyle="checkbox" Then
  258. IsCheckBox = TRUE
  259. CheckBox_Text = anv_requestor.OF_Describe(name+".CheckBox.Text")
  260. CheckBox_On = anv_requestor.OF_Describe(name+".CheckBox.On")
  261. CheckBox_Off = anv_requestor.OF_Describe(name+".CheckBox.Off")
  262. IF anv_requestor.OF_Describe(name+".CheckBox.LeftText")="yes" Then
  263. CheckBox_LeftText =TRUE
  264. END IF
  265. END IF
  266. IF ColType='char' Then
  267. Format="@"
  268. ELSE
  269. IF EditStyle="editmask" Then
  270. Format = anv_requestor.OF_Describe(name+".EditMask.Mask")
  271. IF Format="!" OR Format="?" Then
  272. Format=""
  273. END IF
  274. ELSE
  275. anv_requestor.OF_GetProperty(name,"Format", ls_Value, ls_Exp)
  276. IF ls_Value<>"" OR ls_Exp<>"" Then
  277. anv_requestor.OF_DataFormat(ls_Value, ls_Exp, ColType) //对数据格式进行处理,以与Excel中的数据格式一致
  278. Format = ls_Value
  279. FormatExp = ls_Exp
  280. END IF
  281. END IF
  282. END IF
  283. alignment= anv_requestor.OF_Describe(name,"Alignment" )
  284. IF alignment="1" Then //Right
  285. halignment = lnv_Api.HALIGN_RIGHT
  286. ELSEIF alignment='2' Then //Center
  287. halignment = lnv_Api.HALIGN_CENTER
  288. ELSE
  289. halignment = lnv_Api.HALIGN_LEFT
  290. END IF
  291. BorderStyle= anv_requestor.OF_Describe(name,"Border" )
  292. anv_requestor.OF_GetProperty(name,"Color" ,ls_Value, ls_Exp)
  293. Color =lnv_Api.OF_GetColor( Long(ls_Value) )
  294. ColorExp = ls_Exp
  295. IF Not anv_requestor.OF_IsWriteBKColor() Then
  296. BKColor =inv_Band.COLOR_TRANSPARENT
  297. ELSE
  298. IF anv_requestor.OF_Describe(Name,"BackGround.Mode")="1" Then
  299. BKColor =inv_Band.COLOR_TRANSPARENT
  300. ELSE
  301. anv_requestor.OF_GetProperty(name,"BackGround.Color" ,ls_Value, ls_Exp)
  302. IF IsNumber(ls_Value) Then
  303. BKColor =lnv_Api.OF_GetColor( Long( ls_Value))
  304. ELSE
  305. BKColor =inv_Band.COLOR_TRANSPARENT
  306. END IF
  307. BKColorExp = ls_Exp
  308. END IF
  309. END IF
  310. IF objType="bitmap" Then
  311. IsPicture =TRUE
  312. PictureName= anv_Requestor.OF_Describe(name+".FileName")
  313. ELSEIF objType="column" Then
  314. IF anv_Requestor.OF_Describe(name+".BitMapName")="yes" Then
  315. isPicture=TRUE
  316. END IF
  317. ELSEIF objType="compute" AND colType="char" Then
  318. ls_Exp= Lower(anv_Requestor.OF_Describe(name+".Expression"))
  319. IF Left(ls_Exp,6)="bitmap" Then
  320. PictureExp = Trim(Mid(ls_Exp , 7 ))
  321. IF Left(PictureExp,1)="(" AND Right(PictureExp,1)=")" Then
  322. isPicture=TRUE
  323. END IF
  324. END IF
  325. ELSEIF objType="graph" Then
  326. IsGraph =TRUE
  327. IF anv_Requestor.OF_IsChild()=False AND anv_Requestor.OF_GetProcessing()='3' Then
  328. x1= 0
  329. y1= 0
  330. x2 = anv_Requestor.OF_GetControlWidth()
  331. Y2 = anv_Requestor.OF_GetControlHeight()
  332. Width = x2
  333. Height = y2
  334. END IF
  335. END IF
  336. IF isPicture Then
  337. IF inv_Band.of_GetName()="detail" Then
  338. lnv_Layout.OF_IncreaseProgress_Picture(inv_Requestor.OF_RowCount() )
  339. ELSE
  340. lnv_Layout.OF_IncreaseProgress_Picture(1)
  341. END IF
  342. lnv_Layout.OF_SetHasPictures(TRUE)
  343. ELSEIF IsGraph =TRUE Then
  344. lnv_Layout.OF_IncreaseProgress_Picture(1)
  345. lnv_Layout.OF_SetHasPictures(TRUE)
  346. END IF
  347. IF objType="text" AND BorderStyle='2' Then
  348. ls_Value= anv_requestor.OF_Describe(as_Name+".Text")
  349. IF ls_Value="" OR ls_Value="!" OR ls_Value="?" Then
  350. IsBorderOnly =TRUE
  351. END IF
  352. END IF
  353. //计算文本的实际输出位置,为行列判断提供依据
  354. IF IsPicture=False AND IsBorderOnly=False Then
  355. IF objType="text" Then
  356. inv_Requestor.OF_GetProperty(Name,"Text", Text, TextExp)
  357. IF ( Text<>"" AND TextExp="" AND FontNameExp="" AND FontSizeExp="" AND FontBoldExp="" AND &
  358. inv_Requestor.OF_GetProcessing()<>'1' AND inv_Requestor.OF_GetProcessing()<>'4' ) OR anv_Band.OF_GetName()<>'detail' OR IsForeGround =TRUE Then
  359. lnv_Api.OF_CalcTextRect(Text, FontName, FontSize, FontBold, Width, Height+20, Alignment, AutoHeight, TextWidth, TextHeight ,SpaceCharWidth ,SpaceCharHeight, WrapText )
  360. END IF
  361. IF Text="" Then
  362. NoContaint=TRUE
  363. ELSEIF AutoHeight Then
  364. Y2 = Y1 + TextHeight
  365. inv_Band.OF_UpdateBandHeight(Y2)
  366. END IF
  367. ELSEIF objType="column" OR objType="compute" Then
  368. ls_Value =""
  369. IF li_Row>0 Then
  370. ls_Value =inv_Requestor.OF_GetText(li_Row,Name,ColType, Format)
  371. IF ls_Value="" Then
  372. NoContaint=TRUE
  373. ELSE //加入空格,尽量计算时有足够的宽度可以显示
  374. ls_Value+=" "
  375. END IF
  376. END IF
  377. IF ls_Value="" Then
  378. ls_Value=" "
  379. END IF
  380. IF ( inv_Requestor.OF_GetProcessing()<>'1' AND inv_Requestor.OF_GetProcessing()<>'4' ) OR anv_Band.OF_GetName()<>'detail' OR IsForeGround =TRUE Then
  381. lnv_Api.OF_CalcTextRect(ls_Value, FontName, FontSize, FontBold, Width, Height+20, Alignment, AutoHeight, TextWidth, TextHeight ,SpaceCharWidth ,SpaceCharHeight, WrapText)
  382. END IF
  383. IF li_Row=0 Then
  384. TextWidth =0
  385. END IF
  386. IF AutoHeight Then
  387. IF li_Row=0 Then
  388. TextHeight =0
  389. ELSE
  390. Y2 = Y1 + TextHeight
  391. inv_Band.OF_UpdateBandHeight(Y2)
  392. END IF
  393. END IF
  394. IF colType="char" AND SpaceCharHeight>0 Then
  395. WrapText = Int((Height+20)/SpaceCharHeight)>1
  396. END IF
  397. END IF
  398. END IF
  399. IF colType<>'char' AND objType<>'text' AND IsGetDisplayValue=False Then
  400. WrapText =False
  401. ELSEIF AutoHeight Then
  402. WrapText =TRUE
  403. END IF
  404. IF WrapText AND ( ColType="char" OR ObjType="text") Then
  405. Format=""
  406. FormatExp=""
  407. END IF
  408. IF ObjType="column" Then
  409. ColID = Long(inv_Requestor.OF_Describe(Name+".ID"))
  410. IF inv_Requestor.OF_Describe("#"+String(ColID)+".Name")<> Name Then
  411. IsCloneColumn=TRUE
  412. END IF
  413. END IF
  414. end subroutine
  415. public function boolean of_updateposition (readonly long al_row);Long li_Value , li_Width
  416. String ls_Value
  417. Boolean lb_RowInfoChange
  418. n_dw2xls_winapi lnv_Api
  419. n_dw2xls_Layout lnv_Layout
  420. lb_RowInfoChange =False
  421. IF Not IsValid(inv_Requestor) Then
  422. Return lb_RowInfoChange
  423. END IF
  424. IF al_Row<=0 Then
  425. Return lb_RowInfoChange
  426. END IF
  427. lnv_Api = inv_Requestor.OF_GetWinApi()
  428. lnv_Layout = inv_Requestor.OF_GetLayout()
  429. IF X_EXP<>'' AND IsValid(inv_LeftLine)=False Then
  430. ls_Value =inv_Requestor.OF_Evaluate(al_Row,X_EXP)
  431. IF IsNumber(ls_Value) Then
  432. li_Value = Long(ls_Value)
  433. IF inv_Requestor.OF_GetUnits()='1' Then
  434. li_Value = PixelsToUnits(Width, XPixelsToUnits!)
  435. ELSEIF inv_Requestor.OF_GetUnits()='2' Then
  436. li_Value = PixelsToUnits(lnv_Api.OF_InchToPixels(Width/1000 ) , XPixelsToUnits!)
  437. ELSEIF inv_Requestor.OF_GetUnits()='3' Then
  438. li_Value = PixelsToUnits(lnv_Api.OF_CMToPixels(Width /1000), XPixelsToUnits!)
  439. END IF
  440. IF li_Value<>X1 Then
  441. X1 = li_Value
  442. startcol =lnv_Layout.OF_GetEndColumn(inv_Requestor.OF_GetReport_X1() + X1)
  443. END IF
  444. END IF
  445. END IF
  446. IF Y_EXP<>'' Then
  447. ls_Value =inv_Requestor.OF_Evaluate(al_Row,Y_EXP)
  448. IF IsNumber(ls_Value) Then
  449. li_Value = Long(ls_Value)
  450. IF inv_Requestor.OF_GetUnits()='1' Then
  451. li_Value = PixelsToUnits(Width, YPixelsToUnits!)
  452. ELSEIF inv_Requestor.OF_GetUnits()='2' Then
  453. li_Value = PixelsToUnits(lnv_Api.OF_InchToPixels(Width/1000 ) , YPixelsToUnits!)
  454. ELSEIF inv_Requestor.OF_GetUnits()='3' Then
  455. li_Value = PixelsToUnits(lnv_Api.OF_CMToPixels(Width /1000), YPixelsToUnits!)
  456. END IF
  457. IF li_Value<>Y1 Then
  458. lb_RowInfoChange =TRUE
  459. Y1 = li_Value
  460. END IF
  461. END IF
  462. END IF
  463. IF Width_EXP<>'' Then
  464. ls_Value =inv_Requestor.OF_Evaluate(al_Row,Width_EXP)
  465. IF IsNumber(ls_Value) Then
  466. li_Value = Long(ls_Value)
  467. IF inv_Requestor.OF_GetUnits()='1' Then
  468. li_Value = PixelsToUnits(Width, XPixelsToUnits!)
  469. ELSEIF inv_Requestor.OF_GetUnits()='2' Then
  470. li_Value = PixelsToUnits(lnv_Api.OF_InchToPixels(Width/1000 ) , XPixelsToUnits!)
  471. ELSEIF inv_Requestor.OF_GetUnits()='3' Then
  472. li_Value = PixelsToUnits(lnv_Api.OF_CMToPixels(Width /1000), XPixelsToUnits!)
  473. END IF
  474. IF li_Value<>Width Then
  475. Width = li_Value
  476. X2=X1 + Width
  477. EndCol =lnv_Layout.OF_GetEndColumn(inv_Requestor.OF_GetReport_X1() + X2)
  478. END IF
  479. END IF
  480. END IF
  481. IF AutoHeight Then
  482. IF objType="column" OR objType="compute" Then
  483. ls_Value =""
  484. IF al_Row>0 Then
  485. ls_Value =inv_Requestor.OF_GetText(al_Row,Name,ColType, Format)
  486. END IF
  487. IF ls_Value="" Then
  488. TextHeight=0
  489. WrapText=False
  490. ELSE
  491. li_Width = lnv_Layout.OF_GetColumn_X2(EndCol) - lnv_Layout.OF_GetColumn_X1(StartCol)
  492. lnv_Api.OF_CalcTextRect(ls_Value, FontName, FontSize, FontBold, li_Width, Height, Alignment, AutoHeight, TextWidth, TextHeight ,SpaceCharWidth ,SpaceCharHeight, WrapText)
  493. IF colType="char" AND SpaceCharHeight>0 Then
  494. WrapText = Int((Height+20)/SpaceCharHeight)>1
  495. END IF
  496. END IF
  497. TextWidth =0
  498. IF TextHeight<>Height Then
  499. Height = TextHeight
  500. lb_RowInfoChange =TRUE
  501. END IF
  502. END IF
  503. ELSE
  504. IF Height_EXP<>'' Then
  505. ls_Value =inv_Requestor.OF_Evaluate(al_Row,Height_EXP)
  506. IF IsNumber(ls_Value) Then
  507. li_Value = Long(ls_Value)
  508. IF inv_Requestor.OF_GetUnits()='1' Then
  509. li_Value = PixelsToUnits(Width, YPixelsToUnits!)
  510. ELSEIF inv_Requestor.OF_GetUnits()='2' Then
  511. li_Value = PixelsToUnits(lnv_Api.OF_InchToPixels(Width/1000 ) , YPixelsToUnits!)
  512. ELSEIF inv_Requestor.OF_GetUnits()='3' Then
  513. li_Value = PixelsToUnits(lnv_Api.OF_CMToPixels(Width /1000), YPixelsToUnits!)
  514. END IF
  515. IF li_Value<>Height Then
  516. Height = li_Value
  517. lb_RowInfoChange =TRUE
  518. END IF
  519. END IF
  520. END IF
  521. END IF
  522. X2 = X1 + Width
  523. Y2 = Y1 + Height
  524. IF X1<>Original_X1 OR X2<>Original_X2 OR Y1<>Original_Y1 OR Y2<>Original_Y2 Then
  525. PositionChanged=TRUE
  526. lb_RowInfoChange=TRUE
  527. ELSE
  528. PositionChanged=False
  529. END IF
  530. IF visibleExp<>"" Then
  531. IF inv_Requestor.OF_Evaluate(al_Row,visibleExp)="0" Then
  532. Visible=False
  533. ELSE
  534. Visible=TRUE
  535. END IF
  536. END IF
  537. Return lb_RowInfoChange
  538. end function
  539. public subroutine of_addslideupobject (n_dw2xls_object anv_object);Int li_Index
  540. li_Index= UpperBound(inv_SlideupObject) +1
  541. inv_SlideupObject [li_Index ] = anv_Object
  542. end subroutine
  543. public function Long of_getlastrow ();Long li, li_Row,li_LastRow
  544. For li =1 TO UpperBound(inv_SlideupObject)
  545. li_Row = inv_SlideUpObject[li].OF_GetLastRow()
  546. IF li_Row>li_LastRow Then
  547. li_LastRow = li_Row
  548. END IF
  549. Next
  550. IF LastRow> li_LastRow Then
  551. li_LastRow = LastRow
  552. END IF
  553. Return li_LastRow
  554. end function
  555. public subroutine of_setposition (readonly long ai_x1, readonly long ai_y1, readonly long ai_x2, readonly long ai_y2, readonly string as_x_exp, readonly string as_y_exp, readonly string as_width_exp, readonly string as_height_exp);x1 = ai_x1
  556. y1 = ai_y1
  557. x2 = ai_x2
  558. y2 = ai_y2
  559. Original_X1 = ai_X1
  560. Original_Y1 = aI_Y1
  561. Original_X2 = ai_x2
  562. Original_Y2 = ai_Y2
  563. X_EXP = as_x_exp
  564. y_exp =as_y_exp
  565. width_exp = as_width_exp
  566. height_exp =as_height_exp
  567. IF x_exp<>'' OR y_exp<>'' or width_exp<>'' or height_exp<>'' then
  568. DynamicPosition =TRUE
  569. END IF
  570. PositionChanged=False
  571. end subroutine
  572. public function Long of_gettextrect_x1 ();IF objType="tempobj" OR objType="report" Then
  573. Return X1
  574. END IF
  575. IF ( inv_Requestor.OF_GetProcessing()='1' OR inv_Requestor.OF_GetProcessing()='4' ) AND IsForeGround=False Then
  576. Return X1
  577. END IF
  578. IF TextWidth>Width OR TextWidth=0 Then
  579. Return X1
  580. END IF
  581. IF alignment='1' Then //Right
  582. Return X2 - TextWidth
  583. ELSEIF alignment='2' Then
  584. Return X1+ Ceiling( (Width - TextWidth )/2 )
  585. ELSE
  586. Return X1
  587. END IF
  588. end function
  589. public function Long of_gettextrect_x2 ();IF objType="tempobj" OR objType="report" Then
  590. Return X2
  591. END IF
  592. IF ( inv_Requestor.OF_GetProcessing()='1' OR inv_Requestor.OF_GetProcessing()='4' ) AND IsForeGround=False Then
  593. Return X2
  594. END IF
  595. IF TextWidth>Width OR TextWidth=0 Then
  596. Return X2
  597. END IF
  598. IF Alignment='1' Then
  599. Return X2
  600. ELSEIF Alignment='2' Then
  601. Return X2 - Int( (Width - TextWidth )/2 )
  602. ELSE
  603. Return X1 + TextWidth
  604. END IF
  605. end function
  606. public function long of_gettextrect_y2 ();
  607. IF objType="tempobj" OR objType="report" Then
  608. Return Y2
  609. END IF
  610. IF inv_Band.OF_GetName()="detail" Then
  611. Return Y2
  612. END IF
  613. IF ( inv_Requestor.OF_GetProcessing()='1' OR inv_Requestor.OF_GetProcessing()='4' ) AND IsForeGround=False Then
  614. Return Y2
  615. END IF
  616. IF BorderStyle='2' OR BorderStyle='4' Then
  617. Return Y2
  618. END IF
  619. IF AutoHeight AND TextHeight>0 Then
  620. Return Y1 + TextHeight
  621. END IF
  622. IF TextHeight =0 OR ( Y1 + TextHeight)>Y2 Then
  623. Return Y2
  624. ELSE
  625. Return Y1 + TextHeight
  626. END IF
  627. end function
  628. public function Long of_getlastwritevaluerow ();IF IsValid(inv_PriorSparseObject) Then
  629. Return inv_PriorSparseObject.LastWriteValueRow
  630. ELSE
  631. Return 0
  632. END IF
  633. Return 0
  634. end function
  635. on n_dw2xls_object.create
  636. call super::create
  637. TriggerEvent( this, "constructor" )
  638. end on
  639. on n_dw2xls_object.destroy
  640. TriggerEvent( this, "destructor" )
  641. call super::destroy
  642. end on