simonmenke-xlsx 0.0.1 → 0.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/History.txt +6 -0
- data/config/hoe.rb +1 -1
- data/lib/xlsx/cell.rb +7 -1
- data/lib/xlsx/formatter.rb +2 -35
- data/lib/xlsx/sheet.rb +5 -0
- data/lib/xlsx/version.rb +1 -1
- data/website/index.html +84 -11
- data/website/index.txt +22 -46
- metadata +19 -1
data/History.txt
CHANGED
data/config/hoe.rb
CHANGED
|
@@ -63,7 +63,7 @@ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
|
63
63
|
|
|
64
64
|
# == Optional
|
|
65
65
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
|
66
|
-
|
|
66
|
+
p.extra_deps = EXTRA_DEPENDENCIES
|
|
67
67
|
|
|
68
68
|
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
|
69
69
|
end
|
data/lib/xlsx/cell.rb
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
module XLSX
|
|
3
3
|
class Cell # :nodoc:
|
|
4
4
|
|
|
5
|
+
STYLES = {'Default' => '1',
|
|
6
|
+
'Result' => '2',
|
|
7
|
+
'Result2' => '3',
|
|
8
|
+
'Heading' => '4',
|
|
9
|
+
'Heading1' => '5'}
|
|
10
|
+
|
|
5
11
|
def self.type_of(value)
|
|
6
12
|
return 's' if value.is_a? String
|
|
7
13
|
return 'n' if value.is_a? Integer
|
|
@@ -14,7 +20,7 @@ module XLSX
|
|
|
14
20
|
Digest::SHA1.hexdigest("#{row}-#{column}")
|
|
15
21
|
end
|
|
16
22
|
|
|
17
|
-
attr_accessor :sheet, :type, :value, :row, :column
|
|
23
|
+
attr_accessor :sheet, :type, :value, :style, :row, :column
|
|
18
24
|
|
|
19
25
|
def initialize(sheet, row, column)
|
|
20
26
|
@sheet, @row, @column = sheet, row.to_i, column.to_i
|
data/lib/xlsx/formatter.rb
CHANGED
|
@@ -76,7 +76,7 @@ module XLSX
|
|
|
76
76
|
rows.each do |row|
|
|
77
77
|
xml.row({ 'r' => row.first.to_s, 'ht' => '12.1' }) do
|
|
78
78
|
row.last.each do |cell|
|
|
79
|
-
xml.c({ 'r' => "#{letter_column_name(cell.column+1)}#{row.first + 1}", 't' => cell.type }) do
|
|
79
|
+
xml.c({ 'r' => "#{letter_column_name(cell.column+1)}#{row.first + 1}", 't' => cell.type, 's' => cell.style }) do
|
|
80
80
|
xml.v(cell.value.to_s)
|
|
81
81
|
end
|
|
82
82
|
end
|
|
@@ -193,16 +193,6 @@ module XLSX
|
|
|
193
193
|
xml.fill do
|
|
194
194
|
xml.patternFill({ 'patternType' => 'gray125' })
|
|
195
195
|
end
|
|
196
|
-
xml.fill do
|
|
197
|
-
xml.patternFill({ 'patternType' => 'none' })
|
|
198
|
-
end
|
|
199
|
-
xml << "$-$"
|
|
200
|
-
xml.fill do
|
|
201
|
-
xml.patternFill({ 'patternType' => 'none' })
|
|
202
|
-
end
|
|
203
|
-
xml.fill do
|
|
204
|
-
xml.patternFill({ 'patternType' => 'none' })
|
|
205
|
-
end
|
|
206
196
|
end
|
|
207
197
|
|
|
208
198
|
xml.borders do
|
|
@@ -213,31 +203,9 @@ module XLSX
|
|
|
213
203
|
xml.bottom
|
|
214
204
|
xml.diagonal
|
|
215
205
|
end
|
|
216
|
-
xml.border do
|
|
217
|
-
xml.left
|
|
218
|
-
xml.right
|
|
219
|
-
xml.top
|
|
220
|
-
xml.bottom
|
|
221
|
-
xml.diagonal
|
|
222
|
-
end
|
|
223
|
-
xml.border do
|
|
224
|
-
xml.left
|
|
225
|
-
xml.right
|
|
226
|
-
xml.top
|
|
227
|
-
xml.bottom
|
|
228
|
-
xml.diagonal
|
|
229
|
-
end
|
|
230
|
-
xml.border do
|
|
231
|
-
xml.left
|
|
232
|
-
xml.right
|
|
233
|
-
xml.top
|
|
234
|
-
xml.bottom
|
|
235
|
-
xml.diagonal
|
|
236
|
-
end
|
|
237
206
|
end
|
|
238
207
|
|
|
239
|
-
xml.cellStyleXfs({ 'count' => '
|
|
240
|
-
xml.xf({ 'numFmtId' => '0', 'fontId' => '0', 'fillId' => '0', 'borderId' => '0' })
|
|
208
|
+
xml.cellStyleXfs({ 'count' => '5' }) do
|
|
241
209
|
xml.xf({ 'numFmtId' => '0', 'fontId' => '0', 'fillId' => '0', 'borderId' => '0' })
|
|
242
210
|
xml.xf({ 'numFmtId' => '0', 'fillId' => '0', 'borderId' => '0', 'applyFont' => '1', 'ZMIENNA_contentFontsCount' => '0', 'ZMIENNA_styleFontsCount' => '2', 'fontId' => '2' })
|
|
243
211
|
xml.xf({ 'numFmtId' => '3', 'fillId' => '0', 'borderId' => '0', 'applyFont' => '1', 'ZMIENNA_contentFontsCount' => '0', 'ZMIENNA_styleFontsCount' => '2', 'fontId' => '2' })
|
|
@@ -250,7 +218,6 @@ module XLSX
|
|
|
250
218
|
end
|
|
251
219
|
|
|
252
220
|
xml.cellXfs({ 'count' => '1' }) do
|
|
253
|
-
xml.xf({ 'numFmtId' => '0', 'fontId' => '0', 'fillId' => '0', 'borderId' => '0', 'xfId' => '0' })
|
|
254
221
|
xml.xf({ 'numFmtId' => '0', 'fontId' => '0', 'fillId' => '0', 'borderId' => '0', 'xfId' => '1' })
|
|
255
222
|
xml.xf({ 'numFmtId' => '0', 'fillId' => '0', 'borderId' => '0', 'xfId' => '2', 'applyFont' => '1', 'ZMIENNA_contentFontsCount' => '0', 'ZMIENNA_styleFontsCount' => '2', 'fontId' => '2' })
|
|
256
223
|
xml.xf({ 'numFmtId' => '3', 'fillId' => '0', 'borderId' => '0', 'xfId' => '3', 'applyFont' => '1', 'ZMIENNA_contentFontsCount' => '0', 'ZMIENNA_styleFontsCount' => '2', 'fontId' => '2' })
|
data/lib/xlsx/sheet.rb
CHANGED
data/lib/xlsx/version.rb
CHANGED
data/website/index.html
CHANGED
|
@@ -1,11 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
|
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
7
|
+
<title>
|
|
8
|
+
xlsx
|
|
9
|
+
</title>
|
|
10
|
+
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
|
|
11
|
+
<style>
|
|
12
|
+
|
|
13
|
+
</style>
|
|
14
|
+
<script type="text/javascript">
|
|
15
|
+
window.onload = function() {
|
|
16
|
+
settings = {
|
|
17
|
+
tl: { radius: 10 },
|
|
18
|
+
tr: { radius: 10 },
|
|
19
|
+
bl: { radius: 10 },
|
|
20
|
+
br: { radius: 10 },
|
|
21
|
+
antiAlias: true,
|
|
22
|
+
autoPad: true,
|
|
23
|
+
validTags: ["div"]
|
|
24
|
+
}
|
|
25
|
+
var versionBox = new curvyCorners(settings, document.getElementById("version"));
|
|
26
|
+
versionBox.applyCornersToAll();
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div id="main">
|
|
32
|
+
|
|
33
|
+
<h1>xlsx</h1>
|
|
34
|
+
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/xlsx"; return false'>
|
|
35
|
+
<p>Get Version</p>
|
|
36
|
+
<a href="http://rubyforge.org/projects/xlsx" class="numbers">0.0.1</a>
|
|
37
|
+
</div>
|
|
38
|
+
<h1>→ ‘xlsx’</h1>
|
|
39
|
+
<h2>What</h2>
|
|
40
|
+
<p>This little gem writes MS Excel 2007 xlsx files.</p>
|
|
41
|
+
<h2>Installing</h2>
|
|
42
|
+
<p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">simonmenke</span><span class="punct">-</span><span class="ident">xlsx</span></pre></p>
|
|
43
|
+
<h2>Demonstration of usage</h2>
|
|
44
|
+
<p><pre class='syntax'><span class="ident">require</span> <span class="punct">'</span><span class="string">rubygems</span><span class="punct">'</span>
|
|
45
|
+
<span class="ident">require</span> <span class="punct">'</span><span class="string">xlsx</span><span class="punct">'</span>
|
|
46
|
+
|
|
47
|
+
<span class="ident">workbook</span> <span class="punct">=</span> <span class="constant">XLSX</span><span class="punct">::</span><span class="constant">Workbook</span><span class="punct">.</span><span class="ident">new</span>
|
|
48
|
+
<span class="ident">workbook</span><span class="punct">.</span><span class="ident">add_sheet</span><span class="punct">("</span><span class="string">My sheet</span><span class="punct">")</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">sheet</span><span class="punct">|</span>
|
|
49
|
+
|
|
50
|
+
<span class="ident">sheet</span><span class="punct">[</span><span class="number">0</span><span class="punct">,</span><span class="number">0</span><span class="punct">]</span> <span class="punct">=</span> <span class="punct">'</span><span class="string">ID</span><span class="punct">'</span>
|
|
51
|
+
<span class="ident">sheet</span><span class="punct">[</span><span class="number">0</span><span class="punct">,</span><span class="number">1</span><span class="punct">]</span> <span class="punct">=</span> <span class="punct">'</span><span class="string">VALUE</span><span class="punct">'</span>
|
|
52
|
+
|
|
53
|
+
<span class="ident">sheet</span><span class="punct">[</span><span class="number">1</span><span class="punct">,</span><span class="number">0</span><span class="punct">]</span> <span class="punct">=</span> <span class="number">3</span>
|
|
54
|
+
<span class="ident">sheet</span><span class="punct">[</span><span class="number">1</span><span class="punct">,</span><span class="number">1</span><span class="punct">]</span> <span class="punct">=</span> <span class="punct">'</span><span class="string">Hello</span><span class="punct">'</span>
|
|
55
|
+
|
|
56
|
+
<span class="keyword">end</span>
|
|
57
|
+
|
|
58
|
+
<span class="ident">workbook</span><span class="punct">.</span><span class="ident">dump</span><span class="punct">('</span><span class="string">~/data.xlsx</span><span class="punct">')</span> <span class="comment"># write the file</span>
|
|
59
|
+
<span class="ident">workbook</span><span class="punct">.</span><span class="ident">build</span> <span class="comment"># or get the data</span></pre></p>
|
|
60
|
+
<h2>How to submit patches</h2>
|
|
61
|
+
<p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
|
|
62
|
+
<p>You can fetch the source from:</p>
|
|
63
|
+
<ul>
|
|
64
|
+
<li>github: <a href="http://github.com/simonmenke/xlsx/tree/master">http://github.com/simonmenke/xlsx/tree/master</a></li>
|
|
65
|
+
</ul>
|
|
66
|
+
<pre>git clone git://github.com/simonmenke/xlsx.git</pre>
|
|
67
|
+
<h3>Build and test instructions</h3>
|
|
68
|
+
<pre>cd xlsx
|
|
69
|
+
rake test
|
|
70
|
+
rake install_gem</pre>
|
|
71
|
+
<h2>License</h2>
|
|
72
|
+
<p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
|
|
73
|
+
<h2>Contact</h2>
|
|
74
|
+
<p>Comments are welcome. Send an email to <a href="mailto:simon@5xm.org">Simon Menke</a> via the <a href="http://menke.lighthouseapp.com/projects/16082-xlsx/overview">lighthouse</a></p>
|
|
75
|
+
<p class="coda">
|
|
76
|
+
<a href="simon@5xm.org">Simon Menke</a>, 27th August 2008<br>
|
|
77
|
+
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
|
78
|
+
</p>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<!-- insert site tracking codes here, like Google Urchin -->
|
|
82
|
+
|
|
83
|
+
</body>
|
|
84
|
+
</html>
|
data/website/index.txt
CHANGED
|
@@ -1,70 +1,46 @@
|
|
|
1
1
|
h1. xlsx
|
|
2
2
|
|
|
3
|
-
h1.
|
|
3
|
+
h1. → 'xlsx'
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
h2. What
|
|
7
7
|
|
|
8
|
+
This little gem writes MS Excel 2007 xlsx files.
|
|
8
9
|
|
|
9
|
-
h2. Installing
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
h2. Installing
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
<pre syntax="ruby">sudo gem install simonmenke-xlsx</pre>
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
h2. Demonstration of usage
|
|
17
17
|
|
|
18
|
+
<pre syntax="ruby">require 'rubygems'
|
|
19
|
+
require 'xlsx'
|
|
18
20
|
|
|
21
|
+
workbook = XLSX::Workbook.new
|
|
22
|
+
workbook.add_sheet("My sheet") do |sheet|
|
|
23
|
+
|
|
24
|
+
sheet[0,0] = 'ID'
|
|
25
|
+
sheet[0,1] = 'VALUE'
|
|
26
|
+
|
|
27
|
+
sheet[1,0] = 3
|
|
28
|
+
sheet[1,1] = 'Hello'
|
|
29
|
+
|
|
30
|
+
end
|
|
19
31
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"http://groups.google.com/group/xlsx":http://groups.google.com/group/xlsx
|
|
23
|
-
|
|
24
|
-
TODO - create Google Group - xlsx
|
|
32
|
+
workbook.dump('~/data.xlsx') # write the file
|
|
33
|
+
workbook.build # or get the data</pre>
|
|
25
34
|
|
|
26
35
|
h2. How to submit patches
|
|
27
36
|
|
|
28
37
|
Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
|
|
29
38
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
The trunk repository is <code>svn://rubyforge.org/var/svn/xlsx/trunk</code> for anonymous access.
|
|
33
|
-
|
|
34
|
-
OOOORRRR
|
|
35
|
-
|
|
36
|
-
You can fetch the source from either:
|
|
37
|
-
|
|
38
|
-
<% if rubyforge_project_id %>
|
|
39
|
-
|
|
40
|
-
* rubyforge: "http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>":http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>
|
|
41
|
-
|
|
42
|
-
<pre>git clone git://rubyforge.org/xlsx.git</pre>
|
|
43
|
-
|
|
44
|
-
<% else %>
|
|
45
|
-
|
|
46
|
-
* rubyforge: MISSING IN ACTION
|
|
47
|
-
|
|
48
|
-
TODO - You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
|
|
49
|
-
yet to refresh your local rubyforge data with this projects' id information.
|
|
50
|
-
|
|
51
|
-
When you do this, this message will magically disappear!
|
|
52
|
-
|
|
53
|
-
Or you can hack website/index.txt and make it all go away!!
|
|
54
|
-
|
|
55
|
-
<% end %>
|
|
56
|
-
|
|
57
|
-
* github: "http://github.com/GITHUB_USERNAME/xlsx/tree/master":http://github.com/GITHUB_USERNAME/xlsx/tree/master
|
|
58
|
-
|
|
59
|
-
<pre>git clone git://github.com/GITHUB_USERNAME/xlsx.git</pre>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
TODO - add "github_username: username" to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.
|
|
63
|
-
|
|
39
|
+
You can fetch the source from:
|
|
64
40
|
|
|
65
|
-
*
|
|
41
|
+
* github: "http://github.com/simonmenke/xlsx/tree/master":http://github.com/simonmenke/xlsx/tree/master
|
|
66
42
|
|
|
67
|
-
<pre>git clone git://
|
|
43
|
+
<pre>git clone git://github.com/simonmenke/xlsx.git</pre>
|
|
68
44
|
|
|
69
45
|
h3. Build and test instructions
|
|
70
46
|
|
|
@@ -79,5 +55,5 @@ This code is free to use under the terms of the MIT license.
|
|
|
79
55
|
|
|
80
56
|
h2. Contact
|
|
81
57
|
|
|
82
|
-
Comments are welcome. Send an email to "Simon Menke":mailto:simon@5xm.org via the "
|
|
58
|
+
Comments are welcome. Send an email to "Simon Menke":mailto:simon@5xm.org via the "lighthouse":http://menke.lighthouseapp.com/projects/16082-xlsx/overview
|
|
83
59
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simonmenke-xlsx
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Simon Menke
|
|
@@ -12,6 +12,24 @@ cert_chain: []
|
|
|
12
12
|
date: 2008-08-27 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: builder
|
|
17
|
+
version_requirement:
|
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
19
|
+
requirements:
|
|
20
|
+
- - ">="
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 2.1.2
|
|
23
|
+
version:
|
|
24
|
+
- !ruby/object:Gem::Dependency
|
|
25
|
+
name: rubyzip
|
|
26
|
+
version_requirement:
|
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
28
|
+
requirements:
|
|
29
|
+
- - ">="
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: 0.9.1
|
|
32
|
+
version:
|
|
15
33
|
- !ruby/object:Gem::Dependency
|
|
16
34
|
name: hoe
|
|
17
35
|
version_requirement:
|