simple-spreadsheet-extractor 0.2
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/LICENCE +29 -0
- data/README.rdoc +38 -0
- data/jars/lib/dom4j-1.6.1.jar +0 -0
- data/jars/lib/poi-3.6.jar +0 -0
- data/jars/lib/poi-ooxml-3.6.jar +0 -0
- data/jars/lib/poi-ooxml-schemas-3.6.jar +0 -0
- data/jars/lib/xmlbeans-2.3.0.jar +0 -0
- data/jars/simple-spreadsheet-extractor-0.2.jar +0 -0
- data/lib/spreadsheet-extractor.rb +34 -0
- metadata +75 -0
data/LICENCE
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Copyright (c) 2010, The University of Manchester, UK.
|
2
|
+
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
7
|
+
|
8
|
+
* Redistributions of source code must retain the above copyright notice,
|
9
|
+
this list of conditions and the following disclaimer.
|
10
|
+
|
11
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
13
|
+
and/or other materials provided with the distribution.
|
14
|
+
|
15
|
+
* Neither the names of The University of Manchester nor the names of its
|
16
|
+
contributors may be used to endorse or promote products derived from this
|
17
|
+
software without specific prior written permission.
|
18
|
+
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
22
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
23
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
24
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29
|
+
POSSIBILITY OF SUCH DAMAGE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
= Simple Spreadsheet Extractor
|
2
|
+
|
3
|
+
Authors:: Stuart Owen
|
4
|
+
Version:: 0.2
|
5
|
+
Contact:: mailto:stuart.owen@manchester.ac.uk
|
6
|
+
Licence:: BSD (See LICENCE or http://www.opensource.org/licenses/bsd-license.php)
|
7
|
+
Copyright:: (c) 2010 The University of Manchester, UK
|
8
|
+
|
9
|
+
|
10
|
+
== Synopsis
|
11
|
+
|
12
|
+
This is a simple gem that provides a facility to read and XLS or XLSX spreadsheet and produce an XML representation of its contents
|
13
|
+
|
14
|
+
Internally it uses Apache POI, using the sister [http://github.com/myGrid/simple-spreadsheet-extractor] tool.
|
15
|
+
|
16
|
+
This is a simple tool developed for use within SysMO-DB[http://www.sysmo-db.org].
|
17
|
+
|
18
|
+
== Installation
|
19
|
+
|
20
|
+
Java 1.6 (JRE) is required.
|
21
|
+
|
22
|
+
[sudo] gem install simple-spreadsheet-extractor
|
23
|
+
|
24
|
+
== Usage
|
25
|
+
|
26
|
+
* require 'spreadsheet-extractor'
|
27
|
+
* include the module SysMODB::SpreadsheetExtractor
|
28
|
+
* pass an IO object to the method spreedsheet_to_xml which responds with the XML for the contents of the sheet.
|
29
|
+
|
30
|
+
e.g.
|
31
|
+
|
32
|
+
require 'rubygems'
|
33
|
+
require 'spreadsheet-extractor'
|
34
|
+
|
35
|
+
include SysMODB::SpreadsheetExtractor
|
36
|
+
|
37
|
+
f=open("/tmp/test-spreadsheet.xls")
|
38
|
+
puts spreadsheet_to_xml f
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
3
|
+
module SysMODB
|
4
|
+
module SpreadsheetExtractor
|
5
|
+
|
6
|
+
JAR_PATH = File.dirname(__FILE__) + "/../jars"
|
7
|
+
|
8
|
+
def spreadsheet_to_xml spreadsheet_data
|
9
|
+
command = "java -jar #{JAR_PATH}/simple-spreadsheet-extractor-0.2.jar"
|
10
|
+
stdin,stdout,stderr = Open3.popen3(command)
|
11
|
+
|
12
|
+
while ((line = spreadsheet_data.gets) != nil) do
|
13
|
+
stdin << line
|
14
|
+
end
|
15
|
+
stdin.close
|
16
|
+
|
17
|
+
# if !(line=stderr.gets).nil?
|
18
|
+
# msg=line
|
19
|
+
# while ((line=stderr.gets)!= nil) do
|
20
|
+
# msg << line
|
21
|
+
# end
|
22
|
+
# raise Exception.new(msg)
|
23
|
+
# end
|
24
|
+
|
25
|
+
output = ""
|
26
|
+
while ((line = stdout.gets) != nil) do
|
27
|
+
output << line
|
28
|
+
end
|
29
|
+
|
30
|
+
return output
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simple-spreadsheet-extractor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
version: "0.2"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Stuart Owen
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-07-23 00:00:00 +01:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: Takes a stream to a spreadsheet file and produces and XML representation of its contents
|
22
|
+
email: stuart.owen@manchester.ac.uk
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.rdoc
|
29
|
+
- LICENCE
|
30
|
+
files:
|
31
|
+
- lib/spreadsheet-extractor.rb
|
32
|
+
- jars/lib/poi-ooxml-schemas-3.6.jar
|
33
|
+
- jars/lib/poi-3.6.jar
|
34
|
+
- jars/lib/xmlbeans-2.3.0.jar
|
35
|
+
- jars/lib/dom4j-1.6.1.jar
|
36
|
+
- jars/lib/poi-ooxml-3.6.jar
|
37
|
+
- jars/simple-spreadsheet-extractor-0.2.jar
|
38
|
+
- README.rdoc
|
39
|
+
- LICENCE
|
40
|
+
has_rdoc: true
|
41
|
+
homepage: http://www.sysmo-db.org
|
42
|
+
licenses: []
|
43
|
+
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
hash: 3
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
version: "0"
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
requirements: []
|
68
|
+
|
69
|
+
rubyforge_project:
|
70
|
+
rubygems_version: 1.3.7
|
71
|
+
signing_key:
|
72
|
+
specification_version: 3
|
73
|
+
summary: Basic spreadsheet content extraction using Apache POI
|
74
|
+
test_files: []
|
75
|
+
|