spreadsheet 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f946dbf91667dd6ef906878767b19300c7716c2d
4
- data.tar.gz: 816f5a100e56b94e9b37066cd51561787311a7cc
3
+ metadata.gz: 926c6501fb68f9493ad9bb07def1899de3623365
4
+ data.tar.gz: 5e1000f98af4272eb336d7eebb53fe55271bded0
5
5
  SHA512:
6
- metadata.gz: dd5ce2add182a2c545cf01d140a5044a17c11d44ef213758339c7b10e23bb9117a4cfea9c3d5dbdfac7f56fc1b7b709db973cb5fb4023d171ae2a2a688f3d032
7
- data.tar.gz: 4a4d7a2545074532e2d956acc93345dfdb1f84f1c35509260a4a5da57556aa4365fa15d1b48fc593eedb0d250f46cbedb11c2ea333a5b96909694ccccfc07a8e
6
+ metadata.gz: 3a189de4adf2089980e6551ef5358ec8392a89bb47d3be9e3305c79b59dc9f8d2ceed9331baab9279f24b28c13f96f5ca936c4e09cf167695d0f993dd7d2e2ac
7
+ data.tar.gz: e242c96fc0dfbad11271e1b52764f54c9a4d6ec9c51dce92fd87f0b3adf7d17d1e8b8cac73d16078b46f95335e3fdc07cb83bb788e43cc7caeb16d4ffe42fc3c
data/History.md CHANGED
@@ -1,3 +1,15 @@
1
+ ### 1.0.7 / 23.09.2015
2
+
3
+ Author: Leopoldo Lee Agdeppa III <leopoldo.agdeppa@gmail.com>
4
+ Date: Wed Sep 23 08:24:16 2015 +0800
5
+
6
+ * Update worksheet.rb
7
+ * Adding Test for Freeze panels
8
+ * Update worksheet.rb
9
+ * Added freeze (freeze panel) functionality
10
+ * Update worksheet.rb
11
+ * Freeze (freeze window) functionality added to worksheet
12
+
1
13
  ### 1.0.6 / 14.09.2015
2
14
 
3
15
  Author: Yann Plancqueel <yplancqueel@gmail.com>
data/lib/spreadsheet.rb CHANGED
@@ -45,7 +45,7 @@ module Spreadsheet
45
45
 
46
46
  ##
47
47
  # The version of Spreadsheet you are using.
48
- VERSION = '1.0.6'
48
+ VERSION = '1.0.7'
49
49
 
50
50
  ##
51
51
  # Default client Encoding. Change this value if your application uses a
@@ -848,8 +848,29 @@ and minimal code that generates this warning. Thanks!
848
848
  end
849
849
  flags |= 0x0080 # Show outline symbols,
850
850
  # but if [Row|Column]#outline_level = 0 the symbols are not shown.
851
+
852
+ if @worksheet.has_frozen_panel?
853
+ # See:
854
+ # OpenOffice.org's Documentation of the Microsoft Excel File FormatExcel
855
+ # Versions 2, 3, 4, 5, 95, 97, 2000, XP, 2003
856
+ # https://www.openoffice.org/sc/excelfileformat.pdf
857
+ # section 5.110.2
858
+ flags |= 0x0008 #Panes are frozen (freeze)
859
+ end
851
860
  data = [ flags, 0, 0, 0, 0, 0 ].pack binfmt(:window2)
861
+
852
862
  write_op opcode(:window2), data
863
+ if @worksheet.has_frozen_panel?
864
+ # See:
865
+ # OpenOffice.org's Documentation of the Microsoft Excel File FormatExcel
866
+ # Versions 2, 3, 4, 5, 95, 97, 2000, XP, 2003
867
+ # https://www.openoffice.org/sc/excelfileformat.pdf
868
+ # section 5.75
869
+ puts "[Spreadsheet Freeze] Freeze is being activated"
870
+ pane_data = [@worksheet.froze_left, @worksheet.froze_top, @worksheet.froze_top, @worksheet.froze_left, 3].pack binfmt(:colinfo)
871
+ write_op opcode(:pane), pane_data
872
+ end
873
+
853
874
  end
854
875
 
855
876
  def write_merged_cells
@@ -30,8 +30,11 @@ module Spreadsheet
30
30
  include Enumerable
31
31
  attr_accessor :name, :selected, :workbook, :password_hash
32
32
  attr_reader :rows, :columns, :merged_cells, :margins, :pagesetup
33
+ attr_reader :froze_top, :froze_left
33
34
  enum :visibility, :visible, :hidden, :strong_hidden
34
35
  def initialize opts={}
36
+ @froze_top = 0
37
+ @froze_left = 0
35
38
  @default_format = nil
36
39
  @selected = opts[:selected]
37
40
  @dimensions = [0,0,0,0]
@@ -56,6 +59,14 @@ module Spreadsheet
56
59
  @password_hash = 0
57
60
  @visibility = opts[:visibility]
58
61
  end
62
+ def has_frozen_panel?
63
+ @froze_top > 0 or @froze_left > 0
64
+ end
65
+
66
+ def freeze!(top, left)
67
+ @froze_top = top.to_i
68
+ @froze_left = left.to_i
69
+ end
59
70
  def active # :nodoc:
60
71
  warn "Worksheet#active is deprecated. Please use Worksheet#selected instead."
61
72
  selected
data/test/worksheet.rb CHANGED
@@ -108,5 +108,18 @@ module Spreadsheet
108
108
  assert_equal 6, @book.formats.length
109
109
 
110
110
  end
111
+
112
+ def test_freeze_panel!
113
+ assert_equal 0, @sheet.froze_top
114
+ assert_equal 0, @sheet.froze_left
115
+ assert_equal false, @sheet.has_frozen_panel?
116
+
117
+ @sheet.freeze!(2, 3)
118
+ assert_equal 2, @sheet.froze_top
119
+ assert_equal 3, @sheet.froze_left
120
+ assert_equal true, @sheet.has_frozen_panel?
121
+
122
+ end
123
+
111
124
  end
112
125
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreadsheet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-14 00:00:00.000000000 Z
11
+ date: 2015-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-ole
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  version: '0'
181
181
  requirements: []
182
182
  rubyforge_project: spreadsheet
183
- rubygems_version: 2.2.0
183
+ rubygems_version: 2.4.5
184
184
  signing_key:
185
185
  specification_version: 4
186
186
  summary: The Spreadsheet Library is designed to read and write Spreadsheet Documents