rubyXL 1.2.10 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/Gemfile +14 -10
  2. data/Gemfile.lock +80 -21
  3. data/LICENSE.txt +1 -1
  4. data/README.rdoc +88 -82
  5. data/Rakefile +7 -2
  6. data/VERSION +1 -1
  7. data/lib/rubyXL.rb +13 -7
  8. data/lib/rubyXL/cell.rb +108 -268
  9. data/lib/rubyXL/generic_storage.rb +40 -0
  10. data/lib/rubyXL/objects/border.rb +66 -0
  11. data/lib/rubyXL/objects/calculation_chain.rb +28 -0
  12. data/lib/rubyXL/objects/cell_style.rb +75 -0
  13. data/lib/rubyXL/objects/color.rb +25 -0
  14. data/lib/rubyXL/objects/column_range.rb +74 -0
  15. data/lib/rubyXL/objects/container_nodes.rb +122 -0
  16. data/lib/rubyXL/objects/data_validation.rb +43 -0
  17. data/lib/rubyXL/objects/document_properties.rb +76 -0
  18. data/lib/rubyXL/objects/extensions.rb +36 -0
  19. data/lib/rubyXL/objects/fill.rb +57 -0
  20. data/lib/rubyXL/objects/font.rb +111 -0
  21. data/lib/rubyXL/objects/formula.rb +24 -0
  22. data/lib/rubyXL/objects/ooxml_object.rb +295 -0
  23. data/lib/rubyXL/objects/reference.rb +110 -0
  24. data/lib/rubyXL/objects/relationships.rb +59 -0
  25. data/lib/rubyXL/objects/shared_strings.rb +57 -0
  26. data/lib/rubyXL/objects/sheet_data.rb +149 -0
  27. data/lib/rubyXL/objects/sheet_view.rb +71 -0
  28. data/lib/rubyXL/objects/stylesheet.rb +200 -0
  29. data/lib/rubyXL/objects/text.rb +87 -0
  30. data/lib/rubyXL/objects/theme.rb +64 -0
  31. data/lib/rubyXL/objects/workbook.rb +233 -0
  32. data/lib/rubyXL/objects/worksheet.rb +485 -0
  33. data/lib/rubyXL/parser.rb +78 -442
  34. data/lib/rubyXL/workbook.rb +216 -385
  35. data/lib/rubyXL/worksheet.rb +509 -1062
  36. data/lib/rubyXL/writer/content_types_writer.rb +104 -68
  37. data/lib/rubyXL/writer/core_writer.rb +26 -43
  38. data/lib/rubyXL/writer/generic_writer.rb +43 -0
  39. data/lib/rubyXL/writer/root_rels_writer.rb +11 -19
  40. data/lib/rubyXL/writer/styles_writer.rb +6 -398
  41. data/lib/rubyXL/writer/theme_writer.rb +321 -327
  42. data/lib/rubyXL/writer/workbook_writer.rb +63 -67
  43. data/lib/rubyXL/writer/worksheet_writer.rb +29 -218
  44. data/rdoc/created.rid +39 -0
  45. data/rdoc/fonts.css +167 -0
  46. data/rdoc/fonts/Lato-Light.ttf +0 -0
  47. data/rdoc/fonts/Lato-LightItalic.ttf +0 -0
  48. data/rdoc/fonts/Lato-Regular.ttf +0 -0
  49. data/rdoc/fonts/Lato-RegularItalic.ttf +0 -0
  50. data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
  51. data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
  52. data/rdoc/images/add.png +0 -0
  53. data/rdoc/images/arrow_up.png +0 -0
  54. data/rdoc/images/brick.png +0 -0
  55. data/rdoc/images/brick_link.png +0 -0
  56. data/rdoc/images/bug.png +0 -0
  57. data/rdoc/images/bullet_black.png +0 -0
  58. data/rdoc/images/bullet_toggle_minus.png +0 -0
  59. data/rdoc/images/bullet_toggle_plus.png +0 -0
  60. data/rdoc/images/date.png +0 -0
  61. data/rdoc/images/delete.png +0 -0
  62. data/rdoc/images/find.png +0 -0
  63. data/rdoc/images/loadingAnimation.gif +0 -0
  64. data/rdoc/images/macFFBgHack.png +0 -0
  65. data/rdoc/images/package.png +0 -0
  66. data/rdoc/images/page_green.png +0 -0
  67. data/rdoc/images/page_white_text.png +0 -0
  68. data/rdoc/images/page_white_width.png +0 -0
  69. data/rdoc/images/plugin.png +0 -0
  70. data/rdoc/images/ruby.png +0 -0
  71. data/rdoc/images/tag_blue.png +0 -0
  72. data/rdoc/images/tag_green.png +0 -0
  73. data/rdoc/images/transparent.png +0 -0
  74. data/rdoc/images/wrench.png +0 -0
  75. data/rdoc/images/wrench_orange.png +0 -0
  76. data/rdoc/images/zoom.png +0 -0
  77. data/rdoc/js/darkfish.js +140 -0
  78. data/rdoc/js/jquery.js +18 -0
  79. data/rdoc/js/navigation.js +142 -0
  80. data/rdoc/js/search.js +109 -0
  81. data/rdoc/js/search_index.js +1 -0
  82. data/rdoc/js/searcher.js +228 -0
  83. data/rdoc/rdoc.css +580 -0
  84. data/rubyXL.gemspec +90 -34
  85. data/spec/lib/cell_spec.rb +29 -59
  86. data/spec/lib/parser_spec.rb +35 -19
  87. data/spec/lib/reference_spec.rb +29 -0
  88. data/spec/lib/stylesheet_spec.rb +29 -0
  89. data/spec/lib/workbook_spec.rb +22 -17
  90. data/spec/lib/worksheet_spec.rb +47 -202
  91. metadata +185 -148
  92. data/lib/.DS_Store +0 -0
  93. data/lib/rubyXL/Hash.rb +0 -60
  94. data/lib/rubyXL/color.rb +0 -14
  95. data/lib/rubyXL/private_class.rb +0 -265
  96. data/lib/rubyXL/writer/app_writer.rb +0 -62
  97. data/lib/rubyXL/writer/calc_chain_writer.rb +0 -33
  98. data/lib/rubyXL/writer/shared_strings_writer.rb +0 -30
  99. data/lib/rubyXL/writer/workbook_rels_writer.rb +0 -59
  100. data/lib/rubyXL/zip.rb +0 -20
  101. data/spec/lib/hash_spec.rb +0 -28
