thinreports 0.10.3 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +39 -0
- data/CHANGELOG.md +20 -0
- data/Dockerfile +12 -0
- data/Gemfile +5 -0
- data/README.md +37 -13
- data/Rakefile +1 -0
- data/lib/thinreports/core/shape/image_block.rb +1 -1
- data/lib/thinreports/core/shape/list.rb +1 -1
- data/lib/thinreports/core/shape/page_number.rb +1 -1
- data/lib/thinreports/core/shape/text.rb +1 -1
- data/lib/thinreports/core/shape/text_block.rb +1 -1
- data/lib/thinreports/core/shape/text_block/formatter/number.rb +6 -1
- data/lib/thinreports/core/shape/text_block/internal.rb +0 -2
- data/lib/thinreports/generator/pdf/prawn_ext/width_of.rb +6 -0
- data/lib/thinreports/layout/base.rb +1 -1
- data/lib/thinreports/layout/version.rb +1 -1
- data/lib/thinreports/report/internal.rb +2 -0
- data/lib/thinreports/version.rb +1 -1
- data/thinreports.gemspec +5 -9
- metadata +6 -204
- data/.travis.yml +0 -32
- data/test/data/font.ttf +0 -0
- data/test/data/image_normal.jpg +0 -0
- data/test/data/image_normal.png +0 -0
- data/test/data/image_normal_jpg_noext +0 -0
- data/test/data/image_normal_png_noext +0 -0
- data/test/data/image_pallete_based.png +0 -0
- data/test/data/legacy_layout/all-items.tlf +0 -1
- data/test/features/dynamic_style/expect.pdf +0 -3714
- data/test/features/dynamic_style/image.png +0 -0
- data/test/features/dynamic_style/templates/styles.tlf +0 -1835
- data/test/features/dynamic_style/templates/styles_in_list.tlf +0 -344
- data/test/features/dynamic_style/test_dynamic_style.rb +0 -152
- data/test/features/eudc/eudc.ttf +0 -0
- data/test/features/eudc/expect.pdf +0 -0
- data/test/features/eudc/template.tlf +0 -180
- data/test/features/eudc/test_eudc.rb +0 -27
- data/test/features/feature_test.rb +0 -58
- data/test/features/graphics/expect.pdf +0 -475
- data/test/features/graphics/template.tlf +0 -309
- data/test/features/graphics/test_graphics.rb +0 -12
- data/test/features/hidden_item/expect.pdf +0 -0
- data/test/features/hidden_item/template.tlf +0 -449
- data/test/features/hidden_item/test_hidden_item.rb +0 -12
- data/test/features/image_block/expect.pdf +0 -0
- data/test/features/image_block/img200x100.png +0 -0
- data/test/features/image_block/img50x50.png +0 -0
- data/test/features/image_block/template.tlf +0 -661
- data/test/features/image_block/test_image_block.rb +0 -35
- data/test/features/list_events/expect.pdf +0 -659
- data/test/features/list_events/template.tlf +0 -361
- data/test/features/list_events/test_list_events.rb +0 -36
- data/test/features/list_manually/expect.pdf +0 -599
- data/test/features/list_manually/template.tlf +0 -132
- data/test/features/list_manually/test_list_manually.rb +0 -25
- data/test/features/page_number/expect.pdf +0 -400
- data/test/features/page_number/template.tlf +0 -215
- data/test/features/page_number/test_page_number.rb +0 -24
- data/test/features/page_number_with_list/expect.pdf +0 -721
- data/test/features/page_number_with_list/template.tlf +0 -254
- data/test/features/page_number_with_list/test_page_number_with_list.rb +0 -21
- data/test/features/palleted_png/expect.pdf +0 -0
- data/test/features/palleted_png/palleted_png.png +0 -0
- data/test/features/palleted_png/template.tlf +0 -47
- data/test/features/palleted_png/test_palleted_png.rb +0 -14
- data/test/features/report_callbacks/expect.pdf +0 -169
- data/test/features/report_callbacks/template.tlf +0 -147
- data/test/features/report_callbacks/test_report_callbacks.rb +0 -18
- data/test/features/text_align/expect.pdf +0 -0
- data/test/features/text_align/template.tlf +0 -241
- data/test/features/text_align/test_text_align.rb +0 -12
- data/test/features/text_block_overflow/expect.pdf +0 -0
- data/test/features/text_block_overflow/template.tlf +0 -538
- data/test/features/text_block_overflow/test_text_block_overflow.rb +0 -25
- data/test/features/text_block_singleline/expect.pdf +0 -0
- data/test/features/text_block_singleline/template.tlf +0 -170
- data/test/features/text_block_singleline/test_text_block_singleline.rb +0 -15
- data/test/features/text_block_style/expect.pdf +0 -1391
- data/test/features/text_block_style/templates/basic_styles.tlf +0 -889
- data/test/features/text_block_style/templates/font_size.tlf +0 -383
- data/test/features/text_block_style/test_text_block_style.rb +0 -47
- data/test/features/text_character_spacing/expect.pdf +0 -0
- data/test/features/text_character_spacing/template.tlf +0 -293
- data/test/features/text_character_spacing/test_text_character_spacing.rb +0 -12
- data/test/features/text_word_wrap/expect.pdf +0 -0
- data/test/features/text_word_wrap/template.tlf +0 -297
- data/test/features/text_word_wrap/test_text_word_wrap.rb +0 -30
- data/test/schema_helper.rb +0 -122
- data/test/test_helper.rb +0 -39
- data/test/units/core/format/test_base.rb +0 -152
- data/test/units/core/shape/base/test_internal.rb +0 -87
- data/test/units/core/shape/basic/test_block_format.rb +0 -23
- data/test/units/core/shape/basic/test_block_interface.rb +0 -29
- data/test/units/core/shape/basic/test_block_internal.rb +0 -55
- data/test/units/core/shape/basic/test_format.rb +0 -37
- data/test/units/core/shape/basic/test_interface.rb +0 -108
- data/test/units/core/shape/basic/test_internal.rb +0 -55
- data/test/units/core/shape/image_block/test_interface.rb +0 -24
- data/test/units/core/shape/image_block/test_internal.rb +0 -31
- data/test/units/core/shape/list/test_format.rb +0 -111
- data/test/units/core/shape/list/test_manager.rb +0 -67
- data/test/units/core/shape/list/test_page.rb +0 -156
- data/test/units/core/shape/list/test_page_state.rb +0 -31
- data/test/units/core/shape/list/test_section_format.rb +0 -36
- data/test/units/core/shape/list/test_section_interface.rb +0 -75
- data/test/units/core/shape/list/test_section_internal.rb +0 -50
- data/test/units/core/shape/manager/test_format.rb +0 -38
- data/test/units/core/shape/manager/test_internal.rb +0 -132
- data/test/units/core/shape/manager/test_target.rb +0 -140
- data/test/units/core/shape/page_number/test_format.rb +0 -55
- data/test/units/core/shape/page_number/test_interface.rb +0 -33
- data/test/units/core/shape/page_number/test_internal.rb +0 -81
- data/test/units/core/shape/styles/test_base.rb +0 -191
- data/test/units/core/shape/styles/test_basic.rb +0 -24
- data/test/units/core/shape/styles/test_graphic.rb +0 -50
- data/test/units/core/shape/styles/test_text.rb +0 -97
- data/test/units/core/shape/text/test_format.rb +0 -44
- data/test/units/core/shape/text/test_internal.rb +0 -20
- data/test/units/core/shape/text_block/formatter/test_basic.rb +0 -24
- data/test/units/core/shape/text_block/formatter/test_datetime.rb +0 -49
- data/test/units/core/shape/text_block/formatter/test_number.rb +0 -76
- data/test/units/core/shape/text_block/formatter/test_padding.rb +0 -77
- data/test/units/core/shape/text_block/test_format.rb +0 -169
- data/test/units/core/shape/text_block/test_formatter.rb +0 -28
- data/test/units/core/shape/text_block/test_interface.rb +0 -63
- data/test/units/core/shape/text_block/test_internal.rb +0 -128
- data/test/units/core/test_shape.rb +0 -52
- data/test/units/core/test_utils.rb +0 -68
- data/test/units/generator/pdf/document/graphics/test_attributes.rb +0 -135
- data/test/units/generator/pdf/document/graphics/test_basic.rb +0 -46
- data/test/units/generator/pdf/document/graphics/test_image.rb +0 -46
- data/test/units/generator/pdf/document/graphics/test_text.rb +0 -171
- data/test/units/generator/pdf/document/test_font.rb +0 -110
- data/test/units/generator/pdf/document/test_graphics.rb +0 -42
- data/test/units/generator/pdf/document/test_page.rb +0 -122
- data/test/units/generator/pdf/document/test_parse_color.rb +0 -30
- data/test/units/generator/pdf/prawn_ext/test_calc_image_dimensions.rb +0 -41
- data/test/units/generator/pdf/prawn_ext/test_width_of.rb +0 -22
- data/test/units/generator/pdf/test_document.rb +0 -22
- data/test/units/generator/test_pdf.rb +0 -26
- data/test/units/layout/test_base.rb +0 -41
- data/test/units/layout/test_format.rb +0 -100
- data/test/units/layout/test_legacy_schema.rb +0 -576
- data/test/units/layout/test_version.rb +0 -26
- data/test/units/report/test_base.rb +0 -248
- data/test/units/report/test_internal.rb +0 -206
- data/test/units/test_config.rb +0 -36
- data/test/units/test_layout.rb +0 -12
- data/test/units/test_report.rb +0 -18
@@ -1,344 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": "0.9.0",
|
3
|
-
"items": [
|
4
|
-
{
|
5
|
-
"id": "list",
|
6
|
-
"type": "list",
|
7
|
-
"display": true,
|
8
|
-
"description": "",
|
9
|
-
"x": 20,
|
10
|
-
"y": 77,
|
11
|
-
"width": 555.2,
|
12
|
-
"height": 415.2,
|
13
|
-
"header": {
|
14
|
-
"enabled": true,
|
15
|
-
"height": 51,
|
16
|
-
"translate": {
|
17
|
-
"x": 0,
|
18
|
-
"y": 57
|
19
|
-
},
|
20
|
-
"items": [
|
21
|
-
{
|
22
|
-
"id": "rect",
|
23
|
-
"type": "rect",
|
24
|
-
"display": true,
|
25
|
-
"description": "",
|
26
|
-
"x": 110.1,
|
27
|
-
"y": 31,
|
28
|
-
"width": 77,
|
29
|
-
"height": 31,
|
30
|
-
"style": {
|
31
|
-
"border-color": "#000000",
|
32
|
-
"border-width": 1,
|
33
|
-
"border-style": "solid",
|
34
|
-
"fill-color": "#FFFFFF"
|
35
|
-
},
|
36
|
-
"border-radius": 0
|
37
|
-
},
|
38
|
-
{
|
39
|
-
"id": "text",
|
40
|
-
"type": "text",
|
41
|
-
"display": true,
|
42
|
-
"description": "",
|
43
|
-
"x": 223.1,
|
44
|
-
"y": 21,
|
45
|
-
"width": 147,
|
46
|
-
"height": 45.1,
|
47
|
-
"style": {
|
48
|
-
"font-family": [
|
49
|
-
"Helvetica"
|
50
|
-
],
|
51
|
-
"font-size": 18,
|
52
|
-
"color": "#000000",
|
53
|
-
"text-align": "left",
|
54
|
-
"vertical-align": "top",
|
55
|
-
"line-height": "",
|
56
|
-
"line-height-ratio": "",
|
57
|
-
"letter-spacing": "",
|
58
|
-
"font-style": []
|
59
|
-
},
|
60
|
-
"texts": [
|
61
|
-
"Header Text"
|
62
|
-
]
|
63
|
-
},
|
64
|
-
{
|
65
|
-
"id": "",
|
66
|
-
"type": "rect",
|
67
|
-
"display": true,
|
68
|
-
"description": "",
|
69
|
-
"x": 223.1,
|
70
|
-
"y": 21,
|
71
|
-
"width": 147,
|
72
|
-
"height": 45.1,
|
73
|
-
"style": {
|
74
|
-
"border-color": "#000000",
|
75
|
-
"border-width": 1,
|
76
|
-
"border-style": "solid",
|
77
|
-
"fill-color": "none"
|
78
|
-
},
|
79
|
-
"border-radius": 0
|
80
|
-
},
|
81
|
-
{
|
82
|
-
"id": "",
|
83
|
-
"type": "rect",
|
84
|
-
"display": true,
|
85
|
-
"description": "",
|
86
|
-
"x": 389.1,
|
87
|
-
"y": 23,
|
88
|
-
"width": 144.1,
|
89
|
-
"height": 42.1,
|
90
|
-
"style": {
|
91
|
-
"border-color": "#000000",
|
92
|
-
"border-width": 1,
|
93
|
-
"border-style": "solid",
|
94
|
-
"fill-color": "none"
|
95
|
-
},
|
96
|
-
"border-radius": 0
|
97
|
-
},
|
98
|
-
{
|
99
|
-
"id": "",
|
100
|
-
"type": "line",
|
101
|
-
"display": true,
|
102
|
-
"description": "",
|
103
|
-
"style": {
|
104
|
-
"border-color": "#000000",
|
105
|
-
"border-width": 1,
|
106
|
-
"border-style": "solid"
|
107
|
-
},
|
108
|
-
"x1": 20,
|
109
|
-
"y1": 71,
|
110
|
-
"x2": 575.2,
|
111
|
-
"y2": 71
|
112
|
-
},
|
113
|
-
{
|
114
|
-
"id": "tblock",
|
115
|
-
"type": "text-block",
|
116
|
-
"display": true,
|
117
|
-
"description": "",
|
118
|
-
"x": 389.1,
|
119
|
-
"y": 23,
|
120
|
-
"width": 144.1,
|
121
|
-
"height": 42.1,
|
122
|
-
"style": {
|
123
|
-
"font-family": [
|
124
|
-
"Helvetica"
|
125
|
-
],
|
126
|
-
"font-size": 18,
|
127
|
-
"color": "#000000",
|
128
|
-
"text-align": "left",
|
129
|
-
"vertical-align": "top",
|
130
|
-
"line-height": "",
|
131
|
-
"line-height-ratio": "",
|
132
|
-
"letter-spacing": "",
|
133
|
-
"font-style": [],
|
134
|
-
"overflow": "truncate",
|
135
|
-
"word-wrap": "break-word"
|
136
|
-
},
|
137
|
-
"reference-id": "",
|
138
|
-
"value": "Header Tblock",
|
139
|
-
"multiple-line": true,
|
140
|
-
"format": {
|
141
|
-
"base": "",
|
142
|
-
"type": ""
|
143
|
-
}
|
144
|
-
}
|
145
|
-
]
|
146
|
-
},
|
147
|
-
"detail": {
|
148
|
-
"height": 57,
|
149
|
-
"translate": {
|
150
|
-
"x": 0,
|
151
|
-
"y": 1.2
|
152
|
-
},
|
153
|
-
"items": [
|
154
|
-
{
|
155
|
-
"id": "rect",
|
156
|
-
"type": "rect",
|
157
|
-
"display": true,
|
158
|
-
"description": "",
|
159
|
-
"x": 111.1,
|
160
|
-
"y": 137.8,
|
161
|
-
"width": 77,
|
162
|
-
"height": 31,
|
163
|
-
"style": {
|
164
|
-
"border-color": "#000000",
|
165
|
-
"border-width": 1,
|
166
|
-
"border-style": "solid",
|
167
|
-
"fill-color": "#FFFFFF"
|
168
|
-
},
|
169
|
-
"border-radius": 0
|
170
|
-
},
|
171
|
-
{
|
172
|
-
"id": "text",
|
173
|
-
"type": "text",
|
174
|
-
"display": true,
|
175
|
-
"description": "",
|
176
|
-
"x": 223.1,
|
177
|
-
"y": 132.8,
|
178
|
-
"width": 147,
|
179
|
-
"height": 45.1,
|
180
|
-
"style": {
|
181
|
-
"font-family": [
|
182
|
-
"Helvetica"
|
183
|
-
],
|
184
|
-
"font-size": 18,
|
185
|
-
"color": "#000000",
|
186
|
-
"text-align": "left",
|
187
|
-
"vertical-align": "top",
|
188
|
-
"line-height": "",
|
189
|
-
"line-height-ratio": "",
|
190
|
-
"letter-spacing": "",
|
191
|
-
"font-style": []
|
192
|
-
},
|
193
|
-
"texts": [
|
194
|
-
"Detail Text"
|
195
|
-
]
|
196
|
-
},
|
197
|
-
{
|
198
|
-
"id": "",
|
199
|
-
"type": "rect",
|
200
|
-
"display": true,
|
201
|
-
"description": "",
|
202
|
-
"x": 223.1,
|
203
|
-
"y": 132.8,
|
204
|
-
"width": 147,
|
205
|
-
"height": 45.1,
|
206
|
-
"style": {
|
207
|
-
"border-color": "#000000",
|
208
|
-
"border-width": 1,
|
209
|
-
"border-style": "solid",
|
210
|
-
"fill-color": "none"
|
211
|
-
},
|
212
|
-
"border-radius": 0
|
213
|
-
},
|
214
|
-
{
|
215
|
-
"id": "tblock",
|
216
|
-
"type": "text-block",
|
217
|
-
"display": true,
|
218
|
-
"description": "",
|
219
|
-
"x": 389.1,
|
220
|
-
"y": 134.8,
|
221
|
-
"width": 144.1,
|
222
|
-
"height": 42.1,
|
223
|
-
"style": {
|
224
|
-
"font-family": [
|
225
|
-
"Helvetica"
|
226
|
-
],
|
227
|
-
"font-size": 18,
|
228
|
-
"color": "#000000",
|
229
|
-
"text-align": "left",
|
230
|
-
"vertical-align": "top",
|
231
|
-
"line-height": "",
|
232
|
-
"line-height-ratio": "",
|
233
|
-
"letter-spacing": "",
|
234
|
-
"font-style": [],
|
235
|
-
"overflow": "truncate",
|
236
|
-
"word-wrap": "break-word"
|
237
|
-
},
|
238
|
-
"reference-id": "",
|
239
|
-
"value": "Detail Tblock",
|
240
|
-
"multiple-line": true,
|
241
|
-
"format": {
|
242
|
-
"base": "",
|
243
|
-
"type": ""
|
244
|
-
}
|
245
|
-
},
|
246
|
-
{
|
247
|
-
"id": "",
|
248
|
-
"type": "rect",
|
249
|
-
"display": true,
|
250
|
-
"description": "",
|
251
|
-
"x": 389.1,
|
252
|
-
"y": 134.8,
|
253
|
-
"width": 144.1,
|
254
|
-
"height": 42.1,
|
255
|
-
"style": {
|
256
|
-
"border-color": "#000000",
|
257
|
-
"border-width": 1,
|
258
|
-
"border-style": "solid",
|
259
|
-
"fill-color": "none"
|
260
|
-
},
|
261
|
-
"border-radius": 0
|
262
|
-
},
|
263
|
-
{
|
264
|
-
"id": "",
|
265
|
-
"type": "line",
|
266
|
-
"display": true,
|
267
|
-
"description": "",
|
268
|
-
"style": {
|
269
|
-
"border-color": "#000000",
|
270
|
-
"border-width": 1,
|
271
|
-
"border-style": "solid"
|
272
|
-
},
|
273
|
-
"x1": 20,
|
274
|
-
"y1": 183.8,
|
275
|
-
"x2": 575.2,
|
276
|
-
"y2": 183.8
|
277
|
-
}
|
278
|
-
]
|
279
|
-
},
|
280
|
-
"page-footer": {
|
281
|
-
"enabled": false,
|
282
|
-
"height": 0,
|
283
|
-
"translate": {
|
284
|
-
"x": 0,
|
285
|
-
"y": -48.6
|
286
|
-
},
|
287
|
-
"items": []
|
288
|
-
},
|
289
|
-
"footer": {
|
290
|
-
"enabled": false,
|
291
|
-
"height": 0,
|
292
|
-
"translate": {
|
293
|
-
"x": 0,
|
294
|
-
"y": -128.7
|
295
|
-
},
|
296
|
-
"items": []
|
297
|
-
},
|
298
|
-
"content-height": 364.2,
|
299
|
-
"auto-page-break": true
|
300
|
-
},
|
301
|
-
{
|
302
|
-
"id": "",
|
303
|
-
"type": "text",
|
304
|
-
"display": true,
|
305
|
-
"description": "",
|
306
|
-
"x": 197.6,
|
307
|
-
"y": 36,
|
308
|
-
"width": 200,
|
309
|
-
"height": 20,
|
310
|
-
"style": {
|
311
|
-
"font-family": [
|
312
|
-
"Times New Roman"
|
313
|
-
],
|
314
|
-
"font-size": 18,
|
315
|
-
"color": "#000000",
|
316
|
-
"text-align": "center",
|
317
|
-
"vertical-align": "top",
|
318
|
-
"line-height": "",
|
319
|
-
"line-height-ratio": "",
|
320
|
-
"letter-spacing": "",
|
321
|
-
"font-style": [
|
322
|
-
"underline"
|
323
|
-
]
|
324
|
-
},
|
325
|
-
"texts": [
|
326
|
-
"Dynamic Style in List"
|
327
|
-
]
|
328
|
-
}
|
329
|
-
],
|
330
|
-
"state": {
|
331
|
-
"layout-guides": []
|
332
|
-
},
|
333
|
-
"title": "Dynamic Style in List",
|
334
|
-
"report": {
|
335
|
-
"paper-type": "A4",
|
336
|
-
"orientation": "portrait",
|
337
|
-
"margin": [
|
338
|
-
20,
|
339
|
-
20,
|
340
|
-
20,
|
341
|
-
20
|
342
|
-
]
|
343
|
-
}
|
344
|
-
}
|
@@ -1,152 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'feature_test'
|
4
|
-
|
5
|
-
class TestDynamicStyle < FeatureTest
|
6
|
-
feature :dynamic_style do
|
7
|
-
image = path_of('image.png')
|
8
|
-
setup_values = Proc.new do |page|
|
9
|
-
# The Basic Style
|
10
|
-
page.values(basic_show5: 'TextBlock',
|
11
|
-
basic_show6: image,
|
12
|
-
basic_hide5: 'TextBlock',
|
13
|
-
basic_hide6: image)
|
14
|
-
# The Text Style
|
15
|
-
page.values(text_b3: 'To bold',
|
16
|
-
text_b4: 'To normal',
|
17
|
-
text_i3: 'To italic',
|
18
|
-
text_i4: 'To normal',
|
19
|
-
text_u3: 'To underline',
|
20
|
-
text_u4: 'To none',
|
21
|
-
text_l3: 'To line-through',
|
22
|
-
text_l4: 'To none')
|
23
|
-
page.values(text_a2: 'To right align',
|
24
|
-
text_a3: "To right align\n右寄せ",
|
25
|
-
text_va2: "To bottom align\n下揃え",
|
26
|
-
text_color2: '赤色')
|
27
|
-
end
|
28
|
-
|
29
|
-
report = Thinreports::Report.new layout: template_path('templates/styles.tlf')
|
30
|
-
|
31
|
-
# Create raw-page.
|
32
|
-
report.start_new_page
|
33
|
-
report.page.item(:title).value('Original Page')
|
34
|
-
|
35
|
-
setup_values.call(report.page)
|
36
|
-
|
37
|
-
# Create styled-page.
|
38
|
-
report.start_new_page
|
39
|
-
|
40
|
-
setup_values.call(report.page)
|
41
|
-
report.page.item(:title).value('Styled Page')
|
42
|
-
|
43
|
-
# The Basic Style
|
44
|
-
6.times do |i|
|
45
|
-
report.page.item("basic_show#{i + 1}").style(:visible, true)
|
46
|
-
report.page.item("basic_hide#{i + 1}").style(:visible, false)
|
47
|
-
end
|
48
|
-
|
49
|
-
# The Graphic Style
|
50
|
-
report.page.item(:graphic_bcolor1).style(:border_color, '#ff0000')
|
51
|
-
report.page[:graphic_bcolor2].style(:border_color, 'red')
|
52
|
-
# nil or 'none'.
|
53
|
-
report.page.item(:graphic_bcolor4).style(:border_color, nil)
|
54
|
-
|
55
|
-
report.page.item(:graphic_bwidth1).style(:border_width, 5)
|
56
|
-
report.page.item(:graphic_bwidth2).style(:border_width, 5)
|
57
|
-
report.page.item(:graphic_bwidth3).style(:border_width, 5)
|
58
|
-
report.page.item(:graphic_bwidth4).style(:border_width, 2)
|
59
|
-
report.page.item(:graphic_bwidth5).style(:border_width, 0)
|
60
|
-
|
61
|
-
report.page.item(:graphic_fcolor1).style(:fill_color, '#ff0000')
|
62
|
-
# nil or 'none'
|
63
|
-
report.page.item(:graphic_fcolor3).style(:fill_color, 'none')
|
64
|
-
report.page.item(:graphic_fcolor4).style(:fill_color, 'ff0000')
|
65
|
-
|
66
|
-
# The Text Style
|
67
|
-
[1, 3].each do |i|
|
68
|
-
report.page["text_b#{i}"].style(:bold, true)
|
69
|
-
report.page.item("text_i#{i}").style(:italic, true)
|
70
|
-
report.page.item("text_u#{i}").style(:underline, true)
|
71
|
-
report.page.item("text_l#{i}").style(:linethrough, true)
|
72
|
-
end
|
73
|
-
[2, 4].each do |i|
|
74
|
-
report.page.item("text_b#{i}").style(:bold, false)
|
75
|
-
report.page.item("text_i#{i}").style(:italic, false)
|
76
|
-
report.page.item("text_u#{i}").style(:underline, false)
|
77
|
-
report.page.item("text_l#{i}").style(:linethrough, false)
|
78
|
-
end
|
79
|
-
|
80
|
-
3.times do |i|
|
81
|
-
report.page.item("text_a#{i + 1}").style(:align, :right)
|
82
|
-
end
|
83
|
-
2.times do |i|
|
84
|
-
report.page.item("text_va#{i + 1}").style(:valign, :bottom)
|
85
|
-
end
|
86
|
-
|
87
|
-
2.times do |i|
|
88
|
-
report.page["text_color#{i + 1}"].style(:color, 'ff0000')
|
89
|
-
end
|
90
|
-
|
91
|
-
report.start_new_page(layout: template_path('templates/styles_in_list.tlf'))
|
92
|
-
|
93
|
-
# Settings for Header.
|
94
|
-
report.page.list(:list).header do |header|
|
95
|
-
header.item(:rect).styles(border_color: nil,
|
96
|
-
fill_color: 'ff00ff')
|
97
|
-
header.item(:text).styles(align: :center,
|
98
|
-
valign: :middle,
|
99
|
-
bold: true)
|
100
|
-
header[:tblock].styles(align: :center,
|
101
|
-
valign: :middle,
|
102
|
-
color: 'red',
|
103
|
-
linethrough: true)
|
104
|
-
end
|
105
|
-
|
106
|
-
1.step(10, 1) do |i|
|
107
|
-
# Flag of overflowed list-page.
|
108
|
-
is_overflowed = report.page.list(:list).overflow?
|
109
|
-
|
110
|
-
# Add details.
|
111
|
-
report.page.list(:list).add_row do |row|
|
112
|
-
case
|
113
|
-
when i % 2 == 0
|
114
|
-
row.item(:rect).styles(border_color: 'ff0000',
|
115
|
-
border_width: 3,
|
116
|
-
fill_color: '0000ff')
|
117
|
-
row.item(:text).styles(color: 'red',
|
118
|
-
align: :left,
|
119
|
-
valign: :middle)
|
120
|
-
row.item(:tblock).styles(color: 'blue',
|
121
|
-
align: :left,
|
122
|
-
valign: :middle)
|
123
|
-
when i % 3 == 0
|
124
|
-
row.item(:rect).style(:visible, false)
|
125
|
-
row.item(:text).styles(color: '0000ff',
|
126
|
-
align: :right,
|
127
|
-
valign: :bottom)
|
128
|
-
row.item(:tblock).styles(color: 'ff0000',
|
129
|
-
align: :right,
|
130
|
-
valign: :bottom)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
# Change header styles when list-page was overflowed.
|
135
|
-
if is_overflowed
|
136
|
-
report.page.list(:list).header do |header|
|
137
|
-
header.item(:rect).styles(border_color: 'black',
|
138
|
-
fill_color: '#ffffff')
|
139
|
-
header.item(:text).styles(align: :left,
|
140
|
-
valign: :top,
|
141
|
-
bold: false)
|
142
|
-
header.item(:tblock).styles(align: :left,
|
143
|
-
valign: :top,
|
144
|
-
color: '#000000',
|
145
|
-
linethrough: false)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
assert_pdf report.generate
|
151
|
-
end
|
152
|
-
end
|