wizport 0.1.0 → 0.1.1
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.
@@ -24,14 +24,16 @@ module Wizport
|
|
24
24
|
@col_offset = 1
|
25
25
|
@right_width = 0
|
26
26
|
cells.each do |cell|
|
27
|
-
|
27
|
+
|
28
28
|
add_cell cell
|
29
|
-
|
29
|
+
|
30
30
|
end
|
31
31
|
cmd :row
|
32
32
|
end
|
33
33
|
|
34
|
-
def add_cell(cell)
|
34
|
+
def add_cell(cell,merge = false)
|
35
|
+
p row_spanned?(@col_offset)
|
36
|
+
add_cell "",true if !merge && row_spanned?(@col_offset)
|
35
37
|
if cell.is_a?(Hash)
|
36
38
|
rowspan = cell[:rowspan]
|
37
39
|
colspan = cell[:colspan]
|
@@ -41,15 +43,19 @@ module Wizport
|
|
41
43
|
colspan = colspan || 1
|
42
44
|
rowspan = rowspan || 1
|
43
45
|
content = content || cell
|
44
|
-
|
46
|
+
p @row_spans
|
45
47
|
cmd :celld
|
46
48
|
if rowspan > 1
|
47
49
|
cmd :clvmgf
|
48
50
|
elsif row_spanned? @col_offset
|
49
51
|
cmd :clvmrg
|
50
52
|
@row_spans[@col_offset][:rowspan] -= 1
|
53
|
+
#if @row_spans[@col_offset][:rowspan] < 2
|
54
|
+
# @row_spans[@col_offset].delete(:rowspan)
|
55
|
+
#end
|
51
56
|
colspan = @row_spans[@col_offset][:colspan] || colspan
|
52
57
|
end
|
58
|
+
p @row_spans
|
53
59
|
colspan.times do
|
54
60
|
@right_width += column_width(@col_offset)
|
55
61
|
@col_offset += 1
|
@@ -57,6 +63,8 @@ module Wizport
|
|
57
63
|
cmd :cellx, @right_width
|
58
64
|
txt content
|
59
65
|
cmd :cell
|
66
|
+
|
67
|
+
add_cell "",true if row_spanned?(@col_offset)
|
60
68
|
end
|
61
69
|
|
62
70
|
def row_spanned?(offset)
|
data/lib/wizport/version.rb
CHANGED
@@ -7,10 +7,10 @@ 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}],
|
11
|
-
# [
|
12
|
-
# [11]],column_widths:
|
13
|
-
# add_row [1
|
10
|
+
#table [[{content:'4',rowspan:4},1,{content:'1',colspan:2}],
|
11
|
+
# [{content:'4',rowspan:3,colspan:2},8],
|
12
|
+
# [11]],column_widths:1000 do
|
13
|
+
# add_row [1]
|
14
14
|
#end
|
15
15
|
|
16
16
|
#table [["姓名", "person.name", "性别", {content: "{Core::Person::GENDER_TYPE[person.gender]}", colspan: 3}, "出生日期", {content: "nil}", colspan: 2}, {content: "一寸照片", colspan: 2, rowspan: 3}],
|