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
data/Gemfile
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
source "http://rubygems.org"
|
|
2
|
-
# Add dependencies required to use your gem here.
|
|
3
|
-
# Example:
|
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
|
5
2
|
|
|
6
|
-
#
|
|
7
|
-
|
|
3
|
+
# Dependencies required to run this gem.
|
|
4
|
+
gem "nokogiri", ">= 1.4.4"
|
|
5
|
+
gem "rubyzip", ">= 1.0.0" , :require => 'zip'
|
|
6
|
+
|
|
7
|
+
# Development dependencies.
|
|
8
8
|
group :development do
|
|
9
9
|
gem "shoulda", ">= 0"
|
|
10
|
-
gem "bundler"
|
|
11
|
-
gem "jeweler"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
gem "bundler"
|
|
11
|
+
gem "jeweler"
|
|
12
|
+
|
|
13
|
+
if RUBY_VERSION =~ /^1\.9/
|
|
14
|
+
gem "simplecov", ">= 0"
|
|
15
|
+
else
|
|
16
|
+
gem "rcov", ">= 0"
|
|
17
|
+
end
|
|
18
|
+
|
|
15
19
|
gem "rspec", ">= 1.3.4"
|
|
16
20
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,34 +1,93 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: http://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
activesupport (4.0.2)
|
|
5
|
+
i18n (~> 0.6, >= 0.6.4)
|
|
6
|
+
minitest (~> 4.2)
|
|
7
|
+
multi_json (~> 1.3)
|
|
8
|
+
thread_safe (~> 0.1)
|
|
9
|
+
tzinfo (~> 0.3.37)
|
|
10
|
+
addressable (2.3.5)
|
|
11
|
+
atomic (1.1.14)
|
|
12
|
+
builder (3.2.2)
|
|
13
|
+
descendants_tracker (0.0.3)
|
|
14
|
+
diff-lcs (1.2.5)
|
|
15
|
+
docile (1.1.1)
|
|
16
|
+
faraday (0.9.0)
|
|
17
|
+
multipart-post (>= 1.2, < 3)
|
|
18
|
+
git (1.2.6)
|
|
19
|
+
github_api (0.11.2)
|
|
20
|
+
addressable (~> 2.3)
|
|
21
|
+
descendants_tracker (~> 0.0.1)
|
|
22
|
+
faraday (~> 0.8, < 0.10)
|
|
23
|
+
hashie (>= 1.2)
|
|
24
|
+
multi_json (>= 1.7.5, < 2.0)
|
|
25
|
+
nokogiri (~> 1.6.0)
|
|
26
|
+
oauth2
|
|
27
|
+
hashie (2.0.5)
|
|
28
|
+
highline (1.6.20)
|
|
29
|
+
i18n (0.6.9)
|
|
30
|
+
jeweler (2.0.1)
|
|
31
|
+
builder
|
|
32
|
+
bundler (>= 1.0)
|
|
8
33
|
git (>= 1.2.5)
|
|
34
|
+
github_api
|
|
35
|
+
highline (>= 1.6.15)
|
|
36
|
+
nokogiri (>= 1.5.10)
|
|
9
37
|
rake
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
38
|
+
rdoc
|
|
39
|
+
json (1.8.1)
|
|
40
|
+
jwt (0.1.11)
|
|
41
|
+
multi_json (>= 1.5)
|
|
42
|
+
mini_portile (0.5.2)
|
|
43
|
+
minitest (4.7.5)
|
|
44
|
+
multi_json (1.8.2)
|
|
45
|
+
multi_xml (0.5.5)
|
|
46
|
+
multipart-post (2.0.0)
|
|
47
|
+
nokogiri (1.6.1)
|
|
48
|
+
mini_portile (~> 0.5.0)
|
|
49
|
+
oauth2 (0.9.3)
|
|
50
|
+
faraday (>= 0.8, < 0.10)
|
|
51
|
+
jwt (~> 0.1.8)
|
|
52
|
+
multi_json (~> 1.3)
|
|
53
|
+
multi_xml (~> 0.5)
|
|
54
|
+
rack (~> 1.2)
|
|
55
|
+
rack (1.5.2)
|
|
56
|
+
rake (10.1.1)
|
|
57
|
+
rdoc (4.1.1)
|
|
58
|
+
json (~> 1.4)
|
|
59
|
+
rspec (2.14.1)
|
|
60
|
+
rspec-core (~> 2.14.0)
|
|
61
|
+
rspec-expectations (~> 2.14.0)
|
|
62
|
+
rspec-mocks (~> 2.14.0)
|
|
63
|
+
rspec-core (2.14.7)
|
|
64
|
+
rspec-expectations (2.14.4)
|
|
65
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
|
66
|
+
rspec-mocks (2.14.4)
|
|
67
|
+
rubyzip (1.1.0)
|
|
68
|
+
shoulda (3.5.0)
|
|
69
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
|
70
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
|
71
|
+
shoulda-context (1.1.6)
|
|
72
|
+
shoulda-matchers (2.4.0)
|
|
73
|
+
activesupport (>= 3.0.0)
|
|
74
|
+
simplecov (0.8.2)
|
|
75
|
+
docile (~> 1.1.0)
|
|
76
|
+
multi_json
|
|
77
|
+
simplecov-html (~> 0.8.0)
|
|
78
|
+
simplecov-html (0.8.0)
|
|
79
|
+
thread_safe (0.1.3)
|
|
80
|
+
atomic
|
|
81
|
+
tzinfo (0.3.38)
|
|
23
82
|
|
|
24
83
|
PLATFORMS
|
|
25
84
|
ruby
|
|
26
85
|
|
|
27
86
|
DEPENDENCIES
|
|
28
|
-
bundler
|
|
29
|
-
jeweler
|
|
87
|
+
bundler
|
|
88
|
+
jeweler
|
|
30
89
|
nokogiri (>= 1.4.4)
|
|
31
|
-
rcov
|
|
32
90
|
rspec (>= 1.3.4)
|
|
33
|
-
rubyzip (>= 0.
|
|
91
|
+
rubyzip (>= 1.0.0)
|
|
34
92
|
shoulda
|
|
93
|
+
simplecov
|
data/LICENSE.txt
CHANGED
data/README.rdoc
CHANGED
|
@@ -4,66 +4,75 @@
|
|
|
4
4
|
gem install rubyXL
|
|
5
5
|
|
|
6
6
|
== To Use:
|
|
7
|
-
require 'rubyXL' #
|
|
7
|
+
require 'rubyXL' # Assuming rubygems is already required
|
|
8
8
|
|
|
9
9
|
=== Parsing an existing workbook
|
|
10
10
|
workbook = RubyXL::Parser.parse("path/to/Excel/file.xlsx")
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
=== Creating a new Workbook
|
|
14
13
|
workbook = RubyXL::Workbook.new
|
|
15
14
|
|
|
16
15
|
=== Accessing
|
|
17
16
|
|
|
18
17
|
==== Accessing a Worksheet
|
|
19
|
-
workbook.worksheets[0] #
|
|
20
|
-
workbook[0]
|
|
18
|
+
workbook.worksheets[0] # Returns first worksheet
|
|
19
|
+
workbook[0] # Returns first worksheet
|
|
20
|
+
workbook['Sheet1'] # Finds and returns worksheet titled "Sheet1"
|
|
21
21
|
|
|
22
|
-
==== Accessing
|
|
23
|
-
workbook
|
|
22
|
+
==== Accessing just the values
|
|
23
|
+
worksheet = workbook[0]
|
|
24
|
+
worksheet.extract_data # Produces a simple rectangular array that consists only of cell values (rather than the Cell objects)
|
|
24
25
|
|
|
25
26
|
==== Accessing a Row (Array of Cells)
|
|
26
|
-
workbook[0]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
workbook[0]
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
workbook[0][0][0]
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
workbook[0]
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
27
|
+
worksheet = workbook[0]
|
|
28
|
+
worksheet.sheet_data[0] # Returns first row of the worksheet
|
|
29
|
+
worksheet[0] # Returns first row of the worksheet
|
|
30
|
+
|
|
31
|
+
==== Accessing a Cell object
|
|
32
|
+
worksheet = workbook[0]
|
|
33
|
+
worksheet.sheet_data[0][0] # Returns cell A1 in the worksheet
|
|
34
|
+
worksheet[0][0] # Returns cell A1 in the worksheet
|
|
35
|
+
|
|
36
|
+
==== Wrappers for accessing Cell properties
|
|
37
|
+
cell = workbook[0][0][0]
|
|
38
|
+
cell.is_struckthrough # Returns +true+ if the cell is struckthrough, other boolean properties have same syntax
|
|
39
|
+
cell.font_name
|
|
40
|
+
cell.font_size
|
|
41
|
+
cell.font_color
|
|
42
|
+
cell.fill_color
|
|
43
|
+
cell.horizontal_alignment
|
|
44
|
+
cell.vertical_alignment
|
|
45
|
+
cell.border_top
|
|
46
|
+
|
|
47
|
+
==== Wrappers for accessing Row properties
|
|
48
|
+
Please note: these methods are being phased out in favor of the OOXML object model.
|
|
49
|
+
worksheet = workbook[0]
|
|
50
|
+
worksheet.get_row_fill(0)
|
|
51
|
+
worksheet.get_row_font_name(0)
|
|
52
|
+
worksheet.get_row_font_size(0)
|
|
53
|
+
worksheet.get_row_font_color(0)
|
|
54
|
+
worksheet.is_row_underlined(0)
|
|
55
|
+
worksheet.get_row_height(0)
|
|
56
|
+
worksheet.get_row_horizontal_alignment(0)
|
|
57
|
+
worksheet.get_row_vertical_alignment(0)
|
|
58
|
+
worksheet.get_row_border_right(0)
|
|
53
59
|
|
|
54
60
|
==== Accessing column properties
|
|
55
|
-
|
|
56
|
-
workbook[0]
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
Please note: these methods are being phased out in favor of the OOXML object model.
|
|
62
|
+
worksheet = workbook[0]
|
|
63
|
+
worksheet.get_column_fill(0)
|
|
64
|
+
worksheet.get_column_font_name(0)
|
|
65
|
+
worksheet.get_column_font_size(0)
|
|
66
|
+
worksheet.get_column_font_color(0)
|
|
67
|
+
worksheet.is_column_underlined(0)
|
|
68
|
+
worksheet.get_column_height(0)
|
|
69
|
+
worksheet.get_column_horizontal_alignment(0)
|
|
70
|
+
worksheet.get_column_vertical_alignment(0)
|
|
71
|
+
worksheet.get_column_border_right(0)
|
|
64
72
|
|
|
65
73
|
==== Table identification
|
|
66
|
-
workbook[0]
|
|
74
|
+
worksheet = workbook[0]
|
|
75
|
+
worksheet.get_table(["NAME", "AGE", "HEIGHT"]) # Returns hash of a table in the first worksheet, with the specified strings as headers, accessible by row and column
|
|
67
76
|
#it returns the following structure
|
|
68
77
|
{
|
|
69
78
|
:Name=>["John", "Jane", "Joe"],
|
|
@@ -79,103 +88,101 @@
|
|
|
79
88
|
=== Modifying
|
|
80
89
|
|
|
81
90
|
==== Adding Worksheets
|
|
82
|
-
|
|
91
|
+
worlsheet = workbook.add_worksheet('Sheet2')
|
|
83
92
|
|
|
84
93
|
==== Adding Cells
|
|
85
|
-
|
|
86
|
-
|
|
94
|
+
worksheet.add_cell(0, 0, 'A1') # Sets cell A1 to string "A1"
|
|
95
|
+
worksheet.add_cell(0, 1, '', 'A1') # Sets formula in the cell B1 to '=A1'
|
|
87
96
|
|
|
88
|
-
workbook.worksheets[0].add_cell_obj(Cell.new(1,0,'blah')) #sets A2 to 'blah'
|
|
89
|
-
|
|
90
97
|
==== Changing Cells
|
|
91
|
-
|
|
98
|
+
worksheet[0][0].change_contents("", worksheet[0][0].formula) # Sets value of cell A1 to empty string, preserves formula
|
|
92
99
|
|
|
93
100
|
==== Changing Fonts
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
worksheet.sheet_data[0][0].change_font_bold(true) # Makes A1 bold
|
|
102
|
+
worksheet.change_row_italics(0,true) # Makes first row italicized
|
|
103
|
+
worksheet.change_column_font_name(0, 'Courier') # Makes first column have font Courier
|
|
97
104
|
|
|
98
105
|
==== Changing Fills
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
worksheet.sheet_data[0][0].change_fill('0ba53d') # Sets A1 to have fill #0ba53d
|
|
107
|
+
worksheet.change_row_fill(0, '0ba53d') # Sets first row to have fill #0ba53d
|
|
108
|
+
worksheet.change_column_fill(0, '0ba53d') # Sets first column to have fill #0ba53d
|
|
102
109
|
|
|
103
110
|
==== Changing Borders
|
|
104
111
|
# Possible weights: hairline, thin, medium, thick
|
|
105
112
|
# Possible "directions": top, bottom, left, right, diagonal
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
113
|
+
worksheet.sheet_data[0][0].change_border_top('thin') # Sets A1 to have a top, thin border
|
|
114
|
+
worksheet.change_row_border_left(0, 'hairline') # Sets first row to have a left, hairline border
|
|
115
|
+
worksheet.change_column_border_diagonal(0, 'medium') # Sets first column to have diagonal, medium border
|
|
109
116
|
|
|
110
117
|
==== Changing Alignment
|
|
111
118
|
===== Horizontal
|
|
112
119
|
center, distributed, justify, left, right
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
worksheet.sheet_data[0][0].change_horizontal_alignment('center') # Sets A1 to be centered
|
|
121
|
+
worksheet.change_row_horizontal_alignment(0, 'justify') # Sets first row to be justified
|
|
122
|
+
worksheet.change_column_horizontal_alignment(0, 'right') # Sets first column to be right-aligned
|
|
116
123
|
|
|
117
124
|
===== Vertical
|
|
118
125
|
bottom, center, distributed, top
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
126
|
+
worksheet.sheet_data[0][0].change_vertical_alignment('bottom') # Sets A1 to be bottom aligned
|
|
127
|
+
worksheet.change_row_vertical_alignment(0, 'distributed') # Sets first row to be distributed vertically
|
|
128
|
+
worksheet.change_column_vertical_alignment(0, 'top') # Sets first column to be top aligned
|
|
122
129
|
|
|
123
130
|
==== Changing Row Height
|
|
124
|
-
|
|
131
|
+
worksheet.change_row_height(0, 30) # Sets first row height to 30
|
|
125
132
|
|
|
126
133
|
==== Changing Column Width
|
|
127
|
-
|
|
134
|
+
worksheet.change_column_width(0, 30) # Sets first column width to 30
|
|
128
135
|
|
|
129
136
|
==== Merging Cells
|
|
130
|
-
|
|
137
|
+
worksheet.merge_cells(0, 0, 1, 1) # Merges A1:B2
|
|
131
138
|
|
|
132
139
|
==== Insert Row
|
|
133
140
|
This method will insert a row at specified index, pushing all rows below it down. It also copies styles from row above.
|
|
134
141
|
|
|
135
142
|
WARNING: Use of this method WILL break formulas referencing cells which have been moved, as the formulas do not adapt to the shifted rows
|
|
136
|
-
|
|
143
|
+
worksheet.insert_row(1)
|
|
137
144
|
|
|
138
145
|
==== Insert Column
|
|
139
146
|
This method will insert a column at specified index, pushing all columns to the right of it one to the right. It also copies styles from column to the left
|
|
140
147
|
|
|
141
148
|
WARNING: Use of this method WILL break formulas referencing cells which have been moved, as the formulas do not adapt to the shifted columns
|
|
142
|
-
|
|
149
|
+
worksheet.insert_column(1)
|
|
143
150
|
|
|
144
151
|
==== Delete Row
|
|
145
152
|
This method will delete a row at specified index, pushing all rows below it up.
|
|
146
153
|
|
|
147
154
|
WARNING: Use of this method WILL break formulas referencing cells which have been moved, as the formulas do not adapt to the shifted rows
|
|
148
|
-
|
|
155
|
+
worksheet.delete_row(1)
|
|
149
156
|
|
|
150
157
|
==== Delete Column
|
|
151
158
|
This method will delete a column at specified index, pushing all columns to the right of it left.
|
|
152
159
|
|
|
153
160
|
WARNING: Use of this method WILL break formulas referencing cells which have been moved, as the formulas do not adapt to the shifted columns
|
|
154
|
-
|
|
161
|
+
worksheet.delete_column(1)
|
|
155
162
|
|
|
156
163
|
==== Insert Cell
|
|
157
164
|
This method will insert a cell at specified position. It takes a :right or :down option, to shift cells either left or down upon inserting (nil means replacing the cell)
|
|
158
165
|
|
|
159
166
|
WARNING: Use of this method WILL break formulas referencing cells which have been moved, as the formulas do not adapt to the shifted cells
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
worksheet.insert_cell(0, 0, "blah", formula = nil, :right) # Inserts cell at A1, shifts cells in first row right
|
|
168
|
+
worksheet.insert_cell(0, 0, "blah", formula = nil, :down) # Inserts cell at A1, shifts cells in first column down
|
|
169
|
+
worksheet.insert_cell(0, 0, "blah") # Inserts cell at A1, shifts nothing
|
|
163
170
|
|
|
164
171
|
==== Delete Cell
|
|
165
172
|
This method will delete a cell at specified position. It takes a :left or :up option, to shift cells either up or left upon deletion (nil means simply deleting the cell contents)
|
|
166
173
|
|
|
167
174
|
WARNING: Use of this method WILL break formulas referencing cells which have been moved, as the formulas do not adapt to the shifted cells
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
175
|
+
worksheet.delete_cell(0, 0, :left) # Deletes A1, shifts contents of first row left
|
|
176
|
+
worksheet.delete_cell(0, 0, :up) # Deletes A1, shifts contents of first column up
|
|
177
|
+
worksheet.delete_cell(0, 0) # Deletes A1, does not shift cells
|
|
171
178
|
|
|
172
179
|
=== Writing
|
|
173
180
|
workbook.write("path/to/desired/Excel/file.xlsx")
|
|
174
181
|
|
|
175
182
|
|
|
176
183
|
=== Miscellaneous
|
|
177
|
-
|
|
178
|
-
|
|
184
|
+
Reference.ind2ref(0,0) == 'A1' # Converts row and column index to Excel-style cell reference
|
|
185
|
+
Reference.ref2ind('A1') == [0, 0] # Converts Excel-style cell reference to row and column index
|
|
179
186
|
|
|
180
187
|
== For more information
|
|
181
188
|
Take a look at the files in spec/lib/ for rspecs on most methods
|
|
@@ -192,6 +199,5 @@ Take a look at the files in spec/lib/ for rspecs on most methods
|
|
|
192
199
|
|
|
193
200
|
== Copyright
|
|
194
201
|
|
|
195
|
-
Copyright (c) 2011 Vivek Bhagwat
|
|
196
|
-
further details.
|
|
197
|
-
|
|
202
|
+
Copyright (c) 2011 Vivek Bhagwat, 2013-2014 Wesha.
|
|
203
|
+
See LICENSE.txt for further details.
|
data/Rakefile
CHANGED
|
@@ -32,6 +32,7 @@ Rake::TestTask.new(:test) do |test|
|
|
|
32
32
|
test.verbose = true
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
=begin
|
|
35
36
|
require 'rcov/rcovtask'
|
|
36
37
|
Rcov::RcovTask.new do |test|
|
|
37
38
|
test.libs << 'test'
|
|
@@ -39,10 +40,14 @@ Rcov::RcovTask.new do |test|
|
|
|
39
40
|
test.verbose = true
|
|
40
41
|
test.rcov_opts << '--exclude "gems/*"'
|
|
41
42
|
end
|
|
43
|
+
=end
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
require 'rspec/core/rake_task'
|
|
46
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
task :default => :spec
|
|
49
|
+
|
|
50
|
+
require 'rdoc/task'
|
|
46
51
|
Rake::RDocTask.new do |rdoc|
|
|
47
52
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
48
53
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
2.1.1
|
data/lib/rubyXL.rb
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
require
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require
|
|
1
|
+
require 'rubyXL/workbook'
|
|
2
|
+
require 'rubyXL/worksheet'
|
|
3
|
+
require 'rubyXL/cell'
|
|
4
|
+
require 'rubyXL/objects/reference'
|
|
5
|
+
require 'rubyXL/objects/column_range'
|
|
6
|
+
require 'rubyXL/objects/stylesheet'
|
|
7
|
+
require 'rubyXL/objects/shared_strings'
|
|
8
|
+
require 'rubyXL/objects/worksheet'
|
|
9
|
+
require 'rubyXL/objects/calculation_chain'
|
|
10
|
+
require 'rubyXL/objects/workbook'
|
|
11
|
+
require 'rubyXL/objects/document_properties'
|
|
12
|
+
require 'rubyXL/objects/relationships'
|
|
13
|
+
require 'rubyXL/parser'
|
|
8
14
|
|
|
9
15
|
module RubyXL
|
|
10
16
|
end
|