rubyXL 1.1.9 → 1.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rubyXL/workbook.rb +1 -1
- data/lib/rubyXL/writer/shared_strings_writer.rb +6 -20
- data/rubyXL.gemspec +2 -2
- data/spec/lib/worksheet_spec.rb +21 -23
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.10
|
data/lib/rubyXL/workbook.rb
CHANGED
@@ -17,26 +17,12 @@ module Writer
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def write()
|
20
|
-
# contents
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
# i = 0
|
27
|
-
# 0.upto(@workbook.size-1).each do |i|
|
28
|
-
# xml.si {
|
29
|
-
# xml.t @workbook.sharedStrings[i].to_s
|
30
|
-
# xml.phoneticPr('fontId'=>'1', 'type'=>'noConversion')
|
31
|
-
# }
|
32
|
-
# end
|
33
|
-
# }
|
34
|
-
# end
|
35
|
-
# contents = builder.to_xml
|
36
|
-
# contents = contents.gsub(/\n/,'')
|
37
|
-
# contents = contents.gsub(/>(\s)+</,'><')
|
38
|
-
# contents = contents.sub(/<\?xml version=\"1.0\"\?>/,'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n")
|
39
|
-
contents = @workbook.shared_strings_XML
|
20
|
+
# Excel doesn't care much about the contents of sharedStrings.xml -- it will fill it in, but the file has to exist and have a root node.
|
21
|
+
if @workbook.shared_strings_XML
|
22
|
+
contents = @workbook.shared_strings_XML
|
23
|
+
else
|
24
|
+
contents = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n"+'<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="0" uniqueCount="0"></sst>'
|
25
|
+
end
|
40
26
|
contents
|
41
27
|
end
|
42
28
|
end
|
data/rubyXL.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rubyXL}
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.10"
|
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-
|
12
|
+
s.date = %q{2011-10-14}
|
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 = [
|
data/spec/lib/worksheet_spec.rb
CHANGED
@@ -30,21 +30,19 @@ describe RubyXL::Worksheet do
|
|
30
30
|
it 'should return nil if table cannot be found with specified string' do
|
31
31
|
@worksheet.get_table('TEST').should be_nil
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
it 'should return nil if table cannot be found with specified headers' do
|
35
35
|
@worksheet.get_table(['TEST']).should be_nil
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
it 'should return a hash when given an array of headers it can find, where :table points to an array of hashes (rows), where each symbol is a column' do
|
39
39
|
headers = ["0:0", "0:1", "0:4"]
|
40
40
|
table_hash = @worksheet.get_table(headers)
|
41
|
-
|
42
|
-
table_hash.size.should == 4
|
41
|
+
|
43
42
|
table_hash[:table].size.should == 10
|
44
|
-
table_hash[:
|
45
|
-
table_hash[
|
46
|
-
table_hash[
|
47
|
-
table_hash[:"0:4"].size.should == 10
|
43
|
+
table_hash["0:0"].size.should == 10
|
44
|
+
table_hash["0:1"].size.should == 10
|
45
|
+
table_hash["0:4"].size.should == 10
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
@@ -970,19 +968,19 @@ describe RubyXL::Worksheet do
|
|
970
968
|
@worksheet[0][0].row.should == 0
|
971
969
|
@worksheet[0][0].column.should == 0
|
972
970
|
end
|
973
|
-
|
971
|
+
|
974
972
|
it 'should delete a row at index specified, adjusting styles for other rows' do
|
975
973
|
@worksheet.change_row_font_name(1,"Courier")
|
976
974
|
@worksheet.delete_row(0)
|
977
975
|
@worksheet.get_row_font_name(0).should == "Courier"
|
978
976
|
end
|
979
|
-
|
977
|
+
|
980
978
|
it 'should preserve (rather than fix) formulas that reference cells in "pushed up" rows' do
|
981
979
|
@worksheet.add_cell(11,0,nil,'SUM(A1:A10)')
|
982
980
|
@worksheet.delete_row(0)
|
983
981
|
@worksheet[10][0].formula.should == 'SUM(A1:A10)'
|
984
982
|
end
|
985
|
-
|
983
|
+
|
986
984
|
it 'should cause error if a negative argument is passed in' do
|
987
985
|
lambda {
|
988
986
|
@worksheet.delete_row(-1)
|
@@ -1031,19 +1029,19 @@ describe RubyXL::Worksheet do
|
|
1031
1029
|
@worksheet[0][0].row.should == 0
|
1032
1030
|
@worksheet[0][0].column.should == 0
|
1033
1031
|
end
|
1034
|
-
|
1032
|
+
|
1035
1033
|
it 'should delete a column at index specified, "pushing" styles "left"' do
|
1036
1034
|
@worksheet.change_column_font_name(1,"Courier")
|
1037
1035
|
@worksheet.delete_column(0)
|
1038
1036
|
@worksheet.get_column_font_name(0).should == "Courier"
|
1039
1037
|
end
|
1040
|
-
|
1038
|
+
|
1041
1039
|
it 'should preserve (rather than fix) formulas that reference cells in "pushed left" columns' do
|
1042
1040
|
@worksheet.add_cell(0,4,nil,'SUM(A1:D1)')
|
1043
1041
|
@worksheet.delete_column(0)
|
1044
1042
|
@worksheet[0][3].formula.should == 'SUM(A1:D1)'
|
1045
1043
|
end
|
1046
|
-
|
1044
|
+
|
1047
1045
|
it 'should cause error if negative argument is passed in' do
|
1048
1046
|
lambda {
|
1049
1047
|
@worksheet.delete_column(-1)
|
@@ -1097,27 +1095,27 @@ describe RubyXL::Worksheet do
|
|
1097
1095
|
@worksheet[0][1].value.should == '0:1'
|
1098
1096
|
@worksheet[1][0].value.should == '1:0'
|
1099
1097
|
end
|
1100
|
-
|
1098
|
+
|
1101
1099
|
it 'should shift cells to the right if :right is specified' do
|
1102
1100
|
@worksheet.insert_cell(0,0,'test',nil,:right)
|
1103
1101
|
@worksheet[0][0].value.should == 'test'
|
1104
1102
|
@worksheet[0][1].value.should == '0:0'
|
1105
1103
|
@worksheet[1][0].value.should == '1:0'
|
1106
1104
|
end
|
1107
|
-
|
1105
|
+
|
1108
1106
|
it 'should shift cells down if :down is specified' do
|
1109
1107
|
@worksheet.insert_cell(0,0,'test',nil,:down)
|
1110
1108
|
@worksheet[0][0].value.should == 'test'
|
1111
1109
|
@worksheet[0][1].value.should == '0:1'
|
1112
1110
|
@worksheet[1][0].value.should == '0:0'
|
1113
1111
|
end
|
1114
|
-
|
1112
|
+
|
1115
1113
|
it 'should cause error if shift argument is specified whcih is not :right or :down' do
|
1116
1114
|
lambda {
|
1117
1115
|
@worksheet.insert_cell(0,0,'test',nil,:up)
|
1118
1116
|
}.should raise_error
|
1119
1117
|
end
|
1120
|
-
|
1118
|
+
|
1121
1119
|
it 'should cause error if a negative argument is passed in' do
|
1122
1120
|
lambda {
|
1123
1121
|
@worksheet.insert_cell(-1,-1)
|
@@ -1131,27 +1129,27 @@ describe RubyXL::Worksheet do
|
|
1131
1129
|
@worksheet[0][0].should be_nil
|
1132
1130
|
@old_cell.inspect.should == deleted.inspect
|
1133
1131
|
end
|
1134
|
-
|
1132
|
+
|
1135
1133
|
it 'should return nil if a cell which is out of range is specified' do
|
1136
1134
|
@worksheet.delete_cell(12,12).should be_nil
|
1137
1135
|
end
|
1138
|
-
|
1136
|
+
|
1139
1137
|
it 'should cause error if a negative argument is passed in' do
|
1140
1138
|
lambda {
|
1141
1139
|
@worksheet.delete_cell(-1,-1)
|
1142
1140
|
}.should raise_error
|
1143
1141
|
end
|
1144
|
-
|
1142
|
+
|
1145
1143
|
it 'should shift cells to the right of the deleted cell left if :left is specified' do
|
1146
1144
|
@worksheet.delete_cell(0,0,:left)
|
1147
1145
|
@worksheet[0][0].value.should == '0:1'
|
1148
1146
|
end
|
1149
|
-
|
1147
|
+
|
1150
1148
|
it 'should shift cells below the deleted cell up if :up is specified' do
|
1151
1149
|
@worksheet.delete_cell(0,0,:up)
|
1152
1150
|
@worksheet[0][0].value.should == '1:0'
|
1153
1151
|
end
|
1154
|
-
|
1152
|
+
|
1155
1153
|
it 'should cause en error if an argument other than :left, :up, or nil is specified for shift' do
|
1156
1154
|
lambda {
|
1157
1155
|
@worksheet.delete_cell(0,0,:down)
|
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: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 10
|
10
|
+
version: 1.1.10
|
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-
|
18
|
+
date: 2011-10-14 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|