rubyXL 1.0.11 → 1.1.0
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.
- data/VERSION +1 -1
- data/lib/writer/styles_writer.rb +45 -13
- data/lib/writer/worksheet_writer.rb +7 -4
- data/rubyXL.gemspec +2 -4
- metadata +4 -6
- data/README +0 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/lib/writer/styles_writer.rb
CHANGED
@@ -74,23 +74,55 @@ module Writer
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
|
77
|
+
if !@workbook.cell_xfs[:xf].is_a?(Array)
|
78
|
+
@workbook.cell_xfs[:xf] = [@workbook.cell_xfs[:xf]]
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
|
78
83
|
style_id_corrector['0']=0
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
#
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
84
|
+
delete_list = []
|
85
|
+
i = 1
|
86
|
+
while(i < @workbook.cell_xfs[:xf].size) do
|
87
|
+
if style_id_corrector[i.to_s].nil?
|
88
|
+
style_id_corrector[i.to_s]= i
|
89
|
+
end
|
90
|
+
# style correction commented out until bug is fixed
|
91
|
+
j = i+1
|
92
|
+
while(j < @workbook.cell_xfs[:xf].size) do
|
93
|
+
if hash_equal(@workbook.cell_xfs[:xf][i],@workbook.cell_xfs[:xf][j]) #check if this is working
|
94
|
+
style_id_corrector[j.to_s] = i
|
95
|
+
delete_list << j
|
96
|
+
end
|
97
|
+
j += 1
|
98
|
+
end
|
99
|
+
i += 1
|
100
|
+
end
|
101
|
+
|
102
|
+
#go through delete list, if before delete_list index 0, offset 0, if before delete_list index 1, offset 1, etc.
|
103
|
+
delete_list.sort!
|
104
|
+
|
105
|
+
i = 1
|
106
|
+
offset = 0
|
107
|
+
offset_corrector = 0
|
108
|
+
delete_list << @workbook.cell_xfs[:xf].size
|
109
|
+
while offset < delete_list.size do
|
110
|
+
delete_index = delete_list[offset] - offset
|
111
|
+
|
112
|
+
while i <= delete_list[offset] do #if <= instead of <, fixes odd border but adds random cells with fill
|
113
|
+
if style_id_corrector[i.to_s] == i
|
114
|
+
style_id_corrector[i.to_s] -= offset# unless style_id_corrector[i.to_s].nil? #173 should equal 53, not 52?
|
115
|
+
end
|
116
|
+
|
117
|
+
i += 1
|
118
|
+
end
|
119
|
+
@workbook.cell_xfs[:xf].delete_at(delete_index)
|
120
|
+
offset += 1
|
91
121
|
end
|
122
|
+
|
92
123
|
@workbook.style_corrector = style_id_corrector
|
93
124
|
|
125
|
+
|
94
126
|
xml.fonts('count'=>@workbook.fonts.size) {
|
95
127
|
0.upto(@workbook.fonts.size-1) do |i|
|
96
128
|
font = @workbook.fonts[i.to_s]
|
@@ -77,6 +77,9 @@ module Writer
|
|
77
77
|
|
78
78
|
unless @worksheet.cols.nil? || @worksheet.cols.size==0
|
79
79
|
xml.cols {
|
80
|
+
if !@worksheet.cols.is_a?(Array)
|
81
|
+
@worksheet.cols = [@worksheet.cols]
|
82
|
+
end
|
80
83
|
@worksheet.cols.each do |col|
|
81
84
|
if col[:attributes][:customWidth].nil?
|
82
85
|
col[:attributes][:customWidth] = '0'
|
@@ -109,19 +112,19 @@ module Writer
|
|
109
112
|
custom_format = '0'
|
110
113
|
end
|
111
114
|
|
115
|
+
@worksheet.row_styles[(i+1).to_s][:style] = @workbook.style_corrector[@worksheet.row_styles[(i+1).to_s][:style].to_s]
|
112
116
|
xml.row('r'=>(i+1).to_s, 'spans'=>'1:'+row.size.to_s,
|
113
|
-
's'=>@
|
117
|
+
's'=>@worksheet.row_styles[(i+1).to_s][:style].to_s,
|
114
118
|
'customFormat'=>custom_format,
|
115
119
|
'ht'=>@worksheet.row_styles[(i+1).to_s][:height].to_s,
|
116
120
|
'customHeight'=>@worksheet.row_styles[(i+1).to_s][:customHeight].to_s) {
|
117
121
|
row.each_with_index do |dat, j|
|
118
122
|
unless dat.nil?
|
119
|
-
#TODO un-hardcode t value, needs to be other values too
|
120
|
-
#TODO recalculate based on formula....?
|
121
123
|
#TODO do xml.c for all cases, inside specific.
|
122
124
|
# if dat.formula.nil?
|
125
|
+
dat.style_index = @workbook.style_corrector[dat.style_index.to_s]
|
123
126
|
xml.c('r'=>Cell.convert_to_cell(i,j),
|
124
|
-
's'
|
127
|
+
's'=>dat.style_index.to_s, 't'=>dat.datatype) {
|
125
128
|
unless dat.formula.nil?
|
126
129
|
if dat.formula_attributes.empty?
|
127
130
|
xml.f dat.formula.to_s
|
data/rubyXL.gemspec
CHANGED
@@ -5,23 +5,21 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rubyXL}
|
8
|
-
s.version = "1.0
|
8
|
+
s.version = "1.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Vivek Bhagwat"]
|
12
|
-
s.date = %q{2011-08-
|
12
|
+
s.date = %q{2011-08-11}
|
13
13
|
s.description = %q{rubyXL is a gem which allows the parsing, creation, and manipulation of Microsoft Excel (.xlsx/.xlsm) Documents}
|
14
14
|
s.email = %q{bhagwat.vivek@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
|
-
"README",
|
18
17
|
"README.rdoc"
|
19
18
|
]
|
20
19
|
s.files = [
|
21
20
|
"Gemfile",
|
22
21
|
"Gemfile.lock",
|
23
22
|
"LICENSE.txt",
|
24
|
-
"README",
|
25
23
|
"README.rdoc",
|
26
24
|
"Rakefile",
|
27
25
|
"VERSION",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyXL
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.11
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Vivek Bhagwat
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
18
|
+
date: 2011-08-11 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -134,13 +134,11 @@ extensions: []
|
|
134
134
|
|
135
135
|
extra_rdoc_files:
|
136
136
|
- LICENSE.txt
|
137
|
-
- README
|
138
137
|
- README.rdoc
|
139
138
|
files:
|
140
139
|
- Gemfile
|
141
140
|
- Gemfile.lock
|
142
141
|
- LICENSE.txt
|
143
|
-
- README
|
144
142
|
- README.rdoc
|
145
143
|
- Rakefile
|
146
144
|
- VERSION
|
data/README
DELETED