rubyXL 1.2.10 → 2.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.
- data/Gemfile +14 -10
- data/Gemfile.lock +80 -21
- data/LICENSE.txt +1 -1
- data/README.rdoc +88 -82
- data/Rakefile +7 -2
- data/VERSION +1 -1
- data/lib/rubyXL.rb +13 -7
- data/lib/rubyXL/cell.rb +108 -268
- data/lib/rubyXL/generic_storage.rb +40 -0
- data/lib/rubyXL/objects/border.rb +66 -0
- data/lib/rubyXL/objects/calculation_chain.rb +28 -0
- data/lib/rubyXL/objects/cell_style.rb +75 -0
- data/lib/rubyXL/objects/color.rb +25 -0
- data/lib/rubyXL/objects/column_range.rb +74 -0
- data/lib/rubyXL/objects/container_nodes.rb +122 -0
- data/lib/rubyXL/objects/data_validation.rb +43 -0
- data/lib/rubyXL/objects/document_properties.rb +76 -0
- data/lib/rubyXL/objects/extensions.rb +36 -0
- data/lib/rubyXL/objects/fill.rb +57 -0
- data/lib/rubyXL/objects/font.rb +111 -0
- data/lib/rubyXL/objects/formula.rb +24 -0
- data/lib/rubyXL/objects/ooxml_object.rb +295 -0
- data/lib/rubyXL/objects/reference.rb +110 -0
- data/lib/rubyXL/objects/relationships.rb +59 -0
- data/lib/rubyXL/objects/shared_strings.rb +57 -0
- data/lib/rubyXL/objects/sheet_data.rb +149 -0
- data/lib/rubyXL/objects/sheet_view.rb +71 -0
- data/lib/rubyXL/objects/stylesheet.rb +200 -0
- data/lib/rubyXL/objects/text.rb +87 -0
- data/lib/rubyXL/objects/theme.rb +64 -0
- data/lib/rubyXL/objects/workbook.rb +233 -0
- data/lib/rubyXL/objects/worksheet.rb +485 -0
- data/lib/rubyXL/parser.rb +78 -442
- data/lib/rubyXL/workbook.rb +216 -385
- data/lib/rubyXL/worksheet.rb +509 -1062
- data/lib/rubyXL/writer/content_types_writer.rb +104 -68
- data/lib/rubyXL/writer/core_writer.rb +26 -43
- data/lib/rubyXL/writer/generic_writer.rb +43 -0
- data/lib/rubyXL/writer/root_rels_writer.rb +11 -19
- data/lib/rubyXL/writer/styles_writer.rb +6 -398
- data/lib/rubyXL/writer/theme_writer.rb +321 -327
- data/lib/rubyXL/writer/workbook_writer.rb +63 -67
- data/lib/rubyXL/writer/worksheet_writer.rb +29 -218
- data/rdoc/created.rid +39 -0
- data/rdoc/fonts.css +167 -0
- data/rdoc/fonts/Lato-Light.ttf +0 -0
- data/rdoc/fonts/Lato-LightItalic.ttf +0 -0
- data/rdoc/fonts/Lato-Regular.ttf +0 -0
- data/rdoc/fonts/Lato-RegularItalic.ttf +0 -0
- data/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/rdoc/images/add.png +0 -0
- data/rdoc/images/arrow_up.png +0 -0
- data/rdoc/images/brick.png +0 -0
- data/rdoc/images/brick_link.png +0 -0
- data/rdoc/images/bug.png +0 -0
- data/rdoc/images/bullet_black.png +0 -0
- data/rdoc/images/bullet_toggle_minus.png +0 -0
- data/rdoc/images/bullet_toggle_plus.png +0 -0
- data/rdoc/images/date.png +0 -0
- data/rdoc/images/delete.png +0 -0
- data/rdoc/images/find.png +0 -0
- data/rdoc/images/loadingAnimation.gif +0 -0
- data/rdoc/images/macFFBgHack.png +0 -0
- data/rdoc/images/package.png +0 -0
- data/rdoc/images/page_green.png +0 -0
- data/rdoc/images/page_white_text.png +0 -0
- data/rdoc/images/page_white_width.png +0 -0
- data/rdoc/images/plugin.png +0 -0
- data/rdoc/images/ruby.png +0 -0
- data/rdoc/images/tag_blue.png +0 -0
- data/rdoc/images/tag_green.png +0 -0
- data/rdoc/images/transparent.png +0 -0
- data/rdoc/images/wrench.png +0 -0
- data/rdoc/images/wrench_orange.png +0 -0
- data/rdoc/images/zoom.png +0 -0
- data/rdoc/js/darkfish.js +140 -0
- data/rdoc/js/jquery.js +18 -0
- data/rdoc/js/navigation.js +142 -0
- data/rdoc/js/search.js +109 -0
- data/rdoc/js/search_index.js +1 -0
- data/rdoc/js/searcher.js +228 -0
- data/rdoc/rdoc.css +580 -0
- data/rubyXL.gemspec +90 -34
- data/spec/lib/cell_spec.rb +29 -59
- data/spec/lib/parser_spec.rb +35 -19
- data/spec/lib/reference_spec.rb +29 -0
- data/spec/lib/stylesheet_spec.rb +29 -0
- data/spec/lib/workbook_spec.rb +22 -17
- data/spec/lib/worksheet_spec.rb +47 -202
- metadata +185 -148
- data/lib/.DS_Store +0 -0
- data/lib/rubyXL/Hash.rb +0 -60
- data/lib/rubyXL/color.rb +0 -14
- data/lib/rubyXL/private_class.rb +0 -265
- data/lib/rubyXL/writer/app_writer.rb +0 -62
- data/lib/rubyXL/writer/calc_chain_writer.rb +0 -33
- data/lib/rubyXL/writer/shared_strings_writer.rb +0 -30
- data/lib/rubyXL/writer/workbook_rels_writer.rb +0 -59
- data/lib/rubyXL/zip.rb +0 -20
- data/spec/lib/hash_spec.rb +0 -28
|
@@ -1,77 +1,73 @@
|
|
|
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
1
|
module RubyXL
|
|
9
|
-
module Writer
|
|
10
|
-
|
|
11
|
-
attr_accessor :dirpath, :filepath, :workbook
|
|
2
|
+
module Writer
|
|
3
|
+
class WorkbookWriter < GenericWriter
|
|
12
4
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@filepath = dirpath + '/xl/workbook.xml'
|
|
17
|
-
end
|
|
5
|
+
def filepath
|
|
6
|
+
File.join('xl', 'workbook.xml')
|
|
7
|
+
end
|
|
18
8
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
xml.
|
|
34
|
-
'
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
9
|
+
def write()
|
|
10
|
+
new_xml = render_xml do |xml|
|
|
11
|
+
xml << (xml.create_element('workbook',
|
|
12
|
+
:xmlns => 'http://schemas.openxmlformats.org/spreadsheetml/2006/main',
|
|
13
|
+
'xmlns:r' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships') { |root|
|
|
14
|
+
root << xml.create_element('fileVersion', { :appName => 'xl', :lastEdited => 4,
|
|
15
|
+
:lowestEdited => 4, :rupBuild => 4505 })
|
|
16
|
+
|
|
17
|
+
params = { :showInkAnnotation => 0, :autoCompressPictures => 0 }
|
|
18
|
+
|
|
19
|
+
#TODO following line - date 1904? check if mac only
|
|
20
|
+
params[:date1904] = 1 if @workbook.date1904
|
|
21
|
+
root << xml.create_element('workbookPr', params)
|
|
22
|
+
|
|
23
|
+
root << (xml.create_element('bookViews') { |views|
|
|
24
|
+
views << xml.create_element('workbookView', { :xWindow => -20, :yWindow => -20,
|
|
25
|
+
:windowWidth => 21600, :windowHeight => 13340, :tabRatio => 500 })
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
index = 1
|
|
29
|
+
root << (xml.create_element('sheets') { |sheet_xml|
|
|
30
|
+
@workbook.worksheets.each_with_index { |sheet, i|
|
|
31
|
+
sheet_xml << xml.create_element('sheet', { :name => sheet.sheet_name,
|
|
32
|
+
:sheetId => sheet.sheet_id || index,
|
|
33
|
+
'r:id'=> "rId#{index}" })
|
|
34
|
+
index += 1
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
unless @workbook.external_links.empty?
|
|
39
|
+
|
|
40
|
+
root << (xml.create_element('externalReferences') { |refs|
|
|
41
|
+
# Need to correlate these with WorkbookRelsWriter
|
|
42
|
+
@workbook.external_links.each_value {
|
|
43
|
+
refs << xml.create_element('externalReference', { 'r:id' => "rId#{index}" })
|
|
44
|
+
index += 1
|
|
45
|
+
}
|
|
46
|
+
})
|
|
42
47
|
end
|
|
43
|
-
}
|
|
44
|
-
unless @workbook.external_links.nil?
|
|
45
|
-
xml.externalReferences {
|
|
46
|
-
index.upto(@workbook.external_links.size-1) do |id|
|
|
47
|
-
xml.externalReference('r:id'=>"rId#{id+index}")
|
|
48
|
-
end
|
|
49
|
-
}
|
|
50
|
-
end
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
if @workbook.defined_name_container && !@workbook.defined_name_container.defined_names.empty? then
|
|
50
|
+
root << xml.create_element('definedNames') { |names|
|
|
51
|
+
@workbook.defined_name_container.defined_names.each { |name| names << name.write_xml(xml) }
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
#TODO see if this changes with formulas
|
|
56
|
+
#attributes out of order here
|
|
57
|
+
root << xml.create_element('calcPr', { :calcId => 130407, :concurrentCalc => 0 } )
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
59
|
+
root << (xml.create_element('extLst') { |list|
|
|
60
|
+
list << (xml.create_element('ext', {
|
|
61
|
+
'xmlns:mx' => 'http://schemas.microsoft.com/office/mac/excel/2008/main',
|
|
62
|
+
:uri => 'http://schemas.microsoft.com/office/mac/excel/2008/main'}) { |ext|
|
|
63
|
+
ext << xml.create_element('mx:ArchID', { :Flags => 2 })
|
|
64
|
+
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
end
|
|
67
69
|
end
|
|
68
|
-
|
|
69
|
-
contents = contents.gsub(/\n/,'')
|
|
70
|
-
contents = contents.gsub(/>(\s)+</,'><')
|
|
71
|
-
contents = contents.gsub(/<!\[CDATA\[(.*)\]\]>/,'\1')
|
|
72
|
-
contents = contents.sub(/<\?xml version=\"1.0\"\?>/,'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n")
|
|
73
|
-
contents
|
|
70
|
+
|
|
74
71
|
end
|
|
75
72
|
end
|
|
76
73
|
end
|
|
77
|
-
end
|
|
@@ -1,230 +1,41 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'nokogiri'
|
|
3
|
-
|
|
4
1
|
module RubyXL
|
|
5
2
|
module Writer
|
|
6
|
-
class WorksheetWriter
|
|
7
|
-
attr_accessor :dirpath, :filepath, :sheet_num, :workbook, :worksheet
|
|
3
|
+
class WorksheetWriter < GenericWriter
|
|
8
4
|
|
|
9
|
-
def initialize(
|
|
10
|
-
@
|
|
11
|
-
@
|
|
12
|
-
@
|
|
13
|
-
@worksheet = @workbook.worksheets[@sheet_num]
|
|
14
|
-
@filepath = dirpath + '/xl/worksheets/sheet'+(sheet_num+1).to_s()+'.xml'
|
|
5
|
+
def initialize(workbook, sheet_index = 0)
|
|
6
|
+
@workbook = workbook
|
|
7
|
+
@sheet_index = sheet_index
|
|
8
|
+
@worksheet = @workbook.worksheets[@sheet_index]
|
|
15
9
|
end
|
|
16
10
|
|
|
17
|
-
def
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
'xmlns:r'=>"http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
21
|
-
'xmlns:mc'=>"http://schemas.openxmlformats.org/markup-compatibility/2006",
|
|
22
|
-
'xmlns:mv'=>"urn:schemas-microsoft-com:mac:vml",
|
|
23
|
-
'mc:Ignorable'=>'mv',
|
|
24
|
-
'mc:PreserveAttributes'=>'mv:*') {
|
|
25
|
-
col = 0
|
|
26
|
-
@worksheet.sheet_data.each do |row|
|
|
27
|
-
if row.size > col
|
|
28
|
-
col = row.size
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
row = Integer(@worksheet.sheet_data.size)
|
|
32
|
-
dimension = 'A1:'
|
|
33
|
-
dimension += Cell.convert_to_cell(row-1,col-1)
|
|
34
|
-
xml.dimension('ref'=>dimension)
|
|
35
|
-
xml.sheetViews {
|
|
36
|
-
view = @worksheet.sheet_view
|
|
37
|
-
if view.nil? || view[:attributes].nil?
|
|
38
|
-
xml.sheetView('tabSelected'=>1,'view'=>'normalLayout','workbookViewId'=>0)
|
|
39
|
-
raise 'end test' #TODO remove
|
|
40
|
-
else
|
|
41
|
-
view = view[:attributes]
|
|
42
|
-
if view[:view].nil?
|
|
43
|
-
view[:view] = 'normalLayout'
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
if view[:workbookViewId].nil?
|
|
47
|
-
view[:workbookViewId] = 0
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
if view[:zoomScale].nil? || view[:zoomScaleNormal].nil?
|
|
51
|
-
view[:zoomScale] = 100
|
|
52
|
-
view[:zoomScaleNormal] = 100
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
if view[:tabSelected].nil?
|
|
56
|
-
view[:tabSelected] = 1
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
xml.sheetView('tabSelected'=>view[:tabSelected],
|
|
60
|
-
'view'=>view[:view],
|
|
61
|
-
'workbookViewId'=>view[:workbookViewId],
|
|
62
|
-
'zoomScale'=>view[:zoomScale],
|
|
63
|
-
'zoomScaleNormal'=>view[:zoomScaleNormal]) {
|
|
64
|
-
#TODO
|
|
65
|
-
#can't be done unless I figure out a way to programmatically add attributes.
|
|
66
|
-
#(can't put xSplit with an invalid value)
|
|
67
|
-
# unless @worksheet.pane.nil?
|
|
68
|
-
# xml.pane('state'=>@worksheet.pane[:state])
|
|
69
|
-
# end
|
|
70
|
-
# unless view[:selection].nil?
|
|
71
|
-
# xml.
|
|
72
|
-
# end
|
|
73
|
-
}
|
|
74
|
-
end
|
|
75
|
-
}
|
|
76
|
-
xml.sheetFormatPr('baseColWidth'=>'10','defaultRowHeight'=>'13')
|
|
77
|
-
|
|
78
|
-
unless @worksheet.cols.nil? || @worksheet.cols.size==0
|
|
79
|
-
xml.cols {
|
|
80
|
-
if !@worksheet.cols.is_a?(Array)
|
|
81
|
-
@worksheet.cols = [@worksheet.cols]
|
|
82
|
-
end
|
|
83
|
-
@worksheet.cols.each do |col|
|
|
84
|
-
if col[:attributes][:customWidth].nil?
|
|
85
|
-
col[:attributes][:customWidth] = '0'
|
|
86
|
-
end
|
|
87
|
-
if col[:attributes][:width].nil?
|
|
88
|
-
col[:attributes][:width] = '10'
|
|
89
|
-
col[:attributes][:customWidth] = '0'
|
|
90
|
-
end
|
|
91
|
-
# unless col[:attributes] == {}
|
|
92
|
-
xml.col('style'=>@workbook.style_corrector[col[:attributes][:style].to_s].to_s,
|
|
93
|
-
'min'=>col[:attributes][:min].to_s,
|
|
94
|
-
'max'=>col[:attributes][:max].to_s,
|
|
95
|
-
'width'=>col[:attributes][:width].to_s,
|
|
96
|
-
'customWidth'=>col[:attributes][:customWidth].to_s)
|
|
97
|
-
# end
|
|
98
|
-
end
|
|
99
|
-
}
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
xml.sheetData {
|
|
103
|
-
i=0
|
|
104
|
-
@worksheet.sheet_data.each_with_index do |row,i|
|
|
105
|
-
#TODO fix this spans thing. could be 2:3 (not necessary)
|
|
106
|
-
if @worksheet.row_styles[(i+1).to_s].nil?
|
|
107
|
-
@worksheet.row_styles[(i+1).to_s] = {}
|
|
108
|
-
@worksheet.row_styles[(i+1).to_s][:style] = '0'
|
|
109
|
-
end
|
|
110
|
-
custom_format = '1'
|
|
111
|
-
if @worksheet.row_styles[(i+1).to_s][:style] == '0'
|
|
112
|
-
custom_format = '0'
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
@worksheet.row_styles[(i+1).to_s][:style] = @workbook.style_corrector[@worksheet.row_styles[(i+1).to_s][:style].to_s]
|
|
116
|
-
row_opts = {
|
|
117
|
-
'r'=>(i+1).to_s,
|
|
118
|
-
'spans'=>'1:'+row.size.to_s,
|
|
119
|
-
'customFormat'=>custom_format
|
|
120
|
-
}
|
|
121
|
-
unless @worksheet.row_styles[(i+1).to_s][:style].to_s == ''
|
|
122
|
-
row_opts['s'] = @worksheet.row_styles[(i+1).to_s][:style].to_s
|
|
123
|
-
end
|
|
124
|
-
unless @worksheet.row_styles[(i+1).to_s][:height].to_s == ''
|
|
125
|
-
row_opts['ht'] = @worksheet.row_styles[(i+1).to_s][:height].to_s
|
|
126
|
-
end
|
|
127
|
-
unless @worksheet.row_styles[(i+1).to_s][:customheight].to_s == ''
|
|
128
|
-
row_opts['customHeight'] = @worksheet.row_styles[(i+1).to_s][:customHeight].to_s
|
|
129
|
-
end
|
|
130
|
-
xml.row(row_opts) {
|
|
131
|
-
row.each_with_index do |dat, j|
|
|
132
|
-
unless dat.nil?
|
|
133
|
-
#TODO do xml.c for all cases, inside specific.
|
|
134
|
-
# if dat.formula.nil?
|
|
135
|
-
dat.style_index = @workbook.style_corrector[dat.style_index.to_s]
|
|
136
|
-
c_opts = {'r'=>Cell.convert_to_cell(i,j), 's'=>dat.style_index.to_s}
|
|
137
|
-
unless dat.datatype.nil? || dat.datatype == ''
|
|
138
|
-
c_opts['t'] = dat.datatype
|
|
139
|
-
end
|
|
140
|
-
xml.c(c_opts) {
|
|
141
|
-
unless dat.formula.nil?
|
|
142
|
-
if dat.formula_attributes.nil? || dat.formula_attributes.empty?
|
|
143
|
-
xml.f dat.formula.to_s
|
|
144
|
-
else
|
|
145
|
-
xml.f('t'=>dat.formula_attributes['t'].to_s, 'ref'=>dat.formula_attributes['ref'], 'si'=>dat.formula_attributes['si']).nokogiri dat.formula
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
if(dat.datatype == 's')
|
|
149
|
-
unless dat.value.nil? #empty cell, but has a style
|
|
150
|
-
xml.v @workbook.shared_strings[dat.value].to_s
|
|
151
|
-
end
|
|
152
|
-
elsif(dat.datatype == 'str')
|
|
153
|
-
xml.v dat.value.to_s
|
|
154
|
-
elsif(dat.datatype == '') #number
|
|
155
|
-
xml.v dat.value.to_s
|
|
156
|
-
end
|
|
157
|
-
}
|
|
158
|
-
#
|
|
159
|
-
# else
|
|
160
|
-
# xml.c('r'=>Cell.convert_to_cell(i,j)) {
|
|
161
|
-
# xml.v dat.value.to_s
|
|
162
|
-
# }
|
|
163
|
-
# end #data.formula.nil?
|
|
164
|
-
end #unless dat.nil?
|
|
165
|
-
end #row.each_with_index
|
|
166
|
-
}
|
|
167
|
-
end
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
xml.sheetCalcPr('fullCalcOnLoad'=>'1')
|
|
172
|
-
|
|
173
|
-
unless @worksheet.merged_cells.nil? || @worksheet.merged_cells.size==0
|
|
174
|
-
#There is some kind of bug here that when merged_cells is sometimes a hash and not an array
|
|
175
|
-
#initial attempt at a fix fails in corrupted excel documents leaving as is for now.
|
|
176
|
-
xml.mergeCells {
|
|
177
|
-
@worksheet.merged_cells.each do |merged_cell|
|
|
178
|
-
xml.mergeCell('ref'=>merged_cell[:attributes][:ref].to_s)
|
|
179
|
-
end
|
|
180
|
-
}
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
xml.phoneticPr('fontId'=>'1','type'=>'noConversion')
|
|
184
|
-
|
|
185
|
-
unless @worksheet.validations.nil?
|
|
186
|
-
xml.dataValidations('count'=>@worksheet.validations.size.to_s) {
|
|
187
|
-
@worksheet.validations.each do |validation|
|
|
188
|
-
xml.dataValidation('type'=>validation[:attributes][:type],
|
|
189
|
-
'sqref'=>validation[:attributes][:sqref],
|
|
190
|
-
'allowBlank'=>Integer(validation[:attributes][:allowBlank]).to_s,
|
|
191
|
-
'showInputMessage'=>Integer(validation[:attributes][:showInputMessage]).to_s,
|
|
192
|
-
'showErrorMessage'=>Integer(validation[:attributes][:showErrorMessage]).to_s) {
|
|
193
|
-
unless validation[:formula1].nil?
|
|
194
|
-
xml.formula1 validation[:formula1]
|
|
195
|
-
end
|
|
196
|
-
}
|
|
197
|
-
end
|
|
198
|
-
}
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
xml.pageMargins('left'=>'0.75','right'=>'0.75','top'=>'1',
|
|
202
|
-
'bottom'=>'1','header'=>'0.5','footer'=>'0.5')
|
|
11
|
+
def filepath
|
|
12
|
+
File.join('xl', 'worksheets', "sheet#{@sheet_index + 1}.xml")
|
|
13
|
+
end
|
|
203
14
|
|
|
204
|
-
|
|
205
|
-
|
|
15
|
+
def ooxml_object
|
|
16
|
+
@worksheet
|
|
17
|
+
end
|
|
206
18
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
19
|
+
=begin
|
|
20
|
+
root << xml.create_element('sheetFormatPr', { :baseColWidth => 10, :defaultRowHeight => 13 })
|
|
21
|
+
root << xml.create_element('sheetCalcPr', { :fullCalcOnLoad => 1 })
|
|
22
|
+
root << xml.create_element('pageMargins', { :left => 0.75, :right => 0.75, :top => 1, :bottom => 1,
|
|
23
|
+
:header => 0.5, :footer => 0.5 })
|
|
24
|
+
root << xml.create_element('pageSetup', { :orientation => 'portrait',
|
|
25
|
+
:horizontalDpi => 4294967292, :verticalDpi => 4294967292 })
|
|
210
26
|
|
|
211
27
|
unless @worksheet.extLst.nil?
|
|
212
|
-
xml.extLst {
|
|
213
|
-
xml.
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
28
|
+
root << (xml.create_element('extLst') { |extlst|
|
|
29
|
+
extlst << (xml.create_element('ext', {
|
|
30
|
+
'xmlns:mx' => 'http://schemas.microsoft.com/office/mac/excel/2008/main',
|
|
31
|
+
'uri' => 'http://schemas.microsoft.com/office/mac/excel/2008/main' }) { |ext|
|
|
32
|
+
ext << xml.create_element('mx:PLV', { :Mode => 1, :OnePage => 0, :WScale => 0 })
|
|
33
|
+
})
|
|
34
|
+
})
|
|
218
35
|
end
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
contents = contents.gsub(/\n/,'')
|
|
223
|
-
contents = contents.gsub(/>(\s)+</,'><')
|
|
224
|
-
contents = contents.sub(/<\?xml version=\"1.0\"\?>/,'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n")
|
|
225
|
-
contents
|
|
226
|
-
end
|
|
36
|
+
=end
|
|
37
|
+
|
|
38
|
+
end # class
|
|
227
39
|
|
|
228
|
-
end
|
|
229
|
-
end
|
|
230
40
|
end
|
|
41
|
+
end
|
data/rdoc/created.rid
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Fri, 07 Feb 2014 01:35:58 +0000
|
|
2
|
+
README.rdoc Fri, 07 Feb 2014 00:46:48 +0000
|
|
3
|
+
lib/rubyXL.rb Thu, 06 Feb 2014 21:53:31 +0000
|
|
4
|
+
lib/rubyXL/cell.rb Wed, 05 Feb 2014 20:52:23 +0000
|
|
5
|
+
lib/rubyXL/generic_storage.rb Sat, 14 Dec 2013 00:24:20 +0000
|
|
6
|
+
lib/rubyXL/objects/border.rb Fri, 07 Feb 2014 00:37:47 +0000
|
|
7
|
+
lib/rubyXL/objects/calculation_chain.rb Tue, 04 Feb 2014 23:41:39 +0000
|
|
8
|
+
lib/rubyXL/objects/cell_style.rb Wed, 29 Jan 2014 22:24:05 +0000
|
|
9
|
+
lib/rubyXL/objects/color.rb Wed, 29 Jan 2014 22:24:07 +0000
|
|
10
|
+
lib/rubyXL/objects/column_range.rb Wed, 29 Jan 2014 22:24:09 +0000
|
|
11
|
+
lib/rubyXL/objects/container_nodes.rb Tue, 04 Feb 2014 01:21:17 +0000
|
|
12
|
+
lib/rubyXL/objects/data_validation.rb Thu, 30 Jan 2014 23:08:07 +0000
|
|
13
|
+
lib/rubyXL/objects/document_properties.rb Tue, 04 Feb 2014 21:29:05 +0000
|
|
14
|
+
lib/rubyXL/objects/extensions.rb Mon, 03 Feb 2014 23:35:23 +0000
|
|
15
|
+
lib/rubyXL/objects/fill.rb Wed, 29 Jan 2014 22:24:15 +0000
|
|
16
|
+
lib/rubyXL/objects/font.rb Thu, 30 Jan 2014 23:44:34 +0000
|
|
17
|
+
lib/rubyXL/objects/formula.rb Thu, 30 Jan 2014 23:08:14 +0000
|
|
18
|
+
lib/rubyXL/objects/ooxml_object.rb Fri, 07 Feb 2014 01:35:27 +0000
|
|
19
|
+
lib/rubyXL/objects/reference.rb Wed, 29 Jan 2014 22:24:26 +0000
|
|
20
|
+
lib/rubyXL/objects/relationships.rb Tue, 04 Feb 2014 23:52:30 +0000
|
|
21
|
+
lib/rubyXL/objects/shared_strings.rb Tue, 04 Feb 2014 21:34:11 +0000
|
|
22
|
+
lib/rubyXL/objects/sheet_data.rb Thu, 06 Feb 2014 23:07:20 +0000
|
|
23
|
+
lib/rubyXL/objects/sheet_view.rb Wed, 05 Feb 2014 19:39:10 +0000
|
|
24
|
+
lib/rubyXL/objects/stylesheet.rb Wed, 05 Feb 2014 20:56:22 +0000
|
|
25
|
+
lib/rubyXL/objects/text.rb Thu, 30 Jan 2014 03:47:55 +0000
|
|
26
|
+
lib/rubyXL/objects/theme.rb Wed, 29 Jan 2014 22:25:25 +0000
|
|
27
|
+
lib/rubyXL/objects/workbook.rb Tue, 04 Feb 2014 01:34:19 +0000
|
|
28
|
+
lib/rubyXL/objects/worksheet.rb Thu, 30 Jan 2014 23:39:15 +0000
|
|
29
|
+
lib/rubyXL/parser.rb Thu, 06 Feb 2014 22:25:56 +0000
|
|
30
|
+
lib/rubyXL/workbook.rb Thu, 06 Feb 2014 22:26:47 +0000
|
|
31
|
+
lib/rubyXL/worksheet.rb Fri, 07 Feb 2014 00:25:25 +0000
|
|
32
|
+
lib/rubyXL/writer/content_types_writer.rb Thu, 30 Jan 2014 01:47:57 +0000
|
|
33
|
+
lib/rubyXL/writer/core_writer.rb Tue, 14 Jan 2014 23:50:12 +0000
|
|
34
|
+
lib/rubyXL/writer/generic_writer.rb Tue, 04 Feb 2014 21:20:48 +0000
|
|
35
|
+
lib/rubyXL/writer/root_rels_writer.rb Tue, 14 Jan 2014 23:50:12 +0000
|
|
36
|
+
lib/rubyXL/writer/styles_writer.rb Thu, 30 Jan 2014 21:17:08 +0000
|
|
37
|
+
lib/rubyXL/writer/theme_writer.rb Tue, 14 Jan 2014 23:50:12 +0000
|
|
38
|
+
lib/rubyXL/writer/workbook_writer.rb Wed, 29 Jan 2014 01:01:31 +0000
|
|
39
|
+
lib/rubyXL/writer/worksheet_writer.rb Thu, 30 Jan 2014 21:15:31 +0000
|
data/rdoc/fonts.css
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/),
|
|
3
|
+
* with Reserved Font Name "Source". All Rights Reserved. Source is a
|
|
4
|
+
* trademark of Adobe Systems Incorporated in the United States and/or other
|
|
5
|
+
* countries.
|
|
6
|
+
*
|
|
7
|
+
* This Font Software is licensed under the SIL Open Font License, Version
|
|
8
|
+
* 1.1.
|
|
9
|
+
*
|
|
10
|
+
* This license is copied below, and is also available with a FAQ at:
|
|
11
|
+
* http://scripts.sil.org/OFL
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
@font-face {
|
|
15
|
+
font-family: "Source Code Pro";
|
|
16
|
+
font-style: normal;
|
|
17
|
+
font-weight: 400;
|
|
18
|
+
src: local("Source Code Pro"),
|
|
19
|
+
local("SourceCodePro-Regular"),
|
|
20
|
+
url("fonts/SourceCodePro-Regular.ttf") format("truetype");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@font-face {
|
|
24
|
+
font-family: "Source Code Pro";
|
|
25
|
+
font-style: normal;
|
|
26
|
+
font-weight: 700;
|
|
27
|
+
src: local("Source Code Pro Bold"),
|
|
28
|
+
local("SourceCodePro-Bold"),
|
|
29
|
+
url("fonts/SourceCodePro-Bold.ttf") format("truetype");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* Copyright (c) 2010, Łukasz Dziedzic (dziedzic@typoland.com),
|
|
34
|
+
* with Reserved Font Name Lato.
|
|
35
|
+
*
|
|
36
|
+
* This Font Software is licensed under the SIL Open Font License, Version
|
|
37
|
+
* 1.1.
|
|
38
|
+
*
|
|
39
|
+
* This license is copied below, and is also available with a FAQ at:
|
|
40
|
+
* http://scripts.sil.org/OFL
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
@font-face {
|
|
44
|
+
font-family: "Lato";
|
|
45
|
+
font-style: normal;
|
|
46
|
+
font-weight: 300;
|
|
47
|
+
src: local("Lato Light"),
|
|
48
|
+
local("Lato-Light"),
|
|
49
|
+
url("fonts/Lato-Light.ttf") format("truetype");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@font-face {
|
|
53
|
+
font-family: "Lato";
|
|
54
|
+
font-style: italic;
|
|
55
|
+
font-weight: 300;
|
|
56
|
+
src: local("Lato Light Italic"),
|
|
57
|
+
local("Lato-LightItalic"),
|
|
58
|
+
url("fonts/Lato-LightItalic.ttf") format("truetype");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@font-face {
|
|
62
|
+
font-family: "Lato";
|
|
63
|
+
font-style: normal;
|
|
64
|
+
font-weight: 700;
|
|
65
|
+
src: local("Lato Regular"),
|
|
66
|
+
local("Lato-Regular"),
|
|
67
|
+
url("fonts/Lato-Regular.ttf") format("truetype");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@font-face {
|
|
71
|
+
font-family: "Lato";
|
|
72
|
+
font-style: italic;
|
|
73
|
+
font-weight: 700;
|
|
74
|
+
src: local("Lato Italic"),
|
|
75
|
+
local("Lato-Italic"),
|
|
76
|
+
url("fonts/Lato-RegularItalic.ttf") format("truetype");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/*
|
|
80
|
+
* -----------------------------------------------------------
|
|
81
|
+
* SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
82
|
+
* -----------------------------------------------------------
|
|
83
|
+
*
|
|
84
|
+
* PREAMBLE
|
|
85
|
+
* The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
86
|
+
* development of collaborative font projects, to support the font creation
|
|
87
|
+
* efforts of academic and linguistic communities, and to provide a free and
|
|
88
|
+
* open framework in which fonts may be shared and improved in partnership
|
|
89
|
+
* with others.
|
|
90
|
+
*
|
|
91
|
+
* The OFL allows the licensed fonts to be used, studied, modified and
|
|
92
|
+
* redistributed freely as long as they are not sold by themselves. The
|
|
93
|
+
* fonts, including any derivative works, can be bundled, embedded,
|
|
94
|
+
* redistributed and/or sold with any software provided that any reserved
|
|
95
|
+
* names are not used by derivative works. The fonts and derivatives,
|
|
96
|
+
* however, cannot be released under any other type of license. The
|
|
97
|
+
* requirement for fonts to remain under this license does not apply
|
|
98
|
+
* to any document created using the fonts or their derivatives.
|
|
99
|
+
*
|
|
100
|
+
* DEFINITIONS
|
|
101
|
+
* "Font Software" refers to the set of files released by the Copyright
|
|
102
|
+
* Holder(s) under this license and clearly marked as such. This may
|
|
103
|
+
* include source files, build scripts and documentation.
|
|
104
|
+
*
|
|
105
|
+
* "Reserved Font Name" refers to any names specified as such after the
|
|
106
|
+
* copyright statement(s).
|
|
107
|
+
*
|
|
108
|
+
* "Original Version" refers to the collection of Font Software components as
|
|
109
|
+
* distributed by the Copyright Holder(s).
|
|
110
|
+
*
|
|
111
|
+
* "Modified Version" refers to any derivative made by adding to, deleting,
|
|
112
|
+
* or substituting -- in part or in whole -- any of the components of the
|
|
113
|
+
* Original Version, by changing formats or by porting the Font Software to a
|
|
114
|
+
* new environment.
|
|
115
|
+
*
|
|
116
|
+
* "Author" refers to any designer, engineer, programmer, technical
|
|
117
|
+
* writer or other person who contributed to the Font Software.
|
|
118
|
+
*
|
|
119
|
+
* PERMISSION & CONDITIONS
|
|
120
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
121
|
+
* a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
122
|
+
* redistribute, and sell modified and unmodified copies of the Font
|
|
123
|
+
* Software, subject to the following conditions:
|
|
124
|
+
*
|
|
125
|
+
* 1) Neither the Font Software nor any of its individual components,
|
|
126
|
+
* in Original or Modified Versions, may be sold by itself.
|
|
127
|
+
*
|
|
128
|
+
* 2) Original or Modified Versions of the Font Software may be bundled,
|
|
129
|
+
* redistributed and/or sold with any software, provided that each copy
|
|
130
|
+
* contains the above copyright notice and this license. These can be
|
|
131
|
+
* included either as stand-alone text files, human-readable headers or
|
|
132
|
+
* in the appropriate machine-readable metadata fields within text or
|
|
133
|
+
* binary files as long as those fields can be easily viewed by the user.
|
|
134
|
+
*
|
|
135
|
+
* 3) No Modified Version of the Font Software may use the Reserved Font
|
|
136
|
+
* Name(s) unless explicit written permission is granted by the corresponding
|
|
137
|
+
* Copyright Holder. This restriction only applies to the primary font name as
|
|
138
|
+
* presented to the users.
|
|
139
|
+
*
|
|
140
|
+
* 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
141
|
+
* Software shall not be used to promote, endorse or advertise any
|
|
142
|
+
* Modified Version, except to acknowledge the contribution(s) of the
|
|
143
|
+
* Copyright Holder(s) and the Author(s) or with their explicit written
|
|
144
|
+
* permission.
|
|
145
|
+
*
|
|
146
|
+
* 5) The Font Software, modified or unmodified, in part or in whole,
|
|
147
|
+
* must be distributed entirely under this license, and must not be
|
|
148
|
+
* distributed under any other license. The requirement for fonts to
|
|
149
|
+
* remain under this license does not apply to any document created
|
|
150
|
+
* using the Font Software.
|
|
151
|
+
*
|
|
152
|
+
* TERMINATION
|
|
153
|
+
* This license becomes null and void if any of the above conditions are
|
|
154
|
+
* not met.
|
|
155
|
+
*
|
|
156
|
+
* DISCLAIMER
|
|
157
|
+
* THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
158
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
159
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
160
|
+
* OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
161
|
+
* COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
162
|
+
* INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
163
|
+
* DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
164
|
+
* FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
165
|
+
* OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
166
|
+
*/
|
|
167
|
+
|