From 0fd87cb0093f917e535e681507d8bf74467e584b Mon Sep 17 00:00:00 2001 From: ak Date: Thu, 14 Nov 2019 12:12:55 +0530 Subject: [PATCH 1/2] create a style.xml file if its not compressed with existing xlsx file compress set --- lib/roo/excelx/shared.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/roo/excelx/shared.rb b/lib/roo/excelx/shared.rb index bcd2c08b..771c7729 100755 --- a/lib/roo/excelx/shared.rb +++ b/lib/roo/excelx/shared.rb @@ -16,6 +16,12 @@ def initialize(dir, options = {}) end def styles + begin + file_path = File.join(@dir, 'roo_styles.xml') + File.open(file_path) + rescue + File.open(file_path, "w") + end @styles ||= Styles.new(File.join(@dir, 'roo_styles.xml')) end From a8ddffcf0ad3d6ce68261d63ea41a3986096bf74 Mon Sep 17 00:00:00 2001 From: ak Date: Thu, 14 Nov 2019 12:14:01 +0530 Subject: [PATCH 2/2] [create new style xml file if not present with xlsx set] --- lib/roo/excelx/shared.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/roo/excelx/shared.rb b/lib/roo/excelx/shared.rb index 771c7729..f29ad070 100755 --- a/lib/roo/excelx/shared.rb +++ b/lib/roo/excelx/shared.rb @@ -16,13 +16,9 @@ def initialize(dir, options = {}) end def styles - begin - file_path = File.join(@dir, 'roo_styles.xml') - File.open(file_path) - rescue - File.open(file_path, "w") - end - @styles ||= Styles.new(File.join(@dir, 'roo_styles.xml')) + file_path = File.join(@dir, 'roo_styles.xml') + File.new(file_path, "a+") {} unless File.exists?(file_path) + @styles ||= Styles.new(file_path) end def shared_strings