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/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
- # Add dependencies to develop your gem here.
7
- # Include everything needed to run rake, tests, features, etc.
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", "~> 1.0.0"
11
- gem "jeweler", "~> 1.6.0"
12
- gem "rcov", ">= 0"
13
- gem "nokogiri", ">= 1.4.4"
14
- gem "rubyzip", ">= 0.9.4"
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
- diff-lcs (1.1.2)
5
- git (1.2.5)
6
- jeweler (1.6.0)
7
- bundler (~> 1.0.0)
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
- nokogiri (1.4.4)
11
- rake (0.8.7)
12
- rcov (0.9.9)
13
- rspec (2.6.0)
14
- rspec-core (~> 2.6.0)
15
- rspec-expectations (~> 2.6.0)
16
- rspec-mocks (~> 2.6.0)
17
- rspec-core (2.6.4)
18
- rspec-expectations (2.6.0)
19
- diff-lcs (~> 1.1.2)
20
- rspec-mocks (2.6.0)
21
- rubyzip (0.9.4)
22
- shoulda (2.11.3)
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 (~> 1.0.0)
29
- jeweler (~> 1.6.0)
87
+ bundler
88
+ jeweler
30
89
  nokogiri (>= 1.4.4)
31
- rcov
32
90
  rspec (>= 1.3.4)
33
- rubyzip (>= 0.9.4)
91
+ rubyzip (>= 1.0.0)
34
92
  shoulda
93
+ simplecov
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Vivek Bhagwat
1
+ Copyright (c) 2011 Vivek Bhagwat, 2013-2014 Wesha
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -4,66 +4,75 @@
4
4
  gem install rubyXL
5
5
 
6
6
  == To Use:
7
- require 'rubyXL' #assuming rubygems is already required
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] #returns first worksheet
20
- workbook[0] #returns first worksheet
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 Only the Values
23
- workbook.worksheets[0].extract_data #produces a 2d array which consists only of the values (instead of the Cell objects which include other variables)
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].sheet_data[0] #returns first row in first worksheet
27
- workbook[0][0] #returns first row in first worksheet
28
-
29
- ==== Accessing a Cell
30
- workbook[0].sheet_data[0][0] #returns A1 in first worksheet
31
- workbook[0][0][0] #returns A1 in first worksheet
32
-
33
- ==== Accessing Cell properties
34
- workbook[0][0][0].is_struckthrough() #returns if A1 is struckthrough, other boolean properties have same syntax
35
- workbook[0][0][0].font_name #returns font name for A1
36
- workbook[0][0][0].font_size #returns font size for A1
37
- workbook[0][0][0].font_color #returns font color for A1
38
- workbook[0][0][0].fill_color #returns fill color for A1
39
- workbook[0][0][0].horizontal_alignment #returns horizontal alignment for A1 (or nil if it does not exist)
40
- workbook[0][0][0].vertical_alignment #returns vertical alignment for A1 (or nil if it does not exist)
41
- workbook[0][0][0].border_top #returns type of border on top of A1 (nil if none exists), other directions have same syntax
42
-
43
- ==== Accessing row properties
44
- workbook[0].get_row_fill(0) #returns fill color for first row
45
- workbook[0].get_row_font_name(0) #returns font name for first row
46
- workbook[0].get_row_font_size(0) #returns font size for first row
47
- workbook[0].get_row_font_color(0) #returns font color for first row
48
- workbook[0].is_row_underlined(0) #returns if first row is italicized, other boolean properties have same syntax
49
- workbook[0].get_row_height(0) #returns height of first row
50
- workbook[0].get_row_horizontal_alignment(0) #returns horizontal alignment of first row (nil if none exists)
51
- workbook[0].get_row_vertical_alignment(0) #returns vertical alignment of first row (nil if none exists)
52
- workbook[0].get_row_border_right(0) #returns weight of right border of first row (nil if none exists), other directions have the same syntax
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
- workbook[0].get_column_fill(0) #returns fill color for first column
56
- workbook[0].get_column_font_name(0) #returns font name for first column
57
- workbook[0].get_column_font_size(0) #returns font size for first column
58
- workbook[0].get_column_font_color(0) #returns font color for first column
59
- workbook[0].is_column_underlined(0) #returns if first column is italicized, other boolean properties have same syntax
60
- workbook[0].get_column_height(0) #returns height of first column
61
- workbook[0].get_column_horizontal_alignment(0) #returns horizontal alignment of first column (nil if none exists)
62
- workbook[0].get_column_vertical_alignment(0) #returns vertical alignment of first column (nil if none exists)
63
- workbook[0].get_column_border_right(0) #returns weight of right border of first column (nil if none exists), other directions have the same syntax
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].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
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
- workbook.worksheets << Worksheet.new('Sheet2')
91
+ worlsheet = workbook.add_worksheet('Sheet2')
83
92
 
