rubyexcel 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubyexcel/excel_tools.rb +13 -4
- data/lib/rubyexcel/section.rb +1 -0
- data/lib/rubyexcel.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a886e1774da95739b10c75471587a8fd5cbcbc2
|
4
|
+
data.tar.gz: 6cb4e9b43a22f0fe52ff9b240d9163898a5e795d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3567d1778918a2800cd22359f48e8dd67251b26cd20e8ec0e41445a87d6db1ec2dbc33fc9d65b482f1ba3c181e4b682edb42cd4c94b62f4a3f97f0fe5d95717
|
7
|
+
data.tar.gz: 8edbc74284c3364a2634243dbbcad3e9b663d881e0f59ab9d91eb63fbb3e94ef3845357d9c956657326e6b06d4707434f482262289a4a75e6794daba8d590890
|
@@ -29,6 +29,16 @@ module RubyExcel
|
|
29
29
|
|
30
30
|
class Workbook
|
31
31
|
|
32
|
+
#
|
33
|
+
# Find the Windows "Documents" or "My Documents" path, or return the present working directory if it can't be found.
|
34
|
+
#
|
35
|
+
# @return [String]
|
36
|
+
#
|
37
|
+
|
38
|
+
def documents_path
|
39
|
+
Win32::Registry::HKEY_CURRENT_USER.open( 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders' )['Personal'] rescue Dir.pwd.gsub('/','\\')
|
40
|
+
end
|
41
|
+
|
32
42
|
#
|
33
43
|
# Drop a multidimensional Array into an Excel Sheet
|
34
44
|
#
|
@@ -98,12 +108,11 @@ module RubyExcel
|
|
98
108
|
# @return [WIN32OLE::Workbook] the Workbook, saved as filename.
|
99
109
|
#
|
100
110
|
|
101
|
-
def save_excel( filename =
|
111
|
+
def save_excel( filename = nil, invisible = false )
|
112
|
+
filename ||= name
|
102
113
|
filename = filename.gsub('/','\\')
|
103
114
|
unless filename.include?('\\')
|
104
|
-
|
105
|
-
documents = Win32::Registry::HKEY_CURRENT_USER.open(keypath)['Personal'] rescue Dir.pwd.gsub('/','\\')
|
106
|
-
filename = documents + '\\' + filename
|
115
|
+
filename = documents_path + '\\' + filename
|
107
116
|
end
|
108
117
|
wb = to_excel( invisible )
|
109
118
|
wb.saveas filename
|
data/lib/rubyexcel/section.rb
CHANGED
data/lib/rubyexcel.rb
CHANGED
@@ -33,13 +33,17 @@ module RubyExcel
|
|
33
33
|
include Enumerable
|
34
34
|
|
35
35
|
# Names of methods which require win32ole
|
36
|
-
ExcelToolsMethods = [ :dump_to_sheet, :get_excel, :get_workbook, :make_sheet_pretty, :save_excel, :to_excel, :to_safe_format, :to_safe_format! ]
|
36
|
+
ExcelToolsMethods = [ :documents_path, :dump_to_sheet, :get_excel, :get_workbook, :make_sheet_pretty, :save_excel, :to_excel, :to_safe_format, :to_safe_format! ]
|
37
|
+
|
38
|
+
# Get and set the Workbook name
|
39
|
+
attr_accessor :name
|
37
40
|
|
38
41
|
#
|
39
42
|
# Creates a RubyExcel::Workbook instance.
|
40
43
|
#
|
41
44
|
|
42
|
-
def initialize
|
45
|
+
def initialize( name = 'Output' )
|
46
|
+
@name = name
|
43
47
|
@sheets = []
|
44
48
|
end
|
45
49
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyexcel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Pearson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A tabular data structure in Ruby, with header-based helper methods for
|
14
14
|
analysis and editing, and some of Excel's API style. Can output as 2D Array, Excel,
|