summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-02-22 21:30:00 +0900
committerRandy Morgan <[email protected]>2012-02-22 21:30:00 +0900
commitc22fbb916b01495f90aa5430c00dc063f1690f98 (patch)
tree48717e3b2d6b999f262e74d1690675a143c22faa
parentc8e48f19ada9b9ece648eba38ee8781d51e955e5 (diff)
downloadcaxlsx-c22fbb916b01495f90aa5430c00dc063f1690f98.tar.gz
caxlsx-c22fbb916b01495f90aa5430c00dc063f1690f98.zip
updating workbook views to actually include references to each worksheet, and the worksheet to point to its on sheetView as well as selection. I'll move the selection and tab selection out to programable values when I have a bit more time.
-rw-r--r--lib/axlsx/workbook/workbook.rb6
-rw-r--r--lib/axlsx/workbook/worksheet/worksheet.rb6
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb
index 9bb63462..51f38b50 100644
--- a/lib/axlsx/workbook/workbook.rb
+++ b/lib/axlsx/workbook/workbook.rb
@@ -181,7 +181,11 @@ require 'axlsx/workbook/shared_strings_table.rb'
xml.workbookPr(:date1904=>@@date1904)
#<x:workbookProtection workbookPassword="xsd:hexBinary data" lockStructure="1" lockWindows="1" />
# Required to support rubyXL parsing as it requires sheetView, which requires this.
- xml.bookViews { xml.workbookView :activeTab=>0 }
+ xml.bookViews {
+ worksheets.count.times do
+ xml.workbookView :activeTab=>0
+ end
+ }
xml.sheets {
@worksheets.each_with_index do |sheet, index|
xml.sheet(:name=>sheet.name, :sheetId=>index+1, :"r:id"=>sheet.rId)
diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb
index bd2170a5..5284c475 100644
--- a/lib/axlsx/workbook/worksheet/worksheet.rb
+++ b/lib/axlsx/workbook/worksheet/worksheet.rb
@@ -298,7 +298,11 @@ module Axlsx
# another patch for the folks at rubyXL as thier parser depends on this optional element.
xml.dimension :ref=>dimension unless rows.size == 0
# this is required by rubyXL, spec says who cares - but it seems they didnt notice
- xml.sheetViews { xml.sheetView :workbookViewId =>0 }
+ xml.sheetViews {
+ xml.sheetView(:tabSelected => 1, :workbookViewId => index) {
+ xml.selection :activeCell=>"A1", :sqref => "A1"
+ }
+ }
if @auto_fit_data.size > 0
xml.cols {