Class: Writexlsx::Package::App

Inherits:
Object
  • Object
show all
Includes:
Utility
Defined in:
lib/write_xlsx/package/app.rb

Constant Summary

Constants included from Utility

Utility::COL_MAX, Utility::ROW_MAX, Utility::SHEETNAME_MAX, Utility::STR_MAX

Instance Method Summary collapse

Methods included from Utility

#absolute_char, #check_dimensions, #check_dimensions_and_update_max_min_values, #check_parameter, #convert_date_time, delete_files, #ptrue?, #put_deprecate_message, #row_col_notation, #store_col_max_min_values, #store_row_max_min_values, #substitute_cellref, #underline_attributes, #write_color, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell, #xml_str

Constructor Details

#initializeApp

Returns a new instance of App.



11
12
13
14
15
16
# File 'lib/write_xlsx/package/app.rb', line 11

def initialize
  @writer = Package::XMLWriterSimple.new
  @part_names    = []
  @heading_pairs = []
  @properties    = {}
end

Instance Method Details

#add_heading_pair(heading_pair) ⇒ Object



46
47
48
49
50
# File 'lib/write_xlsx/package/app.rb', line 46

def add_heading_pair(heading_pair)
  return if heading_pair[1] == 0

  @heading_pairs.push(['lpstr', heading_pair[0]], ['i4', heading_pair[1]])
end

#add_part_name(part_name) ⇒ Object



42
43
44
# File 'lib/write_xlsx/package/app.rb', line 42

def add_part_name(part_name)
  @part_names.push(part_name)
end

#assemble_xml_fileObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/write_xlsx/package/app.rb', line 22

def assemble_xml_file
  write_xml_declaration
  write_properties
  write_application
  write_doc_security
  write_scale_crop
  write_heading_pairs
  write_titles_of_parts
  write_manager
  write_company
  write_links_up_to_date
  write_shared_doc
  write_hyperlinks_changed
  write_app_version

  @writer.end_tag('Properties')
  @writer.crlf
  @writer.close
end

#set_properties(properties) ⇒ Object

Set the document properties.



55
56
57
# File 'lib/write_xlsx/package/app.rb', line 55

def set_properties(properties)
  @properties = properties
end

#set_xml_writer(filename) ⇒ Object



18
19
20
# File 'lib/write_xlsx/package/app.rb', line 18

def set_xml_writer(filename)
  @writer.set_xml_writer(filename)
end