Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoset worksheet name if options[:name] is nil #437

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/axlsx/workbook/worksheet/worksheet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def initialize(wb, options={})
parse_options options
@workbook.worksheets << self
@sheet_id = index + 1
name
yield self if block_given?
end

Expand Down
5 changes: 5 additions & 0 deletions test/workbook/worksheet/tc_worksheet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ def test_row_style
end
end

def test_to_sheet_node_xml_string_without_name
doc = Nokogiri::XML(@ws.to_sheet_node_xml_string)
assert_equal(doc.xpath('/sheet/@name').size, 1)
end

def test_to_xml_string_fit_to_page
@ws.page_setup.fit_to_width = 1
doc = Nokogiri::XML(@ws.to_xml_string)
Expand Down