oxcelix 0.3.3 → 0.4.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.
- checksums.yaml +7 -0
- data/.yardopts +3 -2
- data/CHANGES +10 -0
- data/LICENSE +20 -20
- data/README.md +79 -70
- data/README.rdoc +70 -62
- data/lib/oxcelix.rb +48 -47
- data/lib/oxcelix/cell.rb +22 -22
- data/lib/oxcelix/cellhelper.rb +48 -48
- data/lib/oxcelix/nf.rb +172 -172
- data/lib/oxcelix/numformats.rb +115 -114
- data/lib/oxcelix/sax/comments.rb +28 -28
- data/lib/oxcelix/sax/sharedstrings.rb +17 -17
- data/lib/oxcelix/sax/styles.rb +48 -48
- data/lib/oxcelix/sax/xlsheet.rb +136 -78
- data/lib/oxcelix/sheet.rb +96 -75
- data/lib/oxcelix/workbook.rb +393 -256
- data/oxcelix.gemspec +26 -26
- data/spec/cell_spec.rb +14 -13
- data/spec/fixnum_spec.rb +12 -11
- data/spec/helper.rb +10 -0
- data/spec/matrix_spec.rb +12 -11
- data/spec/oxcelix_spec.rb +37 -36
- data/spec/spec_helper.rb +3 -3
- data/spec/string_spec.rb +19 -19
- metadata +21 -25
data/lib/oxcelix/cell.rb
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
module Oxcelix
|
|
2
|
-
# Simple class representing an excel cell.
|
|
3
|
-
# @!attribute [rw] xlcoords
|
|
4
|
-
# @return [String] The Excel-style coordinates of the cell object
|
|
5
|
-
# @!attribute [rw] type
|
|
6
|
-
# @return [String] Cell content type
|
|
7
|
-
# @!attribute [rw] value
|
|
8
|
-
# @return [String] the type of the cell
|
|
9
|
-
# @!attribute [rw] comment
|
|
10
|
-
# @return [String] Comment text
|
|
11
|
-
# @!attribute [rw] style
|
|
12
|
-
# @return [String] Excel style attribute
|
|
13
|
-
# @!attribute [rw] numformat
|
|
14
|
-
# @return [String] Excel style number formatting
|
|
15
|
-
|
|
16
|
-
class Cell
|
|
17
|
-
attr_accessor :xlcoords, :type, :value, :comment, :style, :numformat
|
|
18
|
-
include Cellhelper
|
|
19
|
-
include Cellvalues
|
|
20
|
-
include Numberhelper
|
|
21
|
-
end
|
|
22
|
-
end
|
|
1
|
+
module Oxcelix
|
|
2
|
+
# Simple class representing an excel cell.
|
|
3
|
+
# @!attribute [rw] xlcoords
|
|
4
|
+
# @return [String] The Excel-style coordinates of the cell object
|
|
5
|
+
# @!attribute [rw] type
|
|
6
|
+
# @return [String] Cell content type
|
|
7
|
+
# @!attribute [rw] value
|
|
8
|
+
# @return [String] the type of the cell
|
|
9
|
+
# @!attribute [rw] comment
|
|
10
|
+
# @return [String] Comment text
|
|
11
|
+
# @!attribute [rw] style
|
|
12
|
+
# @return [String] Excel style attribute
|
|
13
|
+
# @!attribute [rw] numformat
|
|
14
|
+
# @return [String] Excel style number formatting
|
|
15
|
+
|
|
16
|
+
class Cell
|
|
17
|
+
attr_accessor :xlcoords, :type, :value, :comment, :style, :numformat
|
|
18
|
+
include Cellhelper
|
|
19
|
+
include Cellvalues
|
|
20
|
+
include Numberhelper
|
|
21
|
+
end
|
|
22
|
+
end
|
data/lib/oxcelix/cellhelper.rb
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
module Oxcelix
|
|
2
|
-
|
|
3
|
-
# The Cellvalues module provides methods for setting cell values. They are named after the relevant XML entitiesd and
|
|
4
|
-
# called directly by the Xlsheet SAX parser.
|
|
5
|
-
module Cellvalues
|
|
6
|
-
# Set the excel cell name (eg: 'A2')
|
|
7
|
-
# @param [String] val Excel cell address name
|
|
8
|
-
def r(val); @xlcoords = val; end;
|
|
9
|
-
# Set cell type
|
|
10
|
-
def t(val); @type = val; end;
|
|
11
|
-
# Set cell value
|
|
12
|
-
def v(val); @value = val; end;
|
|
13
|
-
# Set cell style (number format and style)
|
|
14
|
-
def s(val); @style = val; end;
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# The Cellhelper module defines some methods useful to manipulate Cell objects
|
|
18
|
-
module Cellhelper
|
|
19
|
-
# When called without parameters, returns the x coordinate of the calling cell object based on the value of #@xlcoords
|
|
20
|
-
# If a parameter is given, #x will return the x coordinate corresponding to the parameter
|
|
21
|
-
# @example find x coordinate (column number) of a cell
|
|
22
|
-
# c = Cell.new
|
|
23
|
-
# c.xlcoords = ('B3')
|
|
24
|
-
# c.x #=> 1
|
|
25
|
-
# @param [String] coord Optional parameter used when method is not called from a Cell object
|
|
26
|
-
# @return [Integer] x coordinate
|
|
27
|
-
def x(coord=nil)
|
|
28
|
-
if coord.nil?
|
|
29
|
-
coord = @xlcoords
|
|
30
|
-
end
|
|
31
|
-
('A'..(coord.scan(/\p{Alpha}+|\p{Digit}+/u)[0])).to_a.length-1
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# When called without parameters, returns the y coordinate of the calling cell object based on the value of #@xlcoords
|
|
35
|
-
# If a parameter is given, #y will return the y coordinate corresponding to the parameter
|
|
36
|
-
# @example find y coordinate (row number) of a cell
|
|
37
|
-
# c = Cell.new
|
|
38
|
-
# c.xlcoords = ('B3')
|
|
39
|
-
# c.y #=> 2
|
|
40
|
-
# @param [String] coord Optional parameter used when method is not called from a Cell object
|
|
41
|
-
# @return [Integer] x coordinate
|
|
42
|
-
def y(coord=nil)
|
|
43
|
-
if coord.nil?
|
|
44
|
-
coord = @xlcoords
|
|
45
|
-
end
|
|
46
|
-
coord.scan(/\p{Alpha}+|\p{Digit}+/u)[1].to_i-1
|
|
47
|
-
end
|
|
48
|
-
end
|
|
1
|
+
module Oxcelix
|
|
2
|
+
|
|
3
|
+
# The Cellvalues module provides methods for setting cell values. They are named after the relevant XML entitiesd and
|
|
4
|
+
# called directly by the Xlsheet SAX parser.
|
|
5
|
+
module Cellvalues
|
|
6
|
+
# Set the excel cell name (eg: 'A2')
|
|
7
|
+
# @param [String] val Excel cell address name
|
|
8
|
+
def r(val); @xlcoords = val; end;
|
|
9
|
+
# Set cell type
|
|
10
|
+
def t(val); @type = val; end;
|
|
11
|
+
# Set cell value
|
|
12
|
+
def v(val); @value = val; end;
|
|
13
|
+
# Set cell style (number format and style)
|
|
14
|
+
def s(val); @style = val; end;
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The Cellhelper module defines some methods useful to manipulate Cell objects
|
|
18
|
+
module Cellhelper
|
|
19
|
+
# When called without parameters, returns the x coordinate of the calling cell object based on the value of #@xlcoords
|
|
20
|
+
# If a parameter is given, #x will return the x coordinate corresponding to the parameter
|
|
21
|
+
# @example find x coordinate (column number) of a cell
|
|
22
|
+
# c = Cell.new
|
|
23
|
+
# c.xlcoords = ('B3')
|
|
24
|
+
# c.x #=> 1
|
|
25
|
+
# @param [String] coord Optional parameter used when method is not called from a Cell object
|
|
26
|
+
# @return [Integer] x coordinate
|
|
27
|
+
def x(coord=nil)
|
|
28
|
+
if coord.nil?
|
|
29
|
+
coord = @xlcoords
|
|
30
|
+
end
|
|
31
|
+
('A'..(coord.scan(/\p{Alpha}+|\p{Digit}+/u)[0])).to_a.length-1
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# When called without parameters, returns the y coordinate of the calling cell object based on the value of #@xlcoords
|
|
35
|
+
# If a parameter is given, #y will return the y coordinate corresponding to the parameter
|
|
36
|
+
# @example find y coordinate (row number) of a cell
|
|
37
|
+
# c = Cell.new
|
|
38
|
+
# c.xlcoords = ('B3')
|
|
39
|
+
# c.y #=> 2
|
|
40
|
+
# @param [String] coord Optional parameter used when method is not called from a Cell object
|
|
41
|
+
# @return [Integer] x coordinate
|
|
42
|
+
def y(coord=nil)
|
|
43
|
+
if coord.nil?
|
|
44
|
+
coord = @xlcoords
|
|
45
|
+
end
|
|
46
|
+
coord.scan(/\p{Alpha}+|\p{Digit}+/u)[1].to_i-1
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
49
|
end
|
data/lib/oxcelix/nf.rb
CHANGED
|
@@ -1,172 +1,172 @@
|
|
|
1
|
-
module Oxcelix
|
|
2
|
-
module Numformats
|
|
3
|
-
# Formatarray is the array of default format strings in Excel. Nil values should apparently contain CJK date format strings,
|
|
4
|
-
#feel free to add/document those according to existing standards.
|
|
5
|
-
Formatarray = [
|
|
6
|
-
{:id => '0', :xl => 'General', :ostring => nil, :cls => 'string'},
|
|
7
|
-
{:id => '1', :xl => '0', :ostring => '%1d', :cls => 'numeric'},
|
|
8
|
-
{:id => '2', :xl => '0.00', :ostring => '%1.2f', :cls => 'numeric'},
|
|
9
|
-
{:id => '3', :xl => '#,##0', :ostring => '%#4d', :cls => 'numeric'},
|
|
10
|
-
{:id => '4', :xl => '#,##0.00', :ostring => '%#4.2f', :cls => 'numeric'},
|
|
11
|
-
{:id => '5', :xl => '', :ostring => nil, :cls => 'string'},
|
|
12
|
-
{:id => '6', :xl => '', :ostring => nil, :cls => 'string'},
|
|
13
|
-
{:id => '7', :xl => '', :ostring => nil, :cls => 'string'},
|
|
14
|
-
{:id => '8', :xl => '', :ostring => nil, :cls => 'string'},
|
|
15
|
-
{:id => '9', :xl => '0%', :ostring => '%1d%', :cls => 'numeric'},
|
|
16
|
-
{:id => '10', :xl => '0.00%', :ostring => '%1.2f%', :cls => 'numeric'},
|
|
17
|
-
{:id => '11', :xl => '0.00E+00', :ostring => '%1.2fE+', :cls => 'numeric'},
|
|
18
|
-
{:id => '12', :xl => '# ?/?', :ostring => '%#1d', :cls => 'rational'},
|
|
19
|
-
{:id => '13', :xl => '# ??/??', :ostring => '%#1d', :cls => 'rational'},
|
|
20
|
-
{:id => '14', :xl => 'd/m/yyyy', :ostring => '%-d/%-m/%Y', :cls => 'date'},
|
|
21
|
-
{:id => '15', :xl => 'd-mmm-yy', :ostring => '%-d-%b-%y', :cls => 'date'},
|
|
22
|
-
{:id => '16', :xl => 'd-mmm', :ostring => '%-d-%b', :cls => 'date'},
|
|
23
|
-
{:id => '17', :xl => 'mmm-yy', :ostring => '%b-%y', :cls => 'date'},
|
|
24
|
-
{:id => '18', :xl => 'h:mm tt', :ostring => '%-k:%M tt', :cls => 'date'},
|
|
25
|
-
{:id => '19', :xl => 'h:mm:ss tt', :ostring => '%-k:%M:%-S tt', :cls => 'date'},
|
|
26
|
-
{:id => '20', :xl => 'H:mm', :ostring => '%-k:%M', :cls => 'date'},
|
|
27
|
-
{:id => '21', :xl => 'H:mm:ss', :ostring => '%-k:%M:%-S', :cls => 'date'},
|
|
28
|
-
{:id => '22', :xl => 'm/d/yyyy H:mm', :ostring => '%-m/%-d/%Y %-k:%M', :cls => 'date'},
|
|
29
|
-
{:id => '23', :xl => '', :ostring => nil, :cls => 'string'},
|
|
30
|
-
{:id => '24', :xl => '', :ostring => nil, :cls => 'string'},
|
|
31
|
-
{:id => '25', :xl => '', :ostring => nil, :cls => 'string'},
|
|
32
|
-
{:id => '26', :xl => '', :ostring => nil, :cls => 'string'},
|
|
33
|
-
{:id => '27', :xl => '', :ostring => nil, :cls => 'string'},
|
|
34
|
-
{:id => '28', :xl => '', :ostring => nil, :cls => 'string'},
|
|
35
|
-
{:id => '29', :xl => '', :ostring => nil, :cls => 'string'},
|
|
36
|
-
{:id => '30', :xl => '', :ostring => nil, :cls => 'string'},
|
|
37
|
-
{:id => '31', :xl => '', :ostring => nil, :cls => 'string'},
|
|
38
|
-
{:id => '32', :xl => '', :ostring => nil, :cls => 'string'},
|
|
39
|
-
{:id => '33', :xl => '', :ostring => nil, :cls => 'string'},
|
|
40
|
-
{:id => '34', :xl => '', :ostring => nil, :cls => 'string'},
|
|
41
|
-
{:id => '35', :xl => '', :ostring => nil, :cls => 'string'},
|
|
42
|
-
{:id => '36', :xl => '', :ostring => nil, :cls => 'string'},
|
|
43
|
-
{:id => '37', :xl => '#,##0 ;(#,##0)', :ostring => '%#4d', :cls => 'numeric'},
|
|
44
|
-
{:id => '38', :xl => '#,##0 ;[Red](#,##0)', :ostring => '%#4d', :cls => 'numeric'},
|
|
45
|
-
{:id => '39', :xl => '#,##0.00;(#,##0.00)', :ostring => '%#4.2f', :cls => 'numeric'},
|
|
46
|
-
{:id => '40', :xl => '#,##0.00;[Red](#,##0.00)', :ostring => '%#4.2f', :cls => 'numeric'},
|
|
47
|
-
{:id => '41', :xl => '', :ostring => nil, :cls => 'string'},
|
|
48
|
-
{:id => '42', :xl => '', :ostring => nil, :cls => 'string'},
|
|
49
|
-
{:id => '43', :xl => '', :ostring => nil, :cls => 'string'},
|
|
50
|
-
{:id => '44', :xl => '', :ostring => nil, :cls => 'string'},
|
|
51
|
-
{:id => '45', :xl => 'mm:ss', :ostring => '%M:%-S', :cls => 'date'},
|
|
52
|
-
{:id => '46', :xl => '[h]:mm:ss', :ostring => '%-k:%M:%-S', :cls => 'date'},
|
|
53
|
-
{:id => '47', :xl => 'mmss.0', :ostring => '%M%-S.%1n', :cls => 'date'},
|
|
54
|
-
{:id => '48', :xl => '##0.0E+0', :ostring => '%#3.1E', :cls => 'numeric'},
|
|
55
|
-
{:id => '49', :xl => '@,', :ostring => '@%d', :cls => 'numeric'},
|
|
56
|
-
{:id => '50', :xl => '', :ostring => nil, :cls => 'string'},
|
|
57
|
-
{:id => '51', :xl => '', :ostring => nil, :cls => 'string'},
|
|
58
|
-
{:id => '52', :xl => '', :ostring => nil, :cls => 'string'},
|
|
59
|
-
{:id => '53', :xl => '', :ostring => nil, :cls => 'string'},
|
|
60
|
-
{:id => '54', :xl => '', :ostring => nil, :cls => 'string'},
|
|
61
|
-
{:id => '55', :xl => '', :ostring => nil, :cls => 'string'},
|
|
62
|
-
{:id => '56', :xl => '', :ostring => nil, :cls => 'string'},
|
|
63
|
-
{:id => '57', :xl => '', :ostring => nil, :cls => 'string'},
|
|
64
|
-
{:id => '58', :xl => '', :ostring => nil, :cls => 'string'},
|
|
65
|
-
{:id => '59', :xl => '', :ostring => nil, :cls => 'string'},
|
|
66
|
-
{:id => '60', :xl => '', :ostring => nil, :cls => 'string'},
|
|
67
|
-
{:id => '61', :xl => '', :ostring => nil, :cls => 'string'},
|
|
68
|
-
{:id => '62', :xl => '', :ostring => nil, :cls => 'string'},
|
|
69
|
-
{:id => '63', :xl => '', :ostring => nil, :cls => 'string'},
|
|
70
|
-
{:id => '64', :xl => '', :ostring => nil, :cls => 'string'},
|
|
71
|
-
{:id => '65', :xl => '', :ostring => nil, :cls => 'string'},
|
|
72
|
-
{:id => '66', :xl => '', :ostring => nil, :cls => 'string'},
|
|
73
|
-
{:id => '67', :xl => '', :ostring => nil, :cls => 'string'},
|
|
74
|
-
{:id => '68', :xl => '', :ostring => nil, :cls => 'string'},
|
|
75
|
-
{:id => '69', :xl => '', :ostring => nil, :cls => 'string'},
|
|
76
|
-
{:id => '70', :xl => '', :ostring => nil, :cls => 'string'},
|
|
77
|
-
{:id => '71', :xl => '', :ostring => nil, :cls => 'string'},
|
|
78
|
-
{:id => '72', :xl => '', :ostring => nil, :cls => 'string'},
|
|
79
|
-
{:id => '73', :xl => '', :ostring => nil, :cls => 'string'},
|
|
80
|
-
{:id => '74', :xl => '', :ostring => nil, :cls => 'string'},
|
|
81
|
-
{:id => '75', :xl => '', :ostring => nil, :cls => 'string'},
|
|
82
|
-
{:id => '76', :xl => '', :ostring => nil, :cls => 'string'},
|
|
83
|
-
{:id => '77', :xl => '', :ostring => nil, :cls => 'string'},
|
|
84
|
-
{:id => '78', :xl => '', :ostring => nil, :cls => 'string'},
|
|
85
|
-
{:id => '79', :xl => '', :ostring => nil, :cls => 'string'},
|
|
86
|
-
{:id => '80', :xl => '', :ostring => nil, :cls => 'string'},
|
|
87
|
-
{:id => '81', :xl => '', :ostring => nil, :cls => 'string'},
|
|
88
|
-
{:id => '82', :xl => '', :ostring => nil, :cls => 'string'},
|
|
89
|
-
{:id => '83', :xl => '', :ostring => nil, :cls => 'string'},
|
|
90
|
-
{:id => '84', :xl => '', :ostring => nil, :cls => 'string'},
|
|
91
|
-
{:id => '85', :xl => '', :ostring => nil, :cls => 'string'},
|
|
92
|
-
{:id => '86', :xl => '', :ostring => nil, :cls => 'string'},
|
|
93
|
-
{:id => '87', :xl => '', :ostring => nil, :cls => 'string'},
|
|
94
|
-
{:id => '88', :xl => '', :ostring => nil, :cls => 'string'},
|
|
95
|
-
{:id => '89', :xl => '', :ostring => nil, :cls => 'string'},
|
|
96
|
-
{:id => '90', :xl => '', :ostring => nil, :cls => 'string'},
|
|
97
|
-
{:id => '91', :xl => '', :ostring => nil, :cls => 'string'},
|
|
98
|
-
{:id => '92', :xl => '', :ostring => nil, :cls => 'string'},
|
|
99
|
-
{:id => '93', :xl => '', :ostring => nil, :cls => 'string'},
|
|
100
|
-
{:id => '94', :xl => '', :ostring => nil, :cls => 'string'},
|
|
101
|
-
{:id => '95', :xl => '', :ostring => nil, :cls => 'string'},
|
|
102
|
-
{:id => '96', :xl => '', :ostring => nil, :cls => 'string'},
|
|
103
|
-
{:id => '97', :xl => '', :ostring => nil, :cls => 'string'},
|
|
104
|
-
{:id => '98', :xl => '', :ostring => nil, :cls => 'string'},
|
|
105
|
-
{:id => '99', :xl => '', :ostring => nil, :cls => 'string'},
|
|
106
|
-
{:id => '100', :xl => '', :ostring => nil, :cls => 'string'},
|
|
107
|
-
{:id => '101', :xl => '', :ostring => nil, :cls => 'string'},
|
|
108
|
-
{:id => '102', :xl => '', :ostring => nil, :cls => 'string'},
|
|
109
|
-
{:id => '103', :xl => '', :ostring => nil, :cls => 'string'},
|
|
110
|
-
{:id => '104', :xl => '', :ostring => nil, :cls => 'string'},
|
|
111
|
-
{:id => '105', :xl => '', :ostring => nil, :cls => 'string'},
|
|
112
|
-
{:id => '106', :xl => '', :ostring => nil, :cls => 'string'},
|
|
113
|
-
{:id => '107', :xl => '', :ostring => nil, :cls => 'string'},
|
|
114
|
-
{:id => '108', :xl => '', :ostring => nil, :cls => 'string'},
|
|
115
|
-
{:id => '109', :xl => '', :ostring => nil, :cls => 'string'},
|
|
116
|
-
{:id => '110', :xl => '', :ostring => nil, :cls => 'string'},
|
|
117
|
-
{:id => '111', :xl => '', :ostring => nil, :cls => 'string'},
|
|
118
|
-
{:id => '112', :xl => '', :ostring => nil, :cls => 'string'},
|
|
119
|
-
{:id => '113', :xl => '', :ostring => nil, :cls => 'string'},
|
|
120
|
-
{:id => '114', :xl => '', :ostring => nil, :cls => 'string'},
|
|
121
|
-
{:id => '115', :xl => '', :ostring => nil, :cls => 'string'},
|
|
122
|
-
{:id => '116', :xl => '', :ostring => nil, :cls => 'string'},
|
|
123
|
-
{:id => '117', :xl => '', :ostring => nil, :cls => 'string'},
|
|
124
|
-
{:id => '118', :xl => '', :ostring => nil, :cls => 'string'},
|
|
125
|
-
{:id => '119', :xl => '', :ostring => nil, :cls => 'string'},
|
|
126
|
-
{:id => '120', :xl => '', :ostring => nil, :cls => 'string'},
|
|
127
|
-
{:id => '121', :xl => '', :ostring => nil, :cls => 'string'},
|
|
128
|
-
{:id => '122', :xl => '', :ostring => nil, :cls => 'string'},
|
|
129
|
-
{:id => '123', :xl => '', :ostring => nil, :cls => 'string'},
|
|
130
|
-
{:id => '124', :xl => '', :ostring => nil, :cls => 'string'},
|
|
131
|
-
{:id => '125', :xl => '', :ostring => nil, :cls => 'string'},
|
|
132
|
-
{:id => '126', :xl => '', :ostring => nil, :cls => 'string'},
|
|
133
|
-
{:id => '127', :xl => '', :ostring => nil, :cls => 'string'},
|
|
134
|
-
{:id => '128', :xl => '', :ostring => nil, :cls => 'string'},
|
|
135
|
-
{:id => '129', :xl => '', :ostring => nil, :cls => 'string'},
|
|
136
|
-
{:id => '130', :xl => '', :ostring => nil, :cls => 'string'},
|
|
137
|
-
{:id => '131', :xl => '', :ostring => nil, :cls => 'string'},
|
|
138
|
-
{:id => '132', :xl => '', :ostring => nil, :cls => 'string'},
|
|
139
|
-
{:id => '133', :xl => '', :ostring => nil, :cls => 'string'},
|
|
140
|
-
{:id => '134', :xl => '', :ostring => nil, :cls => 'string'},
|
|
141
|
-
{:id => '135', :xl => '', :ostring => nil, :cls => 'string'},
|
|
142
|
-
{:id => '136', :xl => '', :ostring => nil, :cls => 'string'},
|
|
143
|
-
{:id => '137', :xl => '', :ostring => nil, :cls => 'string'},
|
|
144
|
-
{:id => '138', :xl => '', :ostring => nil, :cls => 'string'},
|
|
145
|
-
{:id => '139', :xl => '', :ostring => nil, :cls => 'string'},
|
|
146
|
-
{:id => '140', :xl => '', :ostring => nil, :cls => 'string'},
|
|
147
|
-
{:id => '141', :xl => '', :ostring => nil, :cls => 'string'},
|
|
148
|
-
{:id => '142', :xl => '', :ostring => nil, :cls => 'string'},
|
|
149
|
-
{:id => '143', :xl => '', :ostring => nil, :cls => 'string'},
|
|
150
|
-
{:id => '144', :xl => '', :ostring => nil, :cls => 'string'},
|
|
151
|
-
{:id => '145', :xl => '', :ostring => nil, :cls => 'string'},
|
|
152
|
-
{:id => '146', :xl => '', :ostring => nil, :cls => 'string'},
|
|
153
|
-
{:id => '147', :xl => '', :ostring => nil, :cls => 'string'},
|
|
154
|
-
{:id => '148', :xl => '', :ostring => nil, :cls => 'string'},
|
|
155
|
-
{:id => '149', :xl => '', :ostring => nil, :cls => 'string'},
|
|
156
|
-
{:id => '150', :xl => '', :ostring => nil, :cls => 'string'},
|
|
157
|
-
{:id => '151', :xl => '', :ostring => nil, :cls => 'string'},
|
|
158
|
-
{:id => '152', :xl => '', :ostring => nil, :cls => 'string'},
|
|
159
|
-
{:id => '153', :xl => '', :ostring => nil, :cls => 'string'},
|
|
160
|
-
{:id => '154', :xl => '', :ostring => nil, :cls => 'string'},
|
|
161
|
-
{:id => '155', :xl => '', :ostring => nil, :cls => 'string'},
|
|
162
|
-
{:id => '156', :xl => '', :ostring => nil, :cls => 'string'},
|
|
163
|
-
{:id => '157', :xl => '', :ostring => nil, :cls => 'string'},
|
|
164
|
-
{:id => '158', :xl => '', :ostring => nil, :cls => 'string'},
|
|
165
|
-
{:id => '159', :xl => '', :ostring => nil, :cls => 'string'},
|
|
166
|
-
{:id => '160', :xl => '', :ostring => nil, :cls => 'string'},
|
|
167
|
-
{:id => '161', :xl => '', :ostring => nil, :cls => 'string'},
|
|
168
|
-
{:id => '162', :xl => '', :ostring => nil, :cls => 'string'},
|
|
169
|
-
{:id => '163', :xl => '', :ostring => nil, :cls => 'string'},
|
|
170
|
-
]
|
|
171
|
-
end
|
|
172
|
-
end
|
|
1
|
+
module Oxcelix
|
|
2
|
+
module Numformats
|
|
3
|
+
# Formatarray is the array of default format strings in Excel. Nil values should apparently contain CJK date format strings,
|
|
4
|
+
#feel free to add/document those according to existing standards.
|
|
5
|
+
Formatarray = [
|
|
6
|
+
{:id => '0', :xl => 'General', :ostring => nil, :cls => 'string'},
|
|
7
|
+
{:id => '1', :xl => '0', :ostring => '%1d', :cls => 'numeric'},
|
|
8
|
+
{:id => '2', :xl => '0.00', :ostring => '%1.2f', :cls => 'numeric'},
|
|
9
|
+
{:id => '3', :xl => '#,##0', :ostring => '%#4d', :cls => 'numeric'},
|
|
10
|
+
{:id => '4', :xl => '#,##0.00', :ostring => '%#4.2f', :cls => 'numeric'},
|
|
11
|
+
{:id => '5', :xl => '', :ostring => nil, :cls => 'string'},
|
|
12
|
+
{:id => '6', :xl => '', :ostring => nil, :cls => 'string'},
|
|
13
|
+
{:id => '7', :xl => '', :ostring => nil, :cls => 'string'},
|
|
14
|
+
{:id => '8', :xl => '', :ostring => nil, :cls => 'string'},
|
|
15
|
+
{:id => '9', :xl => '0%', :ostring => '%1d%', :cls => 'numeric'},
|
|
16
|
+
{:id => '10', :xl => '0.00%', :ostring => '%1.2f%', :cls => 'numeric'},
|
|
17
|
+
{:id => '11', :xl => '0.00E+00', :ostring => '%1.2fE+', :cls => 'numeric'},
|
|
18
|
+
{:id => '12', :xl => '# ?/?', :ostring => '%#1d', :cls => 'rational'},
|
|
19
|
+
{:id => '13', :xl => '# ??/??', :ostring => '%#1d', :cls => 'rational'},
|
|
20
|
+
{:id => '14', :xl => 'd/m/yyyy', :ostring => '%-d/%-m/%Y', :cls => 'date'},
|
|
21
|
+
{:id => '15', :xl => 'd-mmm-yy', :ostring => '%-d-%b-%y', :cls => 'date'},
|
|
22
|
+
{:id => '16', :xl => 'd-mmm', :ostring => '%-d-%b', :cls => 'date'},
|
|
23
|
+
{:id => '17', :xl => 'mmm-yy', :ostring => '%b-%y', :cls => 'date'},
|
|
24
|
+
{:id => '18', :xl => 'h:mm tt', :ostring => '%-k:%M tt', :cls => 'date'},
|
|
25
|
+
{:id => '19', :xl => 'h:mm:ss tt', :ostring => '%-k:%M:%-S tt', :cls => 'date'},
|
|
26
|
+
{:id => '20', :xl => 'H:mm', :ostring => '%-k:%M', :cls => 'date'},
|
|
27
|
+
{:id => '21', :xl => 'H:mm:ss', :ostring => '%-k:%M:%-S', :cls => 'date'},
|
|
28
|
+
{:id => '22', :xl => 'm/d/yyyy H:mm', :ostring => '%-m/%-d/%Y %-k:%M', :cls => 'date'},
|
|
29
|
+
{:id => '23', :xl => '', :ostring => nil, :cls => 'string'},
|
|
30
|
+
{:id => '24', :xl => '', :ostring => nil, :cls => 'string'},
|
|
31
|
+
{:id => '25', :xl => '', :ostring => nil, :cls => 'string'},
|
|
32
|
+
{:id => '26', :xl => '', :ostring => nil, :cls => 'string'},
|
|
33
|
+
{:id => '27', :xl => '', :ostring => nil, :cls => 'string'},
|
|
34
|
+
{:id => '28', :xl => '', :ostring => nil, :cls => 'string'},
|
|
35
|
+
{:id => '29', :xl => '', :ostring => nil, :cls => 'string'},
|
|
36
|
+
{:id => '30', :xl => '', :ostring => nil, :cls => 'string'},
|
|
37
|
+
{:id => '31', :xl => '', :ostring => nil, :cls => 'string'},
|
|
38
|
+
{:id => '32', :xl => '', :ostring => nil, :cls => 'string'},
|
|
39
|
+
{:id => '33', :xl => '', :ostring => nil, :cls => 'string'},
|
|
40
|
+
{:id => '34', :xl => '', :ostring => nil, :cls => 'string'},
|
|
41
|
+
{:id => '35', :xl => '', :ostring => nil, :cls => 'string'},
|
|
42
|
+
{:id => '36', :xl => '', :ostring => nil, :cls => 'string'},
|
|
43
|
+
{:id => '37', :xl => '#,##0 ;(#,##0)', :ostring => '%#4d', :cls => 'numeric'},
|
|
44
|
+
{:id => '38', :xl => '#,##0 ;[Red](#,##0)', :ostring => '%#4d', :cls => 'numeric'},
|
|
45
|
+
{:id => '39', :xl => '#,##0.00;(#,##0.00)', :ostring => '%#4.2f', :cls => 'numeric'},
|
|
46
|
+
{:id => '40', :xl => '#,##0.00;[Red](#,##0.00)', :ostring => '%#4.2f', :cls => 'numeric'},
|
|
47
|
+
{:id => '41', :xl => '', :ostring => nil, :cls => 'string'},
|
|
48
|
+
{:id => '42', :xl => '', :ostring => nil, :cls => 'string'},
|
|
49
|
+
{:id => '43', :xl => '', :ostring => nil, :cls => 'string'},
|
|
50
|
+
{:id => '44', :xl => '', :ostring => nil, :cls => 'string'},
|
|
51
|
+
{:id => '45', :xl => 'mm:ss', :ostring => '%M:%-S', :cls => 'date'},
|
|
52
|
+
{:id => '46', :xl => '[h]:mm:ss', :ostring => '%-k:%M:%-S', :cls => 'date'},
|
|
53
|
+
{:id => '47', :xl => 'mmss.0', :ostring => '%M%-S.%1n', :cls => 'date'},
|
|
54
|
+
{:id => '48', :xl => '##0.0E+0', :ostring => '%#3.1E', :cls => 'numeric'},
|
|
55
|
+
{:id => '49', :xl => '@,', :ostring => '@%d', :cls => 'numeric'},
|
|
56
|
+
{:id => '50', :xl => '', :ostring => nil, :cls => 'string'},
|
|
57
|
+
{:id => '51', :xl => '', :ostring => nil, :cls => 'string'},
|
|
58
|
+
{:id => '52', :xl => '', :ostring => nil, :cls => 'string'},
|
|
59
|
+
{:id => '53', :xl => '', :ostring => nil, :cls => 'string'},
|
|
60
|
+
{:id => '54', :xl => '', :ostring => nil, :cls => 'string'},
|
|
61
|
+
{:id => '55', :xl => '', :ostring => nil, :cls => 'string'},
|
|
62
|
+
{:id => '56', :xl => '', :ostring => nil, :cls => 'string'},
|
|
63
|
+
{:id => '57', :xl => '', :ostring => nil, :cls => 'string'},
|
|
64
|
+
{:id => '58', :xl => '', :ostring => nil, :cls => 'string'},
|
|
65
|
+
{:id => '59', :xl => '', :ostring => nil, :cls => 'string'},
|
|
66
|
+
{:id => '60', :xl => '', :ostring => nil, :cls => 'string'},
|
|
67
|
+
{:id => '61', :xl => '', :ostring => nil, :cls => 'string'},
|
|
68
|
+
{:id => '62', :xl => '', :ostring => nil, :cls => 'string'},
|
|
69
|
+
{:id => '63', :xl => '', :ostring => nil, :cls => 'string'},
|
|
70
|
+
{:id => '64', :xl => '', :ostring => nil, :cls => 'string'},
|
|
71
|
+
{:id => '65', :xl => '', :ostring => nil, :cls => 'string'},
|
|
72
|
+
{:id => '66', :xl => '', :ostring => nil, :cls => 'string'},
|
|
73
|
+
{:id => '67', :xl => '', :ostring => nil, :cls => 'string'},
|
|
74
|
+
{:id => '68', :xl => '', :ostring => nil, :cls => 'string'},
|
|
75
|
+
{:id => '69', :xl => '', :ostring => nil, :cls => 'string'},
|
|
76
|
+
{:id => '70', :xl => '', :ostring => nil, :cls => 'string'},
|
|
77
|
+
{:id => '71', :xl => '', :ostring => nil, :cls => 'string'},
|
|
78
|
+
{:id => '72', :xl => '', :ostring => nil, :cls => 'string'},
|
|
79
|
+
{:id => '73', :xl => '', :ostring => nil, :cls => 'string'},
|
|
80
|
+
{:id => '74', :xl => '', :ostring => nil, :cls => 'string'},
|
|
81
|
+
{:id => '75', :xl => '', :ostring => nil, :cls => 'string'},
|
|
82
|
+
{:id => '76', :xl => '', :ostring => nil, :cls => 'string'},
|
|
83
|
+
{:id => '77', :xl => '', :ostring => nil, :cls => 'string'},
|
|
84
|
+
{:id => '78', :xl => '', :ostring => nil, :cls => 'string'},
|
|
85
|
+
{:id => '79', :xl => '', :ostring => nil, :cls => 'string'},
|
|
86
|
+
{:id => '80', :xl => '', :ostring => nil, :cls => 'string'},
|
|
87
|
+
{:id => '81', :xl => '', :ostring => nil, :cls => 'string'},
|
|
88
|
+
{:id => '82', :xl => '', :ostring => nil, :cls => 'string'},
|
|
89
|
+
{:id => '83', :xl => '', :ostring => nil, :cls => 'string'},
|
|
90
|
+
{:id => '84', :xl => '', :ostring => nil, :cls => 'string'},
|
|
91
|
+
{:id => '85', :xl => '', :ostring => nil, :cls => 'string'},
|
|
92
|
+
{:id => '86', :xl => '', :ostring => nil, :cls => 'string'},
|
|
93
|
+
{:id => '87', :xl => '', :ostring => nil, :cls => 'string'},
|
|
94
|
+
{:id => '88', :xl => '', :ostring => nil, :cls => 'string'},
|
|
95
|
+
{:id => '89', :xl => '', :ostring => nil, :cls => 'string'},
|
|
96
|
+
{:id => '90', :xl => '', :ostring => nil, :cls => 'string'},
|
|
97
|
+
{:id => '91', :xl => '', :ostring => nil, :cls => 'string'},
|
|
98
|
+
{:id => '92', :xl => '', :ostring => nil, :cls => 'string'},
|
|
99
|
+
{:id => '93', :xl => '', :ostring => nil, :cls => 'string'},
|
|
100
|
+
{:id => '94', :xl => '', :ostring => nil, :cls => 'string'},
|
|
101
|
+
{:id => '95', :xl => '', :ostring => nil, :cls => 'string'},
|
|
102
|
+
{:id => '96', :xl => '', :ostring => nil, :cls => 'string'},
|
|
103
|
+
{:id => '97', :xl => '', :ostring => nil, :cls => 'string'},
|
|
104
|
+
{:id => '98', :xl => '', :ostring => nil, :cls => 'string'},
|
|
105
|
+
{:id => '99', :xl => '', :ostring => nil, :cls => 'string'},
|
|
106
|
+
{:id => '100', :xl => '', :ostring => nil, :cls => 'string'},
|
|
107
|
+
{:id => '101', :xl => '', :ostring => nil, :cls => 'string'},
|
|
108
|
+
{:id => '102', :xl => '', :ostring => nil, :cls => 'string'},
|
|
109
|
+
{:id => '103', :xl => '', :ostring => nil, :cls => 'string'},
|
|
110
|
+
{:id => '104', :xl => '', :ostring => nil, :cls => 'string'},
|
|
111
|
+
{:id => '105', :xl => '', :ostring => nil, :cls => 'string'},
|
|
112
|
+
{:id => '106', :xl => '', :ostring => nil, :cls => 'string'},
|
|
113
|
+
{:id => '107', :xl => '', :ostring => nil, :cls => 'string'},
|
|
114
|
+
{:id => '108', :xl => '', :ostring => nil, :cls => 'string'},
|
|
115
|
+
{:id => '109', :xl => '', :ostring => nil, :cls => 'string'},
|
|
116
|
+
{:id => '110', :xl => '', :ostring => nil, :cls => 'string'},
|
|
117
|
+
{:id => '111', :xl => '', :ostring => nil, :cls => 'string'},
|
|
118
|
+
{:id => '112', :xl => '', :ostring => nil, :cls => 'string'},
|
|
119
|
+
{:id => '113', :xl => '', :ostring => nil, :cls => 'string'},
|
|
120
|
+
{:id => '114', :xl => '', :ostring => nil, :cls => 'string'},
|
|
121
|
+
{:id => '115', :xl => '', :ostring => nil, :cls => 'string'},
|
|
122
|
+
{:id => '116', :xl => '', :ostring => nil, :cls => 'string'},
|
|
123
|
+
{:id => '117', :xl => '', :ostring => nil, :cls => 'string'},
|
|
124
|
+
{:id => '118', :xl => '', :ostring => nil, :cls => 'string'},
|
|
125
|
+
{:id => '119', :xl => '', :ostring => nil, :cls => 'string'},
|
|
126
|
+
{:id => '120', :xl => '', :ostring => nil, :cls => 'string'},
|
|
127
|
+
{:id => '121', :xl => '', :ostring => nil, :cls => 'string'},
|
|
128
|
+
{:id => '122', :xl => '', :ostring => nil, :cls => 'string'},
|
|
129
|
+
{:id => '123', :xl => '', :ostring => nil, :cls => 'string'},
|
|
130
|
+
{:id => '124', :xl => '', :ostring => nil, :cls => 'string'},
|
|
131
|
+
{:id => '125', :xl => '', :ostring => nil, :cls => 'string'},
|
|
132
|
+
{:id => '126', :xl => '', :ostring => nil, :cls => 'string'},
|
|
133
|
+
{:id => '127', :xl => '', :ostring => nil, :cls => 'string'},
|
|
134
|
+
{:id => '128', :xl => '', :ostring => nil, :cls => 'string'},
|
|
135
|
+
{:id => '129', :xl => '', :ostring => nil, :cls => 'string'},
|
|
136
|
+
{:id => '130', :xl => '', :ostring => nil, :cls => 'string'},
|
|
137
|
+
{:id => '131', :xl => '', :ostring => nil, :cls => 'string'},
|
|
138
|
+
{:id => '132', :xl => '', :ostring => nil, :cls => 'string'},
|
|
139
|
+
{:id => '133', :xl => '', :ostring => nil, :cls => 'string'},
|
|
140
|
+
{:id => '134', :xl => '', :ostring => nil, :cls => 'string'},
|
|
141
|
+
{:id => '135', :xl => '', :ostring => nil, :cls => 'string'},
|
|
142
|
+
{:id => '136', :xl => '', :ostring => nil, :cls => 'string'},
|
|
143
|
+
{:id => '137', :xl => '', :ostring => nil, :cls => 'string'},
|
|
144
|
+
{:id => '138', :xl => '', :ostring => nil, :cls => 'string'},
|
|
145
|
+
{:id => '139', :xl => '', :ostring => nil, :cls => 'string'},
|
|
146
|
+
{:id => '140', :xl => '', :ostring => nil, :cls => 'string'},
|
|
147
|
+
{:id => '141', :xl => '', :ostring => nil, :cls => 'string'},
|
|
148
|
+
{:id => '142', :xl => '', :ostring => nil, :cls => 'string'},
|
|
149
|
+
{:id => '143', :xl => '', :ostring => nil, :cls => 'string'},
|
|
150
|
+
{:id => '144', :xl => '', :ostring => nil, :cls => 'string'},
|
|
151
|
+
{:id => '145', :xl => '', :ostring => nil, :cls => 'string'},
|
|
152
|
+
{:id => '146', :xl => '', :ostring => nil, :cls => 'string'},
|
|
153
|
+
{:id => '147', :xl => '', :ostring => nil, :cls => 'string'},
|
|
154
|
+
{:id => '148', :xl => '', :ostring => nil, :cls => 'string'},
|
|
155
|
+
{:id => '149', :xl => '', :ostring => nil, :cls => 'string'},
|
|
156
|
+
{:id => '150', :xl => '', :ostring => nil, :cls => 'string'},
|
|
157
|
+
{:id => '151', :xl => '', :ostring => nil, :cls => 'string'},
|
|
158
|
+
{:id => '152', :xl => '', :ostring => nil, :cls => 'string'},
|
|
159
|
+
{:id => '153', :xl => '', :ostring => nil, :cls => 'string'},
|
|
160
|
+
{:id => '154', :xl => '', :ostring => nil, :cls => 'string'},
|
|
161
|
+
{:id => '155', :xl => '', :ostring => nil, :cls => 'string'},
|
|
162
|
+
{:id => '156', :xl => '', :ostring => nil, :cls => 'string'},
|
|
163
|
+
{:id => '157', :xl => '', :ostring => nil, :cls => 'string'},
|
|
164
|
+
{:id => '158', :xl => '', :ostring => nil, :cls => 'string'},
|
|
165
|
+
{:id => '159', :xl => '', :ostring => nil, :cls => 'string'},
|
|
166
|
+
{:id => '160', :xl => '', :ostring => nil, :cls => 'string'},
|
|
167
|
+
{:id => '161', :xl => '', :ostring => nil, :cls => 'string'},
|
|
168
|
+
{:id => '162', :xl => '', :ostring => nil, :cls => 'string'},
|
|
169
|
+
{:id => '163', :xl => '', :ostring => nil, :cls => 'string'},
|
|
170
|
+
]
|
|
171
|
+
end
|
|
172
|
+
end
|