wizport 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,15 +24,9 @@ module Wizport
24
24
  @col_offset = 1
25
25
  @right_width = 0
26
26
  cells.each do |cell|
27
- if row_spanned? @col_offset
28
- add_cell ""
29
- add_cell cell
30
- elsif row_spanned? @col_offset + 1
31
- add_cell cell
32
- add_cell ""
33
- else
34
- add_cell cell
35
- end
27
+ add_cell "" if row_spanned?(@col_offset)
28
+ add_cell cell
29
+ add_cell "" if row_spanned? @col_offset
36
30
  end
37
31
  cmd :row
38
32
  end
@@ -56,13 +50,13 @@ module Wizport
56
50
  @row_spans[@col_offset][:rowspan] -= 1
57
51
  colspan = @row_spans[@col_offset][:colspan]
58
52
  end
59
- colspan.times do |i|
60
- @right_width += column_width(@col_offset + i)
53
+ colspan.times do
54
+ @right_width += column_width(@col_offset)
55
+ @col_offset += 1
61
56
  end
62
57
  cmd :cellx, @right_width
63
58
  txt content
64
59
  cmd :cell
65
- @col_offset += colspan
66
60
  end
67
61
 
68
62
  def row_spanned?(offset)
@@ -1,3 +1,3 @@
1
1
  module Wizport
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -7,9 +7,16 @@ describe Wizport::Rtf::Document do
7
7
  it "a simple example of Rtf" do
8
8
  rtf = Wizport::Rtf::Document.new do
9
9
  text "学生综合素质评价"
10
- table [[1,{content:'1',colspan:2}],[3,{content:'4',rowspan:2,colspan:2}],[11]],column_widths:{1=>2000,2=>1000,3=>1000} do
11
- add_row [1,1,1]
12
- end
10
+ #table [[1,{content:'1',colspan:2}],
11
+ # [3,{content:'4',rowspan:2,colspan:2}],
12
+ # [11]],column_widths:{1=>2000,2=>1000,3=>1000} do
13
+ # add_row [1,1,1]
14
+ #end
15
+
16
+ table [["姓名", "person.name", "性别", {content: "{Core::Person::GENDER_TYPE[person.gender]}", colspan: 3}, "出生日期", {content: "nil}", colspan: 2}, {content: "一寸照片", colspan: 2, rowspan: 3}],
17
+ ["民族", {content: "{Core}", colspan: 2}, "入队(团)时间", {content: '', colspan: 5}],
18
+ ["家庭住址", {content: "person", colspan: 8}]]
19
+
13
20
  end
14
21
 
15
22
  rtf.save('c:/r.rtf')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wizport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: