oxcelix 0.2.2 → 0.2.4

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/CHANGES CHANGED
@@ -1,12 +1,64 @@
1
- 09/10: Replaced an instance of Ox::load_file, as it won't work on windows
2
- Corrected bug
3
- 08/10: The sheet class now inherits Matrix. Sheet can return a cell based on its excel name. Sheet::data is obsolete - deleted. Moved r, v, s to the Cellvalues module - they are not needed elsewhere but the Cell class. Documentation changes. .yardopts file added.
4
- slight documentation changes, yard options added to (protected and private methods docs are now readable)
5
-
6
- 07/10: Changed gem version
7
- Removed sharedstrings and sheetbase properties as they were useless. Docs updated with the change.
8
- Update oxcelix.gemspec
9
- Raised visibility in rdoc, so that all method documentation gets readable.
10
- Update workbook.rb
11
- replaced Ox::load_file with IO.read + Ox::load in workbook, as apparently workbook.xml could not be loaded under windows using that method
12
- Minor typos corrected, added gemspec
1
+ * Fixed serious regression which was preventing the copy-merge routine from properly run (cols and rows were flipped). Fixed smaller bug which caused comments to be inserted as a 1-element array of hashes instead of plain text.
2
+ Thu Oct 10 23:44:39 2013 +0200
3
+ * Fixed major bug which prevented the comments to be pulled from the XML files.
4
+ Thu Oct 10 20:12:56 2013 +0200
5
+ * Fixed serious bug concerning the loading of the worksheets. Oxcelix will now correctly guess the filenames of the XML files describing the sheets
6
+ Thu Oct 10 18:22:39 2013 +0200
7
+ * Update workbook.rb Wed Oct 9 19:10:39 2013 +0200
8
+ * Changed another instance of Ox::load_file, as it won't work under windows Wed Oct 9 18:59:50 2013 +0200
9
+ * The sheet class now inherits Matrix. Sheet can return a cell based on its excel name. Sheet::data is obsolete - deleted. Moved r, v, s to the Cellvalues module - they are not needed elsewhere but the Cell class. Documentation changes. .yardopts file added.
10
+ Tue Oct 8 23:10:25 2013 +0200
11
+ * The sheet class now inherits Matrix. Sheet can return a cell based on its excel name. Sheet::data is obsolete - deleted. Moved r, v, s to the Cellvalues module - they are not needed elsewhere but the Cell class. Documentation changes. .yardopts file added.
12
+ Tue Oct 8 23:07:10 2013 +0200
13
+ * slight documentation changes, yard options added to (protected and private methods docs are now readable)
14
+ Tue Oct 8 20:17:29 2013 +0200
15
+ * Changed gem version Mon Oct 7 22:12:34 2013 +0200
16
+ * Removed sharedstrings and sheetbase properties as they were useless. Docs updated with the change. Mon Oct 7 18:15:44 2013 +0200
17
+ * Update oxcelix.gemspec Mon Oct 7 17:48:14 2013 +0200
18
+ * Update oxcelix.gemspec
19
+
20
+ Raised visibility in rdoc, so that all method documentation gets readable. Mon Oct 7 17:47:50 2013 +0200
21
+ * Update workbook.rb
22
+
23
+ replaced Ox::load_file with IO.read + Ox::load in workbook, as apparently workbook.xml could not be loaded under windows using that method Mon Oct 7 17:37:39 2013 +0200
24
+ * Minor typos corrected, added gemspec
25
+ Sun Oct 6 16:52:54 2013 +0200
26
+ * oxcelix.rb was not added to previous commit
27
+ Sun Oct 6 12:29:37 2013 +0200
28
+ * Broke down oxcelix.rb. Improved YARD documentation.
29
+ Sun Oct 6 12:25:59 2013 +0200
30
+ * Removed unneeded method from Xlsheet. Started converting docs to YARD
31
+ Sat Oct 5 09:20:31 2013 +0200
32
+ * Merge branch 'master' of https://github.com/gbiczo/oxcelix
33
+ Wed Oct 2 00:19:54 2013 +0200
34
+ * Repeating commit as the sheetdata method code was not included. Now it will simply do some Array magic to return the list of active sheets.
35
+ Wed Oct 2 00:19:18 2013 +0200
36
+ * Update README.md
37
+
38
+ Fixed typos Wed Oct 2 00:08:00 2013 +0200
39
+ * Merge branch 'master' of https://github.com/gbiczo/oxcelix
40
+ Tue Oct 1 23:51:13 2013 +0200
41
+ * Moved source to lib directory.
42
+ Tue Oct 1 23:43:53 2013 +0200
43
+ * Added README
44
+ Tue Oct 1 23:42:27 2013 +0200
45
+ * Added tests, recreated include-exclude code, now it works fine. Created README.rdoc
46
+ Tue Oct 1 23:42:00 2013 +0200
47
+ * Update README.md
48
+
49
+ Corrected typo Tue Oct 1 23:32:22 2013 +0200
50
+ * Update README.md Tue Oct 1 23:31:47 2013 +0200
51
+ * Initial commit
52
+ Tue Oct 1 14:21:10 2013 -0700
53
+ * Really deleted the last few lines of code.
54
+ Sat Sep 28 15:49:06 2013 +0200
55
+ * Wrapper module Oxcelix created. String, Matrix, Fixnum are not included. Sheet objects are now created as a last step instead og the simple hashes. Workbookhelper module added, with one method, [](sheetname), which accepts a string parameter and returns the sheet named sheetname. Code cleanups (especially the last lines of the code which were there only for testing purposes.)
56
+ Sat Sep 28 15:46:56 2013 +0200
57
+ * Corrected Cellhelper::x() and Cellhelper::y() methods, now both return correct values. RDoc documentation added.
58
+ Wed Sep 25 23:44:07 2013 +0200
59
+ * Added support for sheet inclusion and exclusion. Workbook#new now accepts a hash of parameters, which may contain: :copymerge (Bool), :include_sheets (Ary), :exclude_sheets (Ary)
60
+ Wed Sep 25 09:49:42 2013 +0200
61
+ * Added col_name to display excel column names. Style data of cell is now included. X and Y may get parameters. The Workbook constructor will now unzip and process the excel file. All sheets get converted to matrices. Upon the Array->Matrix conversion, the merged cells max be omitted or repeated.
62
+ Mon Sep 23 20:32:25 2013 +0200
63
+ * First gitted version.
64
+ Thu Aug 29 09:14:59 2013 +0200
data/lib/lofaszka.rb ADDED
@@ -0,0 +1,6 @@
1
+ require './oxcelix.rb'
2
+ require 'ruby-debug'
3
+ debugger
4
+ w=Oxcelix::Workbook.new('../Schedules.xlsx', :copymerge=>true)
5
+ #w=Oxcelix::Workbook.new('../Schedules.xlsx')
6
+ puts "kesz"
@@ -55,18 +55,20 @@ module Oxcelix
55
55
  @sheets=[]
