n_xls_formats.sru 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. $PBExportHeader$n_xls_formats.sru
  2. forward
  3. global type n_xls_formats from nonvisualobject
  4. end type
  5. end forward
  6. global type n_xls_formats from nonvisualobject
  7. end type
  8. global n_xls_formats n_xls_formats
  9. type variables
  10. String is_Keys[]
  11. String is_Font_Keys[]
  12. String is_Num_Format[]
  13. Blob iblob_Font[]
  14. Blob iblob_xfs[]
  15. Datastore ids_System_Foramts
  16. Int ii_System_Format_cnt
  17. end variables
  18. forward prototypes
  19. public function long of_format_exist (readonly string as_key)
  20. public function integer of_font_exist (readonly string as_key)
  21. public function long of_add (ref n_xls_format anvo_format)
  22. public function integer of_num_format_exist (readonly string as_format)
  23. end prototypes
  24. public function long of_format_exist (readonly string as_key);Long li,li_Count
  25. li_Count=UpperBound(is_Keys)
  26. For li=1 To li_Count
  27. IF is_Keys[li]=as_Key Then
  28. Return li
  29. END IF
  30. Next
  31. Return -1
  32. end function
  33. public function integer of_font_exist (readonly string as_key);Long li,li_Count
  34. li_Count=UpperBound(is_Font_Keys)
  35. For li=1 To li_Count
  36. IF is_Font_Keys[li]=as_Key Then
  37. Return li
  38. END IF
  39. Next
  40. Return -1
  41. end function
  42. public function long of_add (ref n_xls_format anvo_format);Long li_Index
  43. Long li_KeyIndex
  44. String ls_Key
  45. Blob lb_data
  46. boolean lb_flag
  47. IF IsNull(anvo_format) OR Not IsValid(anvo_Format) Then
  48. Return li_Index
  49. END IF
  50. ls_Key=anvo_Format.OF_Get_Format_Key()
  51. li_KeyIndex=OF_Format_Exist(ls_Key)
  52. IF li_KeyIndex>0 Then
  53. Return li_KeyIndex
  54. END IF
  55. li_KeyIndex=UpperBound(is_Keys)+1
  56. is_Keys[li_KeyIndex]=ls_Key
  57. ////字体
  58. ls_Key=anvo_Format.OF_Get_Font_Key()
  59. li_Index=OF_Font_Exist(ls_Key)
  60. IF li_Index<=0 Then
  61. li_Index= UpperBound(is_Font_Keys)+1
  62. is_Font_Keys[li_Index]=ls_Key
  63. lb_data= anvo_Format.of_get_font()
  64. iblob_font[li_Index]=lb_data
  65. END IF
  66. anvo_Format.ii_font_index= li_Index +5
  67. //数据格式
  68. IF anvo_Format.is_Num_Format<>"" AND Lower(anvo_Format.is_Num_Format)<>"general" and anvo_Format.ii_Num_Format = 0 Then
  69. li_Index=ids_System_Foramts.Find("Key='"+anvo_Format.is_Num_Format+"'",1,ii_System_Format_cnt)
  70. IF li_Index>0 Then
  71. anvo_Format.ii_num_format = ids_System_Foramts.Object.Index[li_Index] - 1
  72. ELSE
  73. li_Index=OF_num_Format_Exist(anvo_Format.is_Num_Format)
  74. IF li_Index<=0 Then
  75. li_Index=UpperBound(is_Num_Format)+1
  76. is_Num_Format[li_Index]=anvo_Format.is_Num_Format
  77. END IF
  78. anvo_Format.ii_num_format = li_Index +164 - 1
  79. END IF
  80. END IF
  81. //单元格式
  82. lb_data= anvo_Format.of_get_xf("cell")
  83. iblob_xfs[li_KeyIndex]=lb_data
  84. Return li_KeyIndex
  85. end function
  86. public function integer of_num_format_exist (readonly string as_format);Long li,li_Count
  87. li_Count=UpperBound(is_Num_Format)
  88. For li=1 To li_Count
  89. IF is_Num_Format[li]=as_format Then
  90. Return li
  91. END IF
  92. Next
  93. Return -1
  94. end function
  95. on n_xls_formats.create
  96. call super::create
  97. TriggerEvent( this, "constructor" )
  98. end on
  99. on n_xls_formats.destroy
  100. TriggerEvent( this, "destructor" )
  101. call super::destroy
  102. end on
  103. event constructor;ids_System_Foramts=Create Datastore
  104. ids_System_Foramts.DataObject="d_dw2xls_systemFormat"
  105. ii_System_Format_cnt= ids_System_Foramts.RowCount()
  106. end event
  107. event destructor;Destroy ids_System_Foramts
  108. end event