sp-excel-loader 0.3.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/LICENSE +661 -0
- data/README.md +8 -0
- data/lib/sp-excel-loader.rb +6 -0
- data/lib/sp/excel/loader.rb +61 -0
- data/lib/sp/excel/loader/jrxml/band.rb +80 -0
- data/lib/sp/excel/loader/jrxml/band_container.rb +229 -0
- data/lib/sp/excel/loader/jrxml/box.rb +75 -0
- data/lib/sp/excel/loader/jrxml/casper_checkbox.rb +97 -0
- data/lib/sp/excel/loader/jrxml/casper_combo.rb +86 -0
- data/lib/sp/excel/loader/jrxml/casper_date.rb +54 -0
- data/lib/sp/excel/loader/jrxml/casper_radio_button.rb +48 -0
- data/lib/sp/excel/loader/jrxml/casper_text_field.rb +157 -0
- data/lib/sp/excel/loader/jrxml/client_combo_text_field.rb +72 -0
- data/lib/sp/excel/loader/jrxml/excel_to_jrxml.rb +1183 -0
- data/lib/sp/excel/loader/jrxml/extensions.rb +330 -0
- data/lib/sp/excel/loader/jrxml/field.rb +65 -0
- data/lib/sp/excel/loader/jrxml/group.rb +71 -0
- data/lib/sp/excel/loader/jrxml/image.rb +63 -0
- data/lib/sp/excel/loader/jrxml/jasper.rb +228 -0
- data/lib/sp/excel/loader/jrxml/parameter.rb +73 -0
- data/lib/sp/excel/loader/jrxml/pen.rb +97 -0
- data/lib/sp/excel/loader/jrxml/property.rb +52 -0
- data/lib/sp/excel/loader/jrxml/property_expression.rb +52 -0
- data/lib/sp/excel/loader/jrxml/report_element.rb +92 -0
- data/lib/sp/excel/loader/jrxml/static_text.rb +59 -0
- data/lib/sp/excel/loader/jrxml/style.rb +99 -0
- data/lib/sp/excel/loader/jrxml/text_field.rb +83 -0
- data/lib/sp/excel/loader/jrxml/variable.rb +77 -0
- data/lib/sp/excel/loader/json_to_xlsx.rb +159 -0
- data/lib/sp/excel/loader/model_exporter.rb +249 -0
- data/lib/sp/excel/loader/payrollexporter.rb +168 -0
- data/lib/sp/excel/loader/rubyxl_table_patch.rb +91 -0
- data/lib/sp/excel/loader/version.rb +26 -0
- data/lib/sp/excel/loader/workbookloader.rb +480 -0
- data/spec/calc_spec.rb +87 -0
- data/spec/model.xls +0 -0
- metadata +151 -0
@@ -0,0 +1,330 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011-2016 Cloudware S.A. All rights reserved.
|
4
|
+
#
|
5
|
+
# This file is part of sp-excel-loader.
|
6
|
+
#
|
7
|
+
# sp-excel-loader is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# sp-excel-loader is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with sp-excel-loader. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
module Sp
|
22
|
+
module Excel
|
23
|
+
module Loader
|
24
|
+
module Jrxml
|
25
|
+
|
26
|
+
|
27
|
+
class Presentation
|
28
|
+
|
29
|
+
attr_accessor :format
|
30
|
+
|
31
|
+
def initialize (a_format)
|
32
|
+
@format = a_format
|
33
|
+
end
|
34
|
+
|
35
|
+
end # end class Presentation
|
36
|
+
|
37
|
+
class Extension
|
38
|
+
|
39
|
+
attr_accessor :properties
|
40
|
+
|
41
|
+
def initialize ()
|
42
|
+
@properties = nil
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
class Editable < Extension
|
48
|
+
|
49
|
+
attr_accessor :field_id
|
50
|
+
|
51
|
+
def initialize (a_field_id)
|
52
|
+
|
53
|
+
if a_field_id[0] != "$"
|
54
|
+
raise ArgumentError, "Invalid field id: '#{a_field_id}'!"
|
55
|
+
end
|
56
|
+
|
57
|
+
@field_id = a_field_id[3..a_field_id.length-2]
|
58
|
+
@properties = []
|
59
|
+
@properties << Property.new("epaper.casper.text.field.editable.field_name", @field_id)
|
60
|
+
@properties << Property.new("epaper.casper.text.field.editable", "true")
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
class ClientCombo < Editable
|
66
|
+
|
67
|
+
attr_accessor :id
|
68
|
+
|
69
|
+
def initialize (a_field_id, a_id, a_uri)
|
70
|
+
super(a_field_id)
|
71
|
+
@id = a_id
|
72
|
+
@properties << Property.new("epaper.casper.text.field.load.uri" , a_uri)
|
73
|
+
@properties << Property.new("epaper.casper.text.field.attach" , "drop-down_list")
|
74
|
+
@properties << Property.new("epaper.casper.text.field.attach.drop-down_list.controller" , "client")
|
75
|
+
@properties << Property.new("epaper.casper.text.field.attach.drop-down_list.controller.display" , "[id,name]")
|
76
|
+
@properties << Property.new("epaper.casper.text.field.attach.drop-down_list.field.id" , "id")
|
77
|
+
@properties << Property.new("epaper.casper.text.field.attach.drop-down_list.field.name" , "name")
|
78
|
+
@properties << Property.new("epaper.casper.text.field.attach.drop-down_list.controller.pick.first_if_empty", "false")
|
79
|
+
# @properties << Property.new("epaper.casper.text.field.patch.name" , "journal_id")
|
80
|
+
# @properties << Property.new("epaper.casper.text.field.patch.type", , "java.lang.String")
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
class Checkbox < Editable
|
87
|
+
|
88
|
+
def initialize (a_field_id, a_type = nil, a_unchecked = nil, a_checked = nil)
|
89
|
+
super(a_field_id)
|
90
|
+
if nil == a_type || nil == a_unchecked || nil == a_checked
|
91
|
+
@properties = [
|
92
|
+
Property.new("epaper.casper.text.field.editable" , "false" ),
|
93
|
+
Property.new("epaper.casper.text.field.editable.field_name" , @field_id )
|
94
|
+
]
|
95
|
+
else
|
96
|
+
@properties << Property.new("epaper.casper.text.field.attach" , "checkbox" )
|
97
|
+
@properties << Property.new("epaper.casper.text.field.attach.checkbox.value.type", a_type )
|
98
|
+
@properties << Property.new("epaper.casper.text.field.attach.checkbox.value.off" , a_unchecked )
|
99
|
+
@properties << Property.new("epaper.casper.text.field.attach.checkbox.value.on" , a_checked )
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
class RadioButton < Editable
|
106
|
+
|
107
|
+
def initialize (a_field_id, a_type = nil, a_unchecked = nil, a_checked = nil)
|
108
|
+
super(a_field_id)
|
109
|
+
if nil == a_type || nil == a_unchecked || nil == a_checked
|
110
|
+
@properties = [
|
111
|
+
Property.new("epaper.casper.text.field.editable" , "false" ),
|
112
|
+
Property.new("epaper.casper.text.field.editable.field_name" , @field_id )
|
113
|
+
]
|
114
|
+
else
|
115
|
+
@properties << Property.new("epaper.casper.text.field.attach" , "radio_button" )
|
116
|
+
@properties << Property.new("epaper.casper.text.field.attach.radio_button.value.type", a_type )
|
117
|
+
@properties << Property.new("epaper.casper.text.field.attach.radio_button.value.off" , a_unchecked )
|
118
|
+
@properties << Property.new("epaper.casper.text.field.attach.radio_button.value.on" , a_checked )
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
class ReportExtension < Extension
|
125
|
+
|
126
|
+
attr_accessor :styles
|
127
|
+
|
128
|
+
def initialize (a_report_name)
|
129
|
+
super()
|
130
|
+
@properties = [
|
131
|
+
Property.new("epaper.casper.text.field.editable.style" , "EditableTextField"),
|
132
|
+
Property.new("epaper.casper.text.field.editable.style.focused" , "EditableFocusedTextField"),
|
133
|
+
Property.new("epaper.casper.text.field.editable.style.disabled" , "EditableDisabledTextField"),
|
134
|
+
Property.new("epaper.casper.text.field.editable.style.focused.invalid", "EditableFocusedInvalidContentTextField"),
|
135
|
+
Property.new("epaper.casper.text.field.editable.style.invalid" , "EditableTextFieldInvalidContent")
|
136
|
+
]
|
137
|
+
|
138
|
+
@styles = []
|
139
|
+
default = Style.new("EditableTextField")
|
140
|
+
default.mode ="Opaque"
|
141
|
+
default.forecolor ="#000000"
|
142
|
+
default.backcolor ="#D2EAF0"
|
143
|
+
@styles << default
|
144
|
+
|
145
|
+
invalid = Style.new("EditableTextFieldInvalidContent")
|
146
|
+
invalid.style ="EditableTextField"
|
147
|
+
invalid.box = bottom_box("#E44A2C")
|
148
|
+
@styles << invalid
|
149
|
+
|
150
|
+
focused = Style.new("EditableFocusedTextField")
|
151
|
+
focused.mode = "Opaque"
|
152
|
+
focused.forecolor = "#808080"
|
153
|
+
focused.backcolor = "#F7F2E1"
|
154
|
+
@styles << focused
|
155
|
+
|
156
|
+
focused_invalid = Style.new("EditableFocusedInvalidContentTextField")
|
157
|
+
focused_invalid.style = "EditableFocusedTextField"
|
158
|
+
focused_invalid.box = bottom_box("#E44A2C")
|
159
|
+
@styles << focused_invalid
|
160
|
+
|
161
|
+
disabled = Style.new("EditableDisabledTextField")
|
162
|
+
disabled.mode = "Opaque"
|
163
|
+
disabled.forecolor = "#C7C7C7"
|
164
|
+
disabled.backcolor = "#F2F2F2"
|
165
|
+
disabled.box = bottom_box("#000000", 1, "Dashed")
|
166
|
+
@styles << disabled
|
167
|
+
|
168
|
+
end
|
169
|
+
|
170
|
+
def default_box (a_line_color, a_line_width=1, a_line_style="Solid")
|
171
|
+
box = Box.new
|
172
|
+
box.left_pen = LeftPen.new
|
173
|
+
box.top_pen = TopPen.new
|
174
|
+
box.right_pen = RightPen.new
|
175
|
+
box.bottom_pen = BottomPen.new
|
176
|
+
pens = [ box.left_pen, box.top_pen, box.right_pen, box.bottom_pen ]
|
177
|
+
pens.each do |pen|
|
178
|
+
pen.line_width = a_line_width
|
179
|
+
pen.line_style = a_line_style
|
180
|
+
pen.line_color = a_line_color
|
181
|
+
end
|
182
|
+
box
|
183
|
+
end
|
184
|
+
|
185
|
+
def bottom_box (a_line_color, a_line_width=1, a_line_style="Solid")
|
186
|
+
box = Box.new
|
187
|
+
box.bottom_pen = BottomPen.new
|
188
|
+
box.bottom_pen.line_width = a_line_width
|
189
|
+
box.bottom_pen.line_style = a_line_style
|
190
|
+
box.bottom_pen.line_color = a_line_color
|
191
|
+
box
|
192
|
+
end
|
193
|
+
|
194
|
+
def new_pen (a_line_width, a_line_style, a_line_color)
|
195
|
+
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
class WidgetFactory
|
201
|
+
|
202
|
+
attr_accessor :basic_expressions
|
203
|
+
attr_accessor :cb_editable
|
204
|
+
attr_accessor :rb_editable
|
205
|
+
|
206
|
+
def initialize (a_map)
|
207
|
+
@fields_map = a_map
|
208
|
+
@basic_expressions = false
|
209
|
+
@cb_editable = false
|
210
|
+
@rb_editable = false
|
211
|
+
end
|
212
|
+
|
213
|
+
def new_for_field (a_id, a_generator)
|
214
|
+
|
215
|
+
binding = @fields_map[a_id]
|
216
|
+
|
217
|
+
if a_id.match(/^\$P{/) || a_id.match(/^\$F{/)
|
218
|
+
editable = @fields_map.has_key?(a_id) && binding.editable ? Editable.new(a_id) : nil
|
219
|
+
else
|
220
|
+
editable = nil
|
221
|
+
end
|
222
|
+
|
223
|
+
if binding != nil and binding.respond_to?(:widget) and (binding.widget == 'Client Combo' || binding.widget == 'Combo')
|
224
|
+
|
225
|
+
widget = ClientComboTextField.new(binding, a_generator)
|
226
|
+
|
227
|
+
else
|
228
|
+
|
229
|
+
if binding != nil and not binding.presentation.nil? and binding.presentation.format != ''
|
230
|
+
pattern = binding.presentation.format
|
231
|
+
else
|
232
|
+
pattern = nil
|
233
|
+
end
|
234
|
+
|
235
|
+
if editable.nil?
|
236
|
+
widget = TextField.new(a_properties = nil, a_pattern = pattern, a_pattern_expression = nil)
|
237
|
+
else
|
238
|
+
widget = TextField.new(a_properties = editable.properties, a_pattern = pattern, a_pattern_expression = nil)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
if binding != nil and binding.respond_to?(:tooltip) and binding.tooltip != nil and not binding.tooltip.strip.empty?
|
243
|
+
widget.report_element.properties ||= Array.new
|
244
|
+
widget.report_element.properties << PropertyExpression.new('epaper.casper.text.field.hint.expression', binding.tooltip)
|
245
|
+
a_generator.declare_expression_entities(@fields_map[a_id].tooltip)
|
246
|
+
end
|
247
|
+
widget
|
248
|
+
end
|
249
|
+
|
250
|
+
def new_combo(a_config)
|
251
|
+
config = a_config.strip[3..-2].strip.split(',')
|
252
|
+
config[0].strip!
|
253
|
+
config[1].strip!
|
254
|
+
editable = ClientCombo.new(a_field_id=config[1], a_id=config[0], a_uri="model://#{config[0]}")
|
255
|
+
widget = TextField.new(a_properties = editable.properties, a_pattern = nil, a_pattern_expression = nil)
|
256
|
+
{ id: editable.id, widget: widget, field:config[1], display_field: config.size > 2 ? config[2] : nil }
|
257
|
+
end
|
258
|
+
|
259
|
+
def new_checkbox(a_config)
|
260
|
+
# check box: $CB{<field_name>,<unchecked>,<checked>}
|
261
|
+
cb = a_config[4..-2].split(',')
|
262
|
+
cb[0].strip!
|
263
|
+
is_editable = @cb_editable && @fields_map.has_key?(cb[0]) && @fields_map[cb[0]].editable
|
264
|
+
if is_editable
|
265
|
+
unchecked = cb[1].strip
|
266
|
+
checked = cb[2].strip
|
267
|
+
if unchecked.start_with?('"') or checked.start_with?('"')
|
268
|
+
unchecked = unchecked.gsub(/\A"/, '').gsub!(/"\z/, '')
|
269
|
+
checked = checked.gsub(/\A"/, '').gsub!(/"\z/, '')
|
270
|
+
end
|
271
|
+
editable = Checkbox.new(a_field_id=cb[0], a_type=@fields_map[cb[0]].java_class, a_unchecked=unchecked, a_checked=checked)
|
272
|
+
else
|
273
|
+
editable = Checkbox.new(a_field_id=cb[0])
|
274
|
+
end
|
275
|
+
widget = TextField.new(a_properties = editable.properties, a_pattern = nil, a_pattern_expression = nil)
|
276
|
+
if @basic_expressions
|
277
|
+
widget.text_field_expression = "IF(#{cb[0]}==#{cb[2]};\"X\";\"\")"
|
278
|
+
else
|
279
|
+
widget.text_field_expression = "#{cb[0]} == #{cb[2]} ? \"X\" : \"\""
|
280
|
+
end
|
281
|
+
{ widget: widget, field: cb[0] }
|
282
|
+
end
|
283
|
+
|
284
|
+
def new_radio_button(a_config)
|
285
|
+
# check box: $RB{<field_name>,<unchecked>,<checked>}
|
286
|
+
rb = a_config[4..-2].split(',')
|
287
|
+
rb[0].strip!
|
288
|
+
is_editable = @rb_editable && @fields_map.has_key?(rb[0]) && @fields_map[rb[0]].editable
|
289
|
+
if is_editable
|
290
|
+
unchecked = rb[1].strip
|
291
|
+
checked = rb[2].strip
|
292
|
+
if unchecked.start_with?('"') or checked.start_with?('"')
|
293
|
+
unchecked = unchecked.gsub(/\A"/, '').gsub!(/"\z/, '')
|
294
|
+
checked = checked.gsub(/\A"/, '').gsub!(/"\z/, '')
|
295
|
+
end
|
296
|
+
editable = RadioButton.new(a_field_id=rb[0], a_type=@fields_map[rb[0]].java_class, a_unchecked=unchecked, a_checked=checked)
|
297
|
+
else
|
298
|
+
editable = RadioButton.new(a_field_id=rb[0])
|
299
|
+
end
|
300
|
+
widget = TextField.new(a_properties = editable.properties, a_pattern = nil, a_pattern_expression = nil)
|
301
|
+
if @basic_expressions
|
302
|
+
widget.text_field_expression = "IF(#{rb[0]}==#{rb[2]};\"X\";\"\")"
|
303
|
+
else
|
304
|
+
widget.text_field_expression = "#{rb[0]} == #{rb[2]} ? \"X\" : \"\""
|
305
|
+
end
|
306
|
+
{ widget: widget, field: rb[0] }
|
307
|
+
end
|
308
|
+
|
309
|
+
def java_class (a_id)
|
310
|
+
if @fields_map.has_key?(a_id)
|
311
|
+
@fields_map[a_id].java_class
|
312
|
+
elsif '$V{PAGE_NUMBER}' == a_id || '$V{CONTINUOUS_PAGE_NUMBER}' == a_id
|
313
|
+
return 'java.lang.Integer'
|
314
|
+
elsif '$V{RENDERER_ID}' == a_id
|
315
|
+
return 'java.lang.String'
|
316
|
+
else
|
317
|
+
if @basic_expression
|
318
|
+
raise ArgumentError, "Don't know how to set '#{a_id}' java class!"
|
319
|
+
else
|
320
|
+
return 'java.lang.String'
|
321
|
+
end
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
end
|
326
|
+
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|
330
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011-2016 Cloudware S.A. All rights reserved.
|
4
|
+
#
|
5
|
+
# This file is part of sp-excel-loader.
|
6
|
+
#
|
7
|
+
# sp-excel-loader is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# sp-excel-loader is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with sp-excel-loader. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
module Sp
|
22
|
+
module Excel
|
23
|
+
module Loader
|
24
|
+
module Jrxml
|
25
|
+
|
26
|
+
class Field
|
27
|
+
|
28
|
+
attr_accessor :name
|
29
|
+
attr_accessor :java_class
|
30
|
+
attr_accessor :description
|
31
|
+
attr_accessor :default_value_expression
|
32
|
+
attr_accessor :is_for_prompting
|
33
|
+
|
34
|
+
def initialize (a_name, a_java_class = nil)
|
35
|
+
@name = a_name
|
36
|
+
@java_class = a_java_class
|
37
|
+
@java_class ||= 'java.lang.String'
|
38
|
+
@description = nil
|
39
|
+
end
|
40
|
+
|
41
|
+
def attributes
|
42
|
+
rv = Hash.new
|
43
|
+
rv['name'] = @name
|
44
|
+
rv['class'] = @java_class
|
45
|
+
return rv
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_xml (a_node)
|
49
|
+
Nokogiri::XML::Builder.with(a_node) do |xml|
|
50
|
+
xml.field(attributes) {
|
51
|
+
unless @description.nil?
|
52
|
+
xml.fieldDescription {
|
53
|
+
xml.cdata @description
|
54
|
+
}
|
55
|
+
end
|
56
|
+
}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2011-2016 Cloudware S.A. All rights reserved.
|
4
|
+
#
|
5
|
+
# This file is part of sp-excel-loader.
|
6
|
+
#
|
7
|
+
# sp-excel-loader is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Affero General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# sp-excel-loader is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Affero General Public License
|
18
|
+
# along with sp-excel-loader. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
20
|
+
|
21
|
+
module Sp
|
22
|
+
module Excel
|
23
|
+
module Loader
|
24
|
+
module Jrxml
|
25
|
+
|
26
|
+
class Group
|
27
|
+
|
28
|
+
attr_accessor :name
|
29
|
+
attr_accessor :group_expression
|
30
|
+
attr_accessor :group_header
|
31
|
+
attr_accessor :group_footer
|
32
|
+
attr_accessor :is_start_new_page
|
33
|
+
attr_accessor :is_reprint_header_on_each_page
|
34
|
+
|
35
|
+
def initialize (a_name = nil)
|
36
|
+
@name = a_name || 'Group1'
|
37
|
+
@group_expression = '$F{data_row_type}'
|
38
|
+
@is_start_new_page = nil
|
39
|
+
@is_reprint_header_on_each_page = nil
|
40
|
+
@group_header = GroupHeader.new
|
41
|
+
@group_footer = GroupFooter.new
|
42
|
+
end
|
43
|
+
|
44
|
+
def attributes
|
45
|
+
rv = Hash.new
|
46
|
+
rv['name'] = @name
|
47
|
+
rv['isStartNewPage'] = @is_start_new_page unless @is_start_new_page .nil?
|
48
|
+
rv['isReprintHeaderOnEachPage'] = @is_reprint_header_on_each_page unless @is_reprint_header_on_each_page.nil?
|
49
|
+
return rv
|
50
|
+
end
|
51
|
+
|
52
|
+
def to_xml (a_node)
|
53
|
+
Nokogiri::XML::Builder.with(a_node) do |xml|
|
54
|
+
xml.group(attributes) {
|
55
|
+
unless group_expression.nil?
|
56
|
+
xml.groupExpression {
|
57
|
+
xml.cdata @group_expression
|
58
|
+
}
|
59
|
+
end
|
60
|
+
}
|
61
|
+
end
|
62
|
+
@group_header.to_xml(a_node.children.last)
|
63
|
+
@group_footer.to_xml(a_node.children.last)
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|