data/lib/rubyXL/color.rb DELETED
@@ -1,14 +0,0 @@
1
- module RubyXL
2
- class Color
3
-
4
- #validates hex color code, no '#' allowed
5
- def Color.validate_color(color)
6
- if color =~ /^([a-f]|[A-F]|[0-9]){6}$/
7
- return true
8
- else
9
- raise 'invalid color'
10
- end
11
- end
12
-
13
- end
14
- end
@@ -1,265 +0,0 @@
1
- module RubyXL
2
- class PrivateClass
3
- private
4
-
5
- #validate and modify methods
6
- def validate_horizontal_alignment(alignment)
7
- if alignment.to_s == '' || alignment == 'center' || alignment == 'distributed' || alignment == 'justify' || alignment == 'left' || alignment == 'right'
8
- return true
9
- end
10
- raise 'Only center, distributed, justify, left, and right are valid horizontal alignments'
11
- end
12
-
13
- def validate_vertical_alignment(alignment)
14
- if alignment.to_s == '' || alignment == 'center' || alignment == 'distributed' || alignment == 'justify' || alignment == 'top' || alignment == 'bottom'
15
- return true
16
- end
17
- raise 'Only center, distributed, justify, top, and bottom are valid vertical alignments'
18
- end
19
-
20
- def validate_border(weight)
21
- if weight.to_s == '' || weight == 'thin' || weight == 'thick' || weight == 'hairline' || weight == 'medium'
22
- return true
23
- end
24
- raise 'Border weights must only be "hairline", "thin", "medium", or "thick"'
25
- end
26
-
27
- def validate_nonnegative(row_or_col)
28
- if row_or_col < 0
29
- raise 'Row and Column arguments must be nonnegative'
30
- end
31
- end
32
-
33
- # This method checks to see if there is an equivalent font that exists
34
- def find_font(workbook, font)
35
- workbook.fonts.each {|font_id, f|
36
- if f[:font][:i] == font[:i] &&
37
- f[:font][:b] == font[:b] &&
38
- f[:font][:u] == font[:u] &&
39
- f[:font][:strike] == font[:strike] &&
40
- f[:font][:name][:attributes][:val] == font[:name][:attributes][:val] &&
41
- f[:font][:sz][:attributes][:val] == font[:sz][:attributes][:val] &&
42
- (f[:font][:color] && f[:font][:color][:attributes][:rgb]) == (font[:color] && font[:color][:attributes][:rgb])
43
- return font_id
44
- end
45
- }
46
- return nil
47
- end
48
-
49
- # Helper method to modify the font color
50
- def modify_font_color(font, font_color)
51
- if font[:color].nil?
52
- font[:color] = {:attributes => {:rgb => ''}}
53
- end
54
- font[:color][:attributes][:rgb] = font_color.to_s
55
- return font
56
- end
57
-
58
- # Helper method to modify the font's italics settings
59
- def modify_font_italics(font, italicized)
60
- if italicized
61
- font[:i] = {}
62
- else
63
- font[:i] = nil
64
- end
65
- return font
66
- end
67
-
68
- # Helper method to modify the font's bold settings
69
- def modify_font_bold(font, bolded)
70
- if bolded
71
- font[:b] = {}
72
- else
73
- font[:b] = nil
74
- end
75
- return font
76
- end
77
-
78
- # Helper method to modify the font's underline settings
79
- def modify_font_underline(font, underlined)
80
- if underlined
81
- font[:u] = {}
82
- else
83
- font[:u] = nil
84
- end
85
- return font
86
- end
87
-
88
- # Helper method to modify the font's strikethrough settings
89
- def modify_font_strikethrough(font, struckthrough)
90
- if struckthrough
91
- font[:strike] = {}
92
- else
93
- font[:strike] = nil
94
- end
95
- return font
96
- end
97
-
98
- # Determines if font exists
99
- # If yes, return id of existing font
100
- # If no, appends font to font array
101
- def modify_font(workbook, font, old_font_id)
102
- font_id = old_font_id
103
- existing_font_id = find_font(workbook, font)
104
- if !existing_font_id.nil?
105
- font_id = existing_font_id
106
- workbook.fonts[font_id][:count] += 1
107
- workbook.fonts[old_font_id][:count] -= 1
108
- elsif workbook.fonts[old_font_id.to_s][:count] > 1 || old_font_id == '0'
109
- font_id = workbook.fonts.size.to_s
110
- workbook.fonts[font_id] = {}
111
- workbook.fonts[font_id][:font] = font
112
- workbook.fonts[font_id][:count] = 1
113
- workbook.fonts[old_font_id][:count] -= 1
114
- else
115
- workbook.fonts[font_id][:font] = font
116
- end
117
- return font_id
118
- end
119
-
120
- # This method checks to see if there is an equivalent xf that exists
121
- def find_xf(workbook, xf)
122
- workbook.cell_xfs[:xf].each_with_index {|xfs, index|
123
- if xfs[:attributes][:borderId] == xf[:borderId] &&
124
- xfs[:attributes][:xfId] == xf[:xfId] &&
125
- xfs[:attributes][:fillId] == xf[:fillId] &&
126
- xfs[:attributes][:numFmtId] == xf[:numFmtId] &&
127
- xfs[:attributes][:fontId] == xf[:fontId]
128
- return index
129
- end
130
- }
131
- return nil
132
- end
133
-
134
- # Determines if xf exists
135
- # If yes, return id of existing xf
136
- # If no, appends xf to xf array
137
- def modify_xf(workbook, xf)
138
- existing_xf_id = find_xf(workbook, xf)
139
- if !existing_xf_id.nil?
140
- xf_id = existing_xf_id
141
- else
142
- if workbook.cell_xfs[:xf].is_a?Array
143
- workbook.cell_xfs[:xf] << {:attributes=>xf}
144
- else
145
- workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], {:attributes=>xf}]
146
- end
147
- xf[:applyFont] = '1'
148
- workbook.cell_xfs[:attributes][:count] += 1
149
- xf_id = workbook.cell_xfs[:xf].size - 1
150
- end
151
- return xf_id
152
- end
153
-
154
- #modifies fill array (copies, appends, adds color and solid attribute)
155
- #then styles array (copies, appends)
156
- def modify_fill(workbook, style_index, rgb)
157
- xf_obj = workbook.get_style(style_index)
158
- xf = workbook.get_style_attributes(xf_obj)
159
- #modify fill array
160
- fill_id = xf[:fillId]
161
-
162
- fill = workbook.fills[fill_id.to_s][:fill]
163
- if workbook.fills[fill_id.to_s][:count] > 1 || fill_id == 0 || fill_id == 1
164
- old_size = workbook.fills.size.to_s
165
- workbook.fills[old_size] = {}
166
- workbook.fills[old_size][:fill] = deep_copy(fill)
167
- workbook.fills[old_size][:count] = 1
168
- workbook.fills[fill_id.to_s][:count] -= 1
169
-
170
- change_wb_fill(workbook, old_size,rgb)
171
-
172
- #modify styles array
173
- fill_id = old_size
174
- if workbook.cell_xfs[:xf].is_a?Array
175
- workbook.cell_xfs[:xf] << deep_copy({:attributes=>xf})
176
- else
177
- workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy({:attributes=>xf})]
178
- end
179
- xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)
180
- xf[:fillId] = fill_id
181
- xf[:applyFill] = '1'
182
- workbook.cell_xfs[:attributes][:count] += 1
183
- return workbook.cell_xfs[:xf].size-1
184
- else
185
- change_wb_fill(workbook, fill_id.to_s,rgb)
186
- return style_index
187
- end
188
- end
189
-
190
- def modify_border(workbook, style_index)
191
- xf_obj = workbook.get_style(style_index)
192
- xf = workbook.get_style_attributes(xf_obj)
193
-
194
- border_id = Integer(xf[:borderId])
195
- border = workbook.borders[border_id.to_s][:border]
196
- if workbook.borders[border_id.to_s][:count] > 1 || border_id == 0 || border_id == 1
197
- old_size = workbook.borders.size.to_s
198
- workbook.borders[old_size] = {}
199
- workbook.borders[old_size][:border] = deep_copy(border)
200
- workbook.borders[old_size][:count] = 1
201
-
202
- border_id = old_size
203
-
204
- if workbook.cell_xfs[:xf].is_a?Array
205
- workbook.cell_xfs[:xf] << deep_copy(xf_obj)
206
- else
207
- workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy(xf_obj)]
208
- end
209
-
210
- xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)
211
- xf[:borderId] = border_id
212
- xf[:applyBorder] = '1'
213
- workbook.cell_xfs[:attributes][:count] += 1
214
- return workbook.cell_xfs[:xf].size-1
215
- else
216
- return style_index
217
- end
218
- end
219
-
220
- #is_horizontal is true when doing horizontal alignment,
221
- #false when doing vertical alignment
222
- def modify_alignment(workbook, style_index, is_horizontal, alignment)
223
- old_xf_obj = workbook.get_style(style_index)
224
-
225
- xf_obj = deep_copy(old_xf_obj)
226
-
227
- if xf_obj[:alignment].nil? || xf_obj[:alignment][:attributes].nil?
228
- xf_obj[:alignment] = {:attributes=>{:horizontal=>nil, :vertical=>nil}}
229
- end
230
-
231
- if is_horizontal
232
- xf_obj[:alignment][:attributes][:horizontal] = alignment.to_s
233
- else
234
- xf_obj[:alignment][:attributes][:vertical] = alignment.to_s
235
- end
236
-
237
- if workbook.cell_xfs[:xf].is_a?Array
238
- workbook.cell_xfs[:xf] << deep_copy(xf_obj)
239
- else
240
- workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy(xf_obj)]
241
- end
242
-
243
- xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)
244
- xf[:applyAlignment] = '1'
245
- workbook.cell_xfs[:attributes][:count] += 1
246
- workbook.cell_xfs[:xf].size-1
247
- end
248
-
249
- #returns non-shallow copy of hash
250
- def deep_copy(hash)
251
- Marshal.load(Marshal.dump(hash))
252
- end
253
-
254
- def change_wb_fill(workbook, fill_index, rgb)
255
- if workbook.fills[fill_index][:fill][:patternFill][:fgColor].nil?
256
- workbook.fills[fill_index][:fill][:patternFill][:fgColor] = {:attributes => {:rgb => ''}}
257
- end
258
- workbook.fills[fill_index][:fill][:patternFill][:fgColor][:attributes][:rgb] = rgb
259
-
260
- #previously none, doesn't show fill
261
- workbook.fills[fill_index][:fill][:patternFill][:attributes][:patternType] = 'solid'
262
- end
263
-
264
- end
265
- end
@@ -1,62 +0,0 @@
1
- # require File.expand_path(File.join(File.dirname(__FILE__),'workbook'))
2
- # require File.expand_path(File.join(File.dirname(__FILE__),'worksheet'))
3
- # require File.expand_path(File.join(File.dirname(__FILE__),'cell'))
4
- # require File.expand_path(File.join(File.dirname(__FILE__),'color'))
5
- require 'rubygems'
6
- require 'nokogiri'
7
-
8
- module RubyXL
9
- module Writer
10
- class AppWriter
11
- attr_accessor :dirpath, :filepath, :workbook
12
-
13
- def initialize(dirpath, wb)
14
- @dirpath = dirpath
15
- @filepath = dirpath+'/docProps/app.xml'
16
- @workbook = wb
17
- end
18
-
19
- def write()
20
-
21
- builder = Nokogiri::XML::Builder.new do |xml|
22
- xml.Properties('xmlns' => 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties',
23
- 'xmlns:vt'=>'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes') {
24
- xml.Application @workbook.application
25
- xml.DocSecurity '0'
26
- xml.ScaleCrop 'false'
27
- xml.HeadingPairs {
28
- xml['vt'].vector(:size => '2', :baseType => 'variant') {
29
- xml['vt'].variant {
30
- xml['vt'].lpstr 'Worksheets'
31
- }
32
- xml['vt'].variant {
33
- xml['vt'].i4 @workbook.worksheets.size.to_s()
34
- }
35
- }
36
- }
37
- xml.TitlesOfParts {
38
- xml['vt'].vector(:size=>@workbook.worksheets.size.to_s(), :baseType=>"lpstr") {
39
- @workbook.worksheets.each do |sheet|
40
- xml['vt'].lpstr sheet.sheet_name
41
- end
42
- }
43
- }
44
- xml.Company @workbook.company
45
- xml.LinksUpToDate 'false'
46
- xml.SharedDoc 'false'
47
- xml.HyperlinksChanged 'false'
48
- xml.AppVersion @workbook.appversion
49
- }
50
- end
51
- contents = builder.to_xml
52
- if(contents =~ /xmlns:vt=\"(.*)\" xmlns=\"(.*)\"/)
53
- contents.sub(/xmlns:vt=\"(.*)\" xmlns=\"(.*)\"<A/,'xmlns="'+$2+'" xmlns:vt="'+$1+'"<A')
54
- end
55
- contents = contents.gsub(/\n/,'')
56
- contents = contents.gsub(/>(\s)+</,'><')
57
- contents = contents.sub(/<\?xml version=\"1.0\"\?>/,'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n")
58
- contents
59
- end
60
- end
61
- end
62
- end
@@ -1,33 +0,0 @@
1
- # require File.expand_path(File.join(File.dirname(__FILE__),'workbook'))
2
- # require File.expand_path(File.join(File.dirname(__FILE__),'worksheet'))
3
- # require File.expand_path(File.join(File.dirname(__FILE__),'cell'))
4
- # require File.expand_path(File.join(File.dirname(__FILE__),'color'))
5
- require 'rubygems'
6
- require 'nokogiri'
7
-
8
- module RubyXL
9
- module Writer
10
-
11
-
12
- #TODO
13
- class CalcChainWriter
14
- attr_accessor :dirpath, :filepath, :workbook
15
-
16
- def initialize(dirpath, wb)
17
- @dirpath = dirpath
18
- @workbook = wb
19
- @filepath = dirpath + '/xl/calcChain.xml'
20
- end
21
-
22
- def write()
23
- contents = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n"
24
- contents += ''
25
- # file = File.new(@filepath, 'w+')
26
- # file.write(contents)
27
- # file.close
28
- contents
29
- end
30
- end
31
-
32
- end
33
- end
@@ -1,30 +0,0 @@
1
- # require File.expand_path(File.join(File.dirname(__FILE__),'workbook'))
2
- # require File.expand_path(File.join(File.dirname(__FILE__),'worksheet'))
3
- # require File.expand_path(File.join(File.dirname(__FILE__),'cell'))
4
- # require File.expand_path(File.join(File.dirname(__FILE__),'color'))
5
- require 'rubygems'
6
- require 'nokogiri'
7
-
8
- module RubyXL
9
- module Writer
10
- class SharedStringsWriter
11
- attr_accessor :dirpath, :filepath, :workbook
12
-
13
- def initialize(dirpath,wb)
14
- @dirpath = dirpath
15
- @workbook = wb
16
- @filepath = dirpath + '/xl/sharedStrings.xml'
17
- end
18
-
19
- def write()
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
26
- contents
27
- end
28
- end
29
- end
30
- end
@@ -1,59 +0,0 @@
1
- # require File.expand_path(File.join(File.dirname(__FILE__),'workbook'))
2
- # require File.expand_path(File.join(File.dirname(__FILE__),'worksheet'))
3
- # require File.expand_path(File.join(File.dirname(__FILE__),'cell'))
4
- # require File.expand_path(File.join(File.dirname(__FILE__),'color'))
5
- require 'rubygems'
6
- require 'nokogiri'
7
-
8
- module RubyXL
9
- module Writer
10
- class WorkbookRelsWriter
11
- attr_accessor :dirpath, :filepath, :workbook
12
-
13
- def initialize(dirpath, wb)
14
- @dirpath = dirpath
15
- @workbook = wb
16
- end
17
-
18
- #all attributes out of order
19
- def write()
20
- builder = Nokogiri::XML::Builder.new do |xml|
21
- xml.Relationships('xmlns'=>'http://schemas.openxmlformats.org/package/2006/relationships') {
22
- i = 1
23
- @workbook.worksheets.each do |sheet|
24
- xml.Relationship('Id'=>'rId'+i.to_s,
25
- 'Type'=>"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",
26
- 'Target'=>'worksheets/sheet'+i.to_s+'.xml')
27
- i += 1
28
- end
29
- unless @workbook.external_links.nil?
30
- 1.upto(@workbook.external_links.size-1) do |link|
31
- xml.Relationship('Id'=>'rId'+i.to_s,
32
- 'Type'=>"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink",
33
- 'Target'=>"externalLinks/externalLink#{link}.xml"
34
- )
35
- i+=1
36
- end
37
- end
38
- xml.Relationship('Id'=>'rId'+i.to_s,
39
- 'Type'=>"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
40
- 'Target'=>'theme/theme1.xml')
41
- i += 1
42
- xml.Relationship('Id'=>'rId'+i.to_s,
43
- 'Type'=>"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",
44
- 'Target'=>'styles.xml')
45
- i+=1
46
- xml.Relationship('Id'=>'rId'+i.to_s,
47
- 'Type'=>"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",
48
- 'Target'=>'sharedStrings.xml')
49
- }
50
- end
51
- contents = builder.to_xml
52
- contents = contents.gsub(/\n/,'')
53
- contents = contents.gsub(/>(\s)+</,'><')
54
- contents = contents.sub(/<\?xml version=\"1.0\"\?>/,'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n")
55
- contents
56
- end
57
- end
58
- end
59
- end