rubyXL 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.3
1
+ 1.1.4
@@ -385,6 +385,8 @@ module RubyXL
385
385
  end
386
386
 
387
387
  wb.shared_strings_XML = files['sharedString'].to_s
388
+ wb.defined_names = files['workbook'].css('definedNames').to_s
389
+
388
390
 
389
391
  wb.worksheets = Array.new(@num_sheets) #array of Worksheet objs
390
392
  wb
@@ -16,7 +16,7 @@ module RubyXL
16
16
  :modified_at, :company, :application, :appversion, :num_fmts, :fonts, :fills,
17
17
  :borders, :cell_xfs, :cell_style_xfs, :cell_styles, :shared_strings, :calc_chain,
18
18
  :num_strings, :size, :date1904, :external_links, :style_corrector, :drawings,
19
- :worksheet_rels, :printer_settings, :macros, :colors, :shared_strings_XML
19
+ :worksheet_rels, :printer_settings, :macros, :colors, :shared_strings_XML, :defined_names
20
20
 
21
21
  APPLICATION = 'Microsoft Macintosh Excel'
22
22
  APPVERSION = '12.0000'
@@ -55,6 +55,7 @@ module RubyXL
55
55
  @macros = nil
56
56
  @colors = nil
57
57
  @shared_strings_XML = nil
58
+ @defined_names = nil
58
59
 
59
60
  begin
60
61
  @created_at = DateTime.parse(created_at).strftime('%Y-%m-%dT%TZ')
@@ -1085,12 +1085,14 @@ class Worksheet < PrivateClass
1085
1085
 
1086
1086
  #change cols array
1087
1087
  def change_cols(i,col_index)
1088
+ style = '0'
1088
1089
  if @cols[i].nil?
1089
1090
  @cols << {:attributes=>{:style=>nil,:min=>nil,:max=>nil,:width=>nil,:customWidth=>nil}}
1090
1091
  else
1091
1092
  @cols << deep_copy(@cols[i])
1093
+ style = @cols[i][:attributes][:style]
1092
1094
  end
1093
- @cols.last[:attributes][:style] = (@workbook.cell_xfs[:xf].size-1).to_s
1095
+ @cols.last[:attributes][:style] = style
1094
1096
  @cols.last[:attributes][:min] = (Integer(col_index)+1).to_s
1095
1097
  @cols.last[:attributes][:max] = (Integer(col_index)+1).to_s
1096
1098
  @cols.last[:attributes][:width] = '10'
@@ -44,15 +44,11 @@ module Writer
44
44
  end
45
45
  }
46
46
  end
47
- # unless @workbook.definedNames.nil?
48
- # xml.definedNames {
49
- # @workbook.definedNames.each do |name|
50
- # xml.definedName('name'=>name[:attributes][:name]) {
51
- # # name[:]
52
- # }
53
- # end
54
- # }
55
- # end
47
+
48
+ # nokogiri builder creates CDATA tag around content,
49
+ # using .text creates "html safe" &lt; and &gt; in place of < and >
50
+ # xml to hash method does not seem to function well for this particular piece of xml
51
+ xml.cdata @workbook.defined_names.to_s
56
52
 
57
53
  #TODO see if this changes with formulas
58
54
  #attributes out of order here
@@ -66,9 +62,15 @@ module Writer
66
62
  }
67
63
  end
68
64
  contents = builder.to_xml
65
+ p contents
69
66
  contents = contents.gsub(/\n/,'')
70
67
  contents = contents.gsub(/>(\s)+</,'><')
68
+ contents = contents.gsub(/<!\[CDATA\[(.*)\]\]>/,'\1')
71
69
  contents = contents.sub(/<\?xml version=\"1.0\"\?>/,'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n")
70
+ puts '
71
+
72
+ '
73
+ puts contents
72
74
 
73
75
  contents
74
76
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rubyXL}
8
- s.version = "1.1.3"
8
+ s.version = "1.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Vivek Bhagwat"]
12
- s.date = %q{2011-08-11}
12
+ s.date = %q{2011-08-12}
13
13
  s.description = %q{rubyXL is a gem which allows the parsing, creation, and manipulation of Microsoft Excel (.xlsx/.xlsm) Documents}
14
14
  s.email = %q{bhagwat.vivek@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyXL
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 3
10
- version: 1.1.3
9
+ - 4
10
+ version: 1.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vivek Bhagwat
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-11 00:00:00 -04:00
18
+ date: 2011-08-12 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency