aio_elin 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aio/base/toolkit/excel_wps.rb +434 -435
- data/lib/modules/cmd/cisco/show_env.rb +0 -2
- data/lib/modules/cmd/h3c/display_memory.rb +0 -1
- data/lib/modules/output/style/compare_diff.rb +0 -1
- data/lib/modules/special/style/compare_old.rb +0 -1
- data/lib/modules/special/style/compare_with_device_manager.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8fbf9239592da86bb45f4e1bb27c1c02eb78e022d7b2c48ec12a4fa0d7b0b5b
|
4
|
+
data.tar.gz: e1392795fbbceb6e78a0377fd351580d5060368f03ef28ddec92c3240144087a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f5ef05ea08e1708a9c60ee76c844203c4c2df56fb2df4632bf1eac70d06e925a534000e249075c9091305d2131b065219f14a7c3cd090ba7d169a680626b5cb
|
7
|
+
data.tar.gz: dacc8f95e9cf190a18cd1eebbb2e8b686d6ece7e5c21fa44e2ddc45d249c30077c1e004f0e6b8500938612d431feeb666f17a1e01a8c7355361bd42ec7a128dc
|
@@ -1,438 +1,437 @@
|
|
1
1
|
module Aio::Base::Toolkit
|
2
|
-
module ExcelWps
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
end
|
2
|
+
module ExcelWps
|
3
|
+
class WorkBook
|
4
|
+
|
5
|
+
include Aio::Ui::Verbose
|
6
|
+
|
7
|
+
@@worksheets_name = []
|
8
|
+
def initialize(encoding = "utf-8")
|
9
|
+
|
10
|
+
if Aio::Base::Toolkit::OS.windows?
|
11
|
+
require "win32ole"
|
12
|
+
else
|
13
|
+
print_error "只有Windows系统才能使用Excel模块"
|
14
|
+
exit 0
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
@excel = WIN32OLE.new("excel.Application")
|
19
|
+
@excel.visible = false
|
20
|
+
@workbook = @excel.workbooks.add
|
21
|
+
@encoding = encoding
|
22
|
+
create_style
|
23
|
+
end
|
24
|
+
|
25
|
+
# 警告提示开关
|
26
|
+
def display_alerts=(bool)
|
27
|
+
@excel.DisplayAlerts = bool
|
28
|
+
end
|
29
|
+
|
30
|
+
def add_worksheet(name)
|
31
|
+
while @@worksheets_name.include?(name)
|
32
|
+
name += "1"
|
33
|
+
end
|
34
|
+
@@worksheets_name << name
|
35
|
+
worksheet = @workbook.worksheets.add
|
36
|
+
worksheet.activate
|
37
|
+
|
38
|
+
# 在同一进程中多次打开会出现name的问题, 所以干脆全部使用sheet
|
39
|
+
# worksheet.name = name
|
40
|
+
worksheet.name = "sheet"
|
41
|
+
return WorkSheet.new(worksheet)
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_style
|
45
|
+
sty = @workbook.styles.add("NormalStyle")
|
46
|
+
self.class.normal_style(sty)
|
47
|
+
|
48
|
+
sty = @workbook.styles.add("BoldStyle")
|
49
|
+
self.class.bold_style(sty)
|
50
|
+
|
51
|
+
sty = @workbook.styles.add("TitleStyle")
|
52
|
+
self.class.title_style(sty)
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.normal_style(sty)
|
56
|
+
sty.font.size = 9
|
57
|
+
sty.borders(7).linestyle = 1
|
58
|
+
sty.borders(8).linestyle = 1
|
59
|
+
sty.borders(9).linestyle = 1
|
60
|
+
sty.borders(10).linestyle = 1
|
61
|
+
sty.HorizontalAlignment = -4108
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.bold_style(sty)
|
65
|
+
sty.font.size = 9
|
66
|
+
sty.font.bold = true
|
67
|
+
sty.borders(7).linestyle = 1
|
68
|
+
sty.borders(8).linestyle = 1
|
69
|
+
sty.borders(9).linestyle = 1
|
70
|
+
sty.borders(10).linestyle = 1
|
71
|
+
sty.HorizontalAlignment = -4108
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.title_style(sty)
|
75
|
+
sty.font.size = 20
|
76
|
+
sty.font.bold = true
|
77
|
+
sty.borders(7).linestyle = 1
|
78
|
+
sty.borders(8).linestyle = 1
|
79
|
+
sty.borders(9).linestyle = 1
|
80
|
+
sty.borders(10).linestyle = 1
|
81
|
+
sty.HorizontalAlignment = -4108
|
82
|
+
end
|
83
|
+
|
84
|
+
def show
|
85
|
+
@excel.visible = true
|
86
|
+
end
|
87
|
+
|
88
|
+
def save(path)
|
89
|
+
@workbook.saveas(path)
|
90
|
+
end
|
91
|
+
|
92
|
+
def close
|
93
|
+
@workbook.close
|
94
|
+
@excel.quit
|
95
|
+
end
|
96
|
+
end # class WorkBook
|
97
|
+
|
98
|
+
class WorkSheet
|
99
|
+
IMAGE_ROW_NUM = 56
|
100
|
+
@@worksheets_name = []
|
101
|
+
def initialize(worksheet)
|
102
|
+
@row_count = 1
|
103
|
+
@worksheet = worksheet
|
104
|
+
@nil_space = []
|
105
|
+
end
|
106
|
+
|
107
|
+
# 增加一个空行
|
108
|
+
def add_space_line(n=1)
|
109
|
+
return if n < 1
|
110
|
+
@row_count += n
|
111
|
+
end
|
112
|
+
|
113
|
+
# 对列进行合并
|
114
|
+
def merge(range1, range2)
|
115
|
+
@worksheet.range("#{range1}:#{range2}").merge
|
116
|
+
end
|
117
|
+
|
118
|
+
# 产生 ::Range 类
|
119
|
+
def range(str)
|
120
|
+
@worksheet.range(str)
|
121
|
+
end
|
122
|
+
|
123
|
+
# 添加标题行
|
124
|
+
def add_title(name)
|
125
|
+
add_row.add_cell(name, false, "BoldStyle")
|
126
|
+
end
|
127
|
+
|
128
|
+
# 设置列的宽度
|
129
|
+
def width(col, width)
|
130
|
+
@worksheet.Columns("#{col}:#{col}").ColumnWidth = width
|
131
|
+
end
|
132
|
+
|
133
|
+
def height(height)
|
134
|
+
@row_height = height
|
135
|
+
end
|
136
|
+
|
137
|
+
# 增加Row类
|
138
|
+
def add_row(&block)
|
139
|
+
@current_row = Row.new(@worksheet, @row_count)
|
140
|
+
@current_row.height = @row_height if @row_height
|
141
|
+
@row_count += 1
|
142
|
+
yield @current_row if block
|
143
|
+
return @current_row
|
144
|
+
end
|
145
|
+
|
146
|
+
# 返回此时的Row类
|
147
|
+
def current_row
|
148
|
+
return @current_row
|
149
|
+
end
|
150
|
+
|
151
|
+
# 返回此时的行索引
|
152
|
+
def current_row_id
|
153
|
+
return @current_row.row_id
|
154
|
+
end
|
155
|
+
|
156
|
+
# 添加图像
|
157
|
+
def add_image(image_path)
|
158
|
+
return unless File.exist?(image_path)
|
159
|
+
add_space_line
|
160
|
+
add_row
|
161
|
+
cell_name = current_row.first_cell
|
162
|
+
@worksheet.Range(cell_name).Select
|
163
|
+
@worksheet.Pictures.Insert(image_path)
|
164
|
+
add_space_line IMAGE_ROW_NUM
|
165
|
+
end
|
166
|
+
|
167
|
+
# 判断是否有垂直分页符存在
|
168
|
+
def has_pagebreak?
|
169
|
+
@worksheet.VPageBreaks.count > 0
|
170
|
+
end
|
171
|
+
|
172
|
+
# 对列修改分页符
|
173
|
+
def pagebreak(col)
|
174
|
+
@worksheet.VPageBreaks(1).Location = @worksheet.columns(col)
|
175
|
+
end
|
176
|
+
|
177
|
+
# 返回::WorkSheet
|
178
|
+
def worksheet
|
179
|
+
@worksheet
|
180
|
+
end
|
181
|
+
|
182
|
+
# 添加图表
|
183
|
+
def add_chart(&block)
|
184
|
+
ch = @worksheet.Shapes.AddChart
|
185
|
+
active = ch.chart
|
186
|
+
|
187
|
+
# 占位符
|
188
|
+
block.call(Chart.new(active))
|
189
|
+
|
190
|
+
ch.copy
|
191
|
+
end
|
192
|
+
end # SheetWork Class
|
193
|
+
|
194
|
+
class Row
|
195
|
+
FILL_TYPE = 4
|
196
|
+
|
197
|
+
attr_reader :row_id
|
198
|
+
|
199
|
+
@@cell_map = ("A".."Z").to_a
|
200
|
+
def initialize(worksheet, row_id)
|
201
|
+
@row_id = row_id
|
202
|
+
@cell_count = 0
|
203
|
+
@worksheet = worksheet
|
204
|
+
@nil_space = []
|
205
|
+
end
|
206
|
+
|
207
|
+
# 此时的单元格
|
208
|
+
def curent_cell
|
209
|
+
return cell_name(@cell_count)
|
210
|
+
end
|
211
|
+
|
212
|
+
# 第一个单元格
|
213
|
+
def first_cell
|
214
|
+
return cell_name(0)
|
215
|
+
end
|
216
|
+
|
217
|
+
# 设置行高
|
218
|
+
def height=(height)
|
219
|
+
@worksheet.rows(@row_id).RowHeight = height
|
220
|
+
end
|
221
|
+
|
222
|
+
# 增加单元格
|
223
|
+
def add_cell(value, auto_fit = false, style = "NormalStyle")
|
224
|
+
range = @worksheet.Range(cell_name(@cell_count))
|
225
|
+
range.Value = value.to_s
|
226
|
+
range.Style = style
|
227
|
+
range.Columns.AutoFit if auto_fit
|
228
|
+
@cell_count += 1
|
229
|
+
while(@nil_space.include?(to_letter(@cell_count))) do
|
230
|
+
range = @worksheet.Range(cell_name(@cell_count))
|
231
|
+
range.Value = ""
|
232
|
+
range.Style = style
|
233
|
+
@cell_count += 1
|
234
|
+
end
|
235
|
+
|
236
|
+
end
|
237
|
+
|
238
|
+
# 通过索引变成对应的字母
|
239
|
+
def to_letter(index)
|
240
|
+
@@cell_map.at(index)
|
241
|
+
end
|
242
|
+
|
243
|
+
# 特别注意,由于Toolkit中加入了Array,String的模块
|
244
|
+
# 所以判断的时候特别注意要是
|
245
|
+
def <<(arr)
|
246
|
+
case arr
|
247
|
+
when ::Array
|
248
|
+
arr.size.times do |t|
|
249
|
+
add_cell(arr[t])
|
250
|
+
end
|
251
|
+
when ::String
|
252
|
+
add_cell(arr)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
# 获得单元格的名字(通过索引)
|
257
|
+
def cell_name(index)
|
258
|
+
second = index % 26
|
259
|
+
first = (index - second) / 26
|
260
|
+
if first == 0
|
261
|
+
return @@cell_map[second] + @row_id.to_s
|
262
|
+
end
|
263
|
+
first -= 1
|
264
|
+
return @@cell_map[first] + @@cell_map[second] + @row_id.to_s
|
265
|
+
end
|
266
|
+
|
267
|
+
# 获得单元格的名字(通过字母)
|
268
|
+
def cell_name!(letter)
|
269
|
+
return letter + @row_id.to_s
|
270
|
+
end
|
271
|
+
|
272
|
+
def set_cell(index, value, auto_fit = false, style = "NormalStyle")
|
273
|
+
range = @worksheet.Range(cell_name(index))
|
274
|
+
range.Value = value.to_s
|
275
|
+
range.Style = style
|
276
|
+
range.Columns.AutoFit if auto_fit
|
277
|
+
end
|
278
|
+
|
279
|
+
# 设置单元格风格
|
280
|
+
def set_style(letter, style = "NormalStyle")
|
281
|
+
range = @worksheet.range(cell_name!(letter))
|
282
|
+
range.Style = style
|
283
|
+
end
|
284
|
+
|
285
|
+
# 合并一行中的单元格
|
286
|
+
def merge(idx_begin, idx_end)
|
287
|
+
cell_begin = "#{idx_begin}#{@row_id}"
|
288
|
+
cell_end = "#{idx_end}#{@row_id}"
|
289
|
+
range = @worksheet.Range("#{cell_begin}:#{cell_end}")
|
290
|
+
range.merge
|
291
|
+
tmp = ((idx_begin.upcase)..(idx_end.upcase)).to_a
|
292
|
+
tmp.shift
|
293
|
+
@nil_space = (@nil_space | tmp).sort
|
294
|
+
end
|
295
|
+
|
296
|
+
# 开启自动换行
|
297
|
+
def wraptext(letter)
|
298
|
+
range = @worksheet.range(cell_name!(letter))
|
299
|
+
range.WrapText = true
|
300
|
+
end
|
301
|
+
|
302
|
+
# 对此时的行的下方下分页符
|
303
|
+
def pagebreak
|
304
|
+
@worksheet.rows(@row_id+1).PageBreak = 1
|
305
|
+
end
|
306
|
+
|
307
|
+
# 返回此时的::Row类
|
308
|
+
def real_row
|
309
|
+
@worksheet.rows(@row_id)
|
310
|
+
end
|
311
|
+
|
312
|
+
alias :style :set_style
|
313
|
+
end
|
314
|
+
|
315
|
+
# 图表
|
316
|
+
class Chart
|
317
|
+
|
318
|
+
# 图形类型
|
319
|
+
ColumnClustered = 51 # 簇状柱形图
|
320
|
+
ColumnStacked = 52 # 堆积柱状图
|
321
|
+
Doughnut = -4120 # 圆环图
|
322
|
+
Line = 4 # 折线图
|
323
|
+
Pie = 5 # 饼图
|
324
|
+
BarClustered = 57 # 簇状条形图
|
325
|
+
|
326
|
+
# 标签数据
|
327
|
+
DataLabelsShowLabel = 4 # 数据点所属的分类
|
328
|
+
DataLabelsShowLabelAndPercent = 5 # 占比百分比以及所属分类,仅饼图
|
329
|
+
DataLabelsShowPercent = 3 # 百分比, 仅饼图
|
330
|
+
DataLabelsShowValue = 2 # 默认值
|
331
|
+
|
332
|
+
|
333
|
+
def initialize(active)
|
334
|
+
@chart = active
|
335
|
+
end
|
336
|
+
|
337
|
+
def chart_work
|
338
|
+
@chart
|
339
|
+
end
|
340
|
+
|
341
|
+
# 标签选项
|
342
|
+
def now_table
|
343
|
+
#@chart.SeriesCollection(n).DataLabels
|
344
|
+
num = @chart.SeriesCollection.Count
|
345
|
+
num.times do |t|
|
346
|
+
t += 1
|
347
|
+
yield @chart.SeriesCollection(t).DataLabels
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
# 修改标题
|
352
|
+
def title=(name)
|
353
|
+
@chart.HasTitle = true
|
354
|
+
@chart.ChartTitle.Characters.Text = name
|
355
|
+
end
|
356
|
+
|
357
|
+
# 这是原数据地址, 以每列数据作为一个系列
|
358
|
+
def source=(range)
|
359
|
+
@chart.SetSourceData(range, 2)
|
360
|
+
end
|
361
|
+
|
362
|
+
# 更改图形类型
|
363
|
+
def type=(c_type)
|
364
|
+
@chart.ChartType = c_type
|
365
|
+
end
|
366
|
+
|
367
|
+
# 设置X轴名称, 只用于条形图
|
368
|
+
def axes_x=(name)
|
369
|
+
@chart.Axes(1,1).HasTitle = true
|
370
|
+
@chart.Axes(1,1).AxisTitle.Characters.Text = name
|
371
|
+
end
|
372
|
+
|
373
|
+
# 设置Y轴名称, 只用于条形图
|
374
|
+
def axes_y=(name)
|
375
|
+
@chart.Axes(2,1).HasTitle = true
|
376
|
+
@chart.Axes(2,1).AxisTitle.Characters.Text = name
|
377
|
+
end
|
378
|
+
|
379
|
+
# 设置坐标轴格式, 刻度单位
|
380
|
+
def axes_unit(int)
|
381
|
+
@chart.Axes(2).MajorUnit = int
|
382
|
+
@chart.Axes(2).MinorUnit = int
|
383
|
+
end
|
384
|
+
|
385
|
+
# 修改样式
|
386
|
+
# 通过录制宏可以查看样式编号
|
387
|
+
# 条形图中203 比较好看
|
388
|
+
# 饼图中 251, 254 比较好看
|
389
|
+
def style=(int)
|
390
|
+
@chart.ChartStyle = int
|
391
|
+
data_label
|
392
|
+
end
|
393
|
+
|
394
|
+
# 添加饼图的百分比
|
395
|
+
def data_label(type=DataLabelsShowLabelAndPercent)
|
396
|
+
|
397
|
+
# 应用标签选项
|
398
|
+
@chart.ApplyDataLabels(type)
|
399
|
+
|
400
|
+
# 取消标签选项的系列名称
|
401
|
+
now = @chart.SeriesCollection(1).DataLabels
|
402
|
+
now.ShowSeriesName = false
|
403
|
+
|
404
|
+
# 将图例放到右边
|
405
|
+
now = @chart.Legend
|
406
|
+
now.Position = -4152
|
407
|
+
end
|
408
|
+
|
409
|
+
# 标签系列名称开关
|
410
|
+
def series_name=(bool)
|
411
|
+
now_table do |n|
|
412
|
+
n.ShowSeriesName = bool
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
# 标签类别名称开关
|
417
|
+
def category_name=(bool)
|
418
|
+
now_table do |n|
|
419
|
+
n.ShowCategoryName = bool
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
# 标签值开关
|
424
|
+
def value=(bool)
|
425
|
+
now_table do |n|
|
426
|
+
n.ShowValue = bool
|
427
|
+
n.ShowLegendKey = 0 unless bool
|
428
|
+
n.Separator = " " unless bool
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
end
|
433
|
+
|
434
|
+
end
|
436
435
|
end
|
437
436
|
|
438
|
-
|
437
|
+
|
@@ -23,7 +23,6 @@ class Aio::Module::Cmd::Cisco::ShowEnv < Aio::Module::Cmd::Cisco
|
|
23
23
|
|
24
24
|
def parse
|
25
25
|
cont = self.context.dup
|
26
|
-
debugger
|
27
26
|
|
28
27
|
# 是有版本区别的,要分开对待
|
29
28
|
case device_template
|
@@ -72,7 +71,6 @@ class Aio::Module::Cmd::Cisco::ShowEnv < Aio::Module::Cmd::Cisco
|
|
72
71
|
end
|
73
72
|
|
74
73
|
def parse_tmp_2(cont)
|
75
|
-
debugger
|
76
74
|
useful[:fan] = {}
|
77
75
|
cont.readline_match_block(/Main Power Supply is AC/) {|b|b}
|
78
76
|
cont.readline_match_block(reg_blank) {|b|b}
|