84
93
  ==== Adding Cells
85
- workbook.worksheets[0].add_cell(0,0,'A1') #sets A1 to string "A1"
86
- workbook.worksheets[0].add_cell(0,1,'','A1') #sets B1 to value of A1
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
- workbook.worksheets[0][0][0].change_contents("", workbook.worksheets[0][0][0].formula) #sets A1 to empty string, preserves formula
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
- workbook.worksheets[0].sheet_data[0][0].change_font_bold(true) #sets A1 to bold
95
- workbook.worksheets[0].change_row_font_italics(0,true) #makes first row italicized
96
- workbook.worksheets[0].change_column_font_name(0,'Courier') #makes first column have font Courier
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
- workbook.worksheets[0].sheet_data[0][0].change_fill('0ba53d') #sets A1 to have fill #0ba53d
100
- workbook.worksheets[0].change_row_fill(0, '0ba53d') #sets first row to have fill #0ba53d
101
- workbook.worksheets[0].change_column_fill(0, '0ba53d') #sets first column to have fill #0ba53d
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
- workbook.worksheets[0].sheet_data[0][0].change_border_top('thin') #sets A1 to have a top, thin border
107
- workbook.worksheets[0].change_row_border_left(0, 'hairline') #sets first row to have a left, hairline border
108
- workbook.worksheets[0].change_column_border_diagonal(0, 'medium') #sets first column to have diagonal, medium border
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
- workbook.worksheets[0].sheet_data[0][0].change_horizontal_alignment('center') #sets A1 to be centered
114
- workbook.worksheets[0].change_row_horizontal_alignment(0,'justify') #sets first row to be justified
115
- workbook.worksheets[0].change_column_horizontal_alignment(0,'right'), #sets first column to be right-aligned
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
- workbook.worksheets[0].sheet_data[0][0].change_vertical_alignment('bottom') #sets A1 to be bottom aligned
120
- workbook.worksheets[0].change_row_vertical_alignment(0,'distributed') #sets first row to be distributed vertically
121
- workbook.worksheets[0].change_column_vertical_alignment(0,'top') #sets first column to be top aligned
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
- workbook.worksheets[0].change_row_height(0,30) #sets first row to be of height 30
131
+ worksheet.change_row_height(0, 30) # Sets first row height to 30
125
132
 
126
133
  ==== Changing Column Width
127
- workbook.worksheets[0].change_column_width(0,30) #sets first column to be of width 30
134
+ worksheet.change_column_width(0, 30) # Sets first column width to 30
128
135
 
129
136
  ==== Merging Cells
130
- workbook.worksheets[0].merge_cells(0,0,1,1) #merges A1:B2
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
- workbook.worksheets[0].insert_row(1)
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
- workbook.worksheets[0].insert_column(1)
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
- workbook.worksheets[0].delete_row(1)
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
- workbook.worksheets[0].delete_column(1)
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
- workbook.worksheets[0].insert_cell(0,0,"blah",formula=nil,:right) #inserts cell at A1, shifts cells in first row right
161
- workbook.worksheets[0].insert_cell(0,0,"blah",formula=nil,:down) #inserts cell at A1, shifts cells in first column down
162
- workbook.worksheets[0].insert_cell(0,0,"blah") #inserts cell at A1, shifts nothing
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
- workbook.worksheets[0].delete_cell(0,0,:left) #deletes A1, shifts contents of first row left
169
- workbook.worksheets[0].delete_cell(0,0,:up) #deletes A1, shifts contents of first column up
170
- workbook.worksheets[0].delete_cell(0,0) #deletes A1, does not shift cells
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
- Cell.convert_to_cell(0,0) == 'A1' #converts row and column index to Excel-style index
178
- Parser.convert_to_index('A1') == [0,0] #converts Excel-style index to row and column index
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. See LICENSE.txt for
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
- task :default => :test
45
+ require 'rspec/core/rake_task'
46
+ RSpec::Core::RakeTask.new(:spec)
44
47
 
45
- require 'rake/rdoctask'
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.2.10
1
+ 2.1.1
data/lib/rubyXL.rb CHANGED
@@ -1,10 +1,16 @@
1
- $: << File.expand_path(File.dirname(__FILE__))
2
- require File.expand_path(File.join(File.dirname(__FILE__),'rubyXL','workbook'))
3
- require File.expand_path(File.join(File.dirname(__FILE__),'rubyXL','private_class'))
4
- require File.expand_path(File.join(File.dirname(__FILE__),'rubyXL','worksheet'))
5
- require File.expand_path(File.join(File.dirname(__FILE__),'rubyXL','cell'))
6
- require File.expand_path(File.join(File.dirname(__FILE__),'rubyXL','parser'))
7
- require File.expand_path(File.join(File.dirname(__FILE__),'rubyXL','color'))
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