Class: Aio::Base::Toolkit::WordWps::Table
- Inherits:
-
Object
- Object
- Aio::Base::Toolkit::WordWps::Table
- Defined in:
- lib/aio/base/toolkit/word_wps.rb
Overview
表格
Instance Method Summary collapse
-
#<<(arr) ⇒ Object
放入数据, 可以按数组放入.
-
#border_line ⇒ Object
网格线.
-
#center ⇒ Object
居中.
-
#height=(point) ⇒ Object
设置行高.
-
#initialize(selection, row, col, obj) ⇒ Table
constructor
A new instance of Table.
-
#merge_row ⇒ Object
合并列.
- #now ⇒ Object
-
#puts(str) ⇒ Object
放入数据.
-
#select_all ⇒ Object
选择整个表格.
-
#set_columns_width(col, point) ⇒ Object
设置列宽度.
-
#style=(sty) ⇒ Object
设置风格.
-
#top ⇒ Object
移动到第一个单元格.
Constructor Details
#initialize(selection, row, col, obj) ⇒ Table
Returns a new instance of Table.
414 415 416 417 418 419 420 |
# File 'lib/aio/base/toolkit/word_wps.rb', line 414 def initialize(selection, row, col, obj) @row = row @col = col @count = row * col @selection = selection @obj = obj end |
Instance Method Details
#<<(arr) ⇒ Object
放入数据, 可以按数组放入
442 443 444 445 446 447 448 449 |
# File 'lib/aio/base/toolkit/word_wps.rb', line 442 def <<(arr) case arr when ::String puts(arr) when ::Array arr.each { |a| puts(a) } end end |
#border_line ⇒ Object
网格线
484 485 486 487 488 489 490 491 492 |
# File 'lib/aio/base/toolkit/word_wps.rb', line 484 def border_line select_all now.Borders(-1).LineStyle = 1 now.Borders(-2).LineStyle = 1 now.Borders(-3).LineStyle = 1 now.Borders(-4).LineStyle = 1 now.Borders(-5).LineStyle = 1 now.Borders(-6).LineStyle = 1 end |
#center ⇒ Object
居中
473 474 475 476 |
# File 'lib/aio/base/toolkit/word_wps.rb', line 473 def center select_all now.ParagraphFormat.Alignment = 1 end |
#height=(point) ⇒ Object
设置行高
452 453 454 |
# File 'lib/aio/base/toolkit/word_wps.rb', line 452 def height=(point) now.Rows.Height = point end |
#merge_row ⇒ Object
合并列
427 428 429 430 431 |
# File 'lib/aio/base/toolkit/word_wps.rb', line 427 def merge_row now.SelectRow now.Cells.Merge @count = @count - @row + 1 end |
#now ⇒ Object
422 423 424 |
# File 'lib/aio/base/toolkit/word_wps.rb', line 422 def now @selection end |
#puts(str) ⇒ Object
放入数据
434 435 436 437 438 439 |
# File 'lib/aio/base/toolkit/word_wps.rb', line 434 def puts(str) now.SelectCell now.TypeText(str) @count -= 1 now.MoveRight(12) unless @count < 1 end |
#select_all ⇒ Object
选择整个表格
479 480 481 |
# File 'lib/aio/base/toolkit/word_wps.rb', line 479 def select_all @obj.Select end |
#set_columns_width(col, point) ⇒ Object
设置列宽度
463 464 465 |
# File 'lib/aio/base/toolkit/word_wps.rb', line 463 def set_columns_width(col, point) @obj.Columns(col).SetWidth(point, 2) end |
#style=(sty) ⇒ Object
设置风格
457 458 459 460 |
# File 'lib/aio/base/toolkit/word_wps.rb', line 457 def style=(sty) select_all now.Style = sty end |
#top ⇒ Object
移动到第一个单元格
468 469 470 |
# File 'lib/aio/base/toolkit/word_wps.rb', line 468 def top @obj.Cell(1,1).Select end |