lib/write_xlsx/chartsheet.rb in write_xlsx-0.72.2 vs lib/write_xlsx/chartsheet.rb in write_xlsx-0.72.3.beta1
- old
+ new
@@ -30,45 +30,33 @@
#
# Assemble and write the XML file.
#
def assemble_xml_file # :nodoc:
return unless @writer
- @writer.xml_decl
- # Write the root chartsheet element.
- write_chartsheet
-
- # Write the worksheet properties.
- write_sheet_pr
-
- # Write the sheet view properties.
- write_sheet_views
-
- # Write the sheetProtection element.
- write_sheet_protection
-
- # Write the printOptions element.
- write_print_options
-
- # Write the worksheet page_margins.
- write_page_margins
-
- # Write the worksheet page setup.
- write_page_setup
-
- # Write the headerFooter element.
- write_header_footer
-
- # Write the drawing element.
- write_drawings
-
- # Close the worksheet tag.
- @writer.end_tag('chartsheet')
-
- # Close the XML writer object and filehandle.
- @writer.crlf
- @writer.close
+ write_xml_declaration do
+ # Write the root chartsheet element.
+ write_chartsheet
+ # Write the worksheet properties.
+ write_sheet_pr
+ # Write the sheet view properties.
+ write_sheet_views
+ # Write the sheetProtection element.
+ write_sheet_protection
+ # Write the printOptions element.
+ write_print_options
+ # Write the worksheet page_margins.
+ write_page_margins
+ # Write the worksheet page setup.
+ write_page_setup
+ # Write the headerFooter element.
+ write_header_footer
+ # Write the drawing element.
+ write_drawings
+ # Close the worksheet tag.
+ @writer.end_tag('chartsheet')
+ end
end
def protect(password = '', options = {})
@chart.protection = 1
@@ -186,12 +174,12 @@
xmlns_mv = 'urn:schemas-microsoft-com:mac:vml'
mc_ignorable = 'mv'
mc_preserve_attributes = 'mv:*'
attributes = [
- 'xmlns', xmlns,
- 'xmlns:r', xmlns_r
+ ['xmlns', xmlns],
+ ['xmlns:r', xmlns_r]
]
@writer.start_tag('chartsheet', attributes)
end
@@ -200,10 +188,10 @@
#
def write_sheet_pr # :nodoc:
attributes = []
- attributes << {'filterMode' => 1} if ptrue?(@filter_on)
+ attributes << ['filterMode', 1] if ptrue?(@filter_on)
if ptrue?(@fit_page) || ptrue?(@tab_color)
@writer.tag_elements('sheetPr', attributes) do
write_tab_color
write_page_set_up_pr