56
56
  @sheetbase={}
57
57
  @sharedstrings=[]
58
+
58
59
  f=IO.read(@destination+'/xl/workbook.xml')
59
60
  @a=Ox::load(f)
60
61
 
61
62
  sheetdata(options); commentsrel; shstrings;
63
+
62
64
  @sheets.each do |x|
63
- sname="sheet#{x[:sheetId]}"
65
+
64
66
  @sheet = Xlsheet.new()
65
- File.open(@destination+"/xl/worksheets/#{sname}.xml", 'r') do |f|
67
+
68
+ File.open(@destination+"/xl/#{x[:filename]}", 'r') do |f|
66
69
  Ox.sax_parse(@sheet, f)
67
70
  end
68
- comments=
69
- mkcomments(x[:comments])
71
+ comments = mkcomments(x[:comments])
70
72
  @sheet.cellarray.each do |sh|
71
73
  if sh.type=="s"
72
74
  sh.value = @sharedstrings[sh.value.to_i]
@@ -74,7 +76,7 @@ module Oxcelix
74
76
  if !comments.nil?
75
77
  comm=comments.select {|c| c[:ref]==(sh.xlcoords)}
76
78
  if comm.size > 0
77
- sh.comment=comm
79
+ sh.comment=comm[0][:comment]
78
80
  end
79
81
  comments.delete_if{|c| c[:ref]==(sh.xlcoords)}
80
82
  end
@@ -101,6 +103,24 @@ module Oxcelix
101
103
  @sheetbase[:name] = x[:name]
102
104
  @sheetbase[:sheetId] = x[:sheetId]
103
105
  @sheetbase[:relationId] = x[:"r:id"]
106
+
107
+ relationshipfile=nil
108
+ fname=nil
109
+ unless Dir[@destination + '/xl/_rels'].empty?
110
+ Find.find(@destination + '/xl/_rels') do |path|
111
+ if File.basename(path).split(".").last=='rels'
112
+ g=IO.read(path)
113
+ relationshipfile=Ox::load(g)
114
+ end
115
+ end
116
+ end
117
+ relationshipfile.locate("Relationships/*").each do |rship|
118
+ if rship[:Id] == x[:"r:id"]
119
+ @sheetbase[:filename]=rship[:Target]
120
+ end
121
+ end
122
+
123
+
104
124
  @sheets << @sheetbase
105
125
  @sheetbase=Hash.new
106
126
  end
@@ -116,17 +136,16 @@ module Oxcelix
116
136
 
117
137
  # Build the relationship between sheets and the XML files storing the comments
118
138
  # to the actual sheet.
119
- def commentsrel #!!!MI VAN HA NINCS KOMMENT???????
139
+ def commentsrel
120
140
  unless Dir[@destination + '/xl/worksheets/_rels'].empty?
121
141
  Find.find(@destination + '/xl/worksheets/_rels') do |path|
122
142
  if File.basename(path).split(".").last=='rels'
123
- # f=Ox.load_file(path)
124
- a=IO.read(@destination+'/xl/workbook.xml')
143
+ a=IO.read(path)
125
144
  f=Ox::load(a)
126
145
  f.locate("Relationships/*").each do |x|
127
146
  if x[:Target].include?"comments"
128
147
  @sheets.each do |s|
129
- if File.basename(path,".rels")=="sheet"+s[:sheetId]+".xml"
148
+ if "worksheets/" + File.basename(path,".rels")==s[:filename]
130
149
  s[:comments]=x[:Target]
131
150
  end
132
151
  end
@@ -182,7 +201,6 @@ module Oxcelix
182
201
  # into every merged cell
183
202
  def matrixto(copymerge)
184
203
  @sheets.each_with_index do |sheet, i|
185
- #m=Matrix.build(sheet[:cells].last.y+1, sheet[:cells].last.x+1) {nil}
186
204
  m=Sheet.build(sheet[:cells].last.y+1, sheet[:cells].last.x+1) {nil}
187
205
  sheet[:cells].each do |c|
188
206
  m[c.y, c.x]=c
@@ -200,11 +218,11 @@ module Oxcelix
200
218
  (y1..y2).each do |row|
201
219
  if valuecell != nil
202
220
  valuecell.xlcoords=(col.col_name)+(row+1).to_s
203
- m[col, row]=valuecell
221
+ m[row, col]=valuecell
204
222
  else
205
223
  valuecell=Cell.new
206
224
  valuecell.xlcoords=(col.col_name)+(row+1).to_s
207
- m[col, row]=valuecell
225
+ m[row, col]=valuecell
208
226
  end
209
227
  end
210
228
  end
data/oxcelix.gemspec CHANGED
@@ -3,8 +3,8 @@
3
3
  require 'rake'
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'oxcelix'
6
- s.version = '0.2.2'
7
- s.date = '2013-10-09'
6
+ s.version = '0.2.4'
7
+ s.date = '2013-10-10'
8
8
  s.summary = 'A fast Excel 2007/2010 file parser'
9
9
  s.description = 'A fast .xlsx file parser that returns a collection of Matrix objects'
10
10
  s.authors = 'Giovanni Biczo'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oxcelix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-09 00:00:00.000000000 Z
12
+ date: 2013-10-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ox
@@ -52,22 +52,23 @@ files:
52
52
  - LICENSE
53
53
  - README.rdoc
54
54
  - README.md
55
+ - lib/lofaszka.rb
55
56
  - lib/oxcelix.rb
56
57
  - lib/oxcelix/cell.rb
57
- - lib/oxcelix/cellhelper.rb
58
- - lib/oxcelix/sheet.rb
59
58
  - lib/oxcelix/workbook.rb
60
- - lib/oxcelix/sax/comments.rb
59
+ - lib/oxcelix/sheet.rb
60
+ - lib/oxcelix/cellhelper.rb
61
61
  - lib/oxcelix/sax/sharedstrings.rb
62
62
  - lib/oxcelix/sax/xlsheet.rb
63
+ - lib/oxcelix/sax/comments.rb
63
64
  - oxcelix.gemspec
64
- - spec/cell_spec.rb
65
+ - spec/test.xlsx
66
+ - spec/spec_helper.rb
65
67
  - spec/fixnum_spec.rb
66
- - spec/matrix_spec.rb
67
68
  - spec/oxcelix_spec.rb
68
- - spec/spec_helper.rb
69
+ - spec/cell_spec.rb
70
+ - spec/matrix_spec.rb
69
71
  - spec/string_spec.rb
70
- - spec/test.xlsx
71
72
  - .yardopts
72
73
  - CHANGES
73
74
  homepage: http://github.com/gbiczo/oxcelix
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
93
  version: '0'
93
94
  requirements: []
94
95
  rubyforge_project: oxcelix
95
- rubygems_version: 1.8.24
96
+ rubygems_version: 1.8.25
96
97
  signing_key:
97
98
  specification_version: 3
98
99
  summary: A fast Excel 2007/2010 file parser