Class: RubyXL::Workbook

Inherits:
OOXMLTopLevelObject show all
Includes:
LegacyWorkbook
Defined in:
lib/rubyXL/objects/workbook.rb

Overview

Constant Summary

Constants included from LegacyWorkbook

LegacyWorkbook::APPLICATION, LegacyWorkbook::APPVERSION, LegacyWorkbook::SHEET_NAME_TEMPLATE

Instance Attribute Summary

Attributes included from LegacyWorkbook

#calculation_chain, #chart_rels, #charts, #chartsheet_rels, #content_types, #core_properties, #document_properties, #drawings, #drawings_rels, #external_links, #external_links_rels, #filepath, #macros, #media, #printer_settings, #relationship_container, #root_relationship_container, #shared_strings_container, #stylesheet, #theme, #thumbnail, #worksheet_rels, #worksheets

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LegacyWorkbook

#[], #add_worksheet, #borders, #cell_xfs, #date_to_num, #each, #fills, #fonts, #get_fill_color, #initialize, #modify_alignment, #modify_border, #modify_fill, #modify_text_wrap, #num_to_date, #register_new_fill, #register_new_font, #register_new_xf, #write

Methods inherited from OOXMLTopLevelObject

#add_to_zip, parse_file, set_namespaces, #xlsx_path

Methods included from OOXMLObjectClassMethods

#define_attribute, #define_child_node, #define_element_name, #obtain_class_variable, #parse, #set_countable

Methods included from OOXMLObjectInstanceMethods

#dup, #index_in_collection, #initialize, #write_xml

Class Method Details

.content_typeObject



403
404
405
# File 'lib/rubyXL/objects/workbook.rb', line 403

def self.content_type
  'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'
end

.xlsx_pathObject



399
400
401
# File 'lib/rubyXL/objects/workbook.rb', line 399

def self.xlsx_path
  File.join('xl', 'workbook.xml')
end

Instance Method Details

#applicationObject



349
350
351
# File 'lib/rubyXL/objects/workbook.rb', line 349

def application
  self.document_properties.application && self.document_properties.application.value
end

#application=(v) ⇒ Object



353
354
355
356
# File 'lib/rubyXL/objects/workbook.rb', line 353

def application=(v)
  self.document_properties.application ||= StringNode.new
  self.document_properties.application.value = v
end

#appversionObject



358
359
360
# File 'lib/rubyXL/objects/workbook.rb', line 358

def appversion
  self.document_properties.app_version && self.document_properties.app_version.value
end

#appversion=(v) ⇒ Object



362
363
364
365
# File 'lib/rubyXL/objects/workbook.rb', line 362

def appversion=(v)
  self.document_properties.app_version ||= StringNode.new
  self.document_properties.app_version.value = v
end

#before_write_xmlObject



317
318
319
320
321
322
323
324
325
326
327
# File 'lib/rubyXL/objects/workbook.rb', line 317

def before_write_xml
  self.sheets = RubyXL::Sheets.new

  worksheets.each_with_index { |sheet, i|
    rel = relationship_container.find_by_target(sheet.xlsx_path.gsub(/^xl\//, ''))
    sheets << RubyXL::Sheet.new(:name => sheet.sheet_name[0..30], # Max sheet name length is 31 char
                                :sheet_id => sheet.sheet_id || (i + 1),
                                :state => sheet.state, :r_id => rel.id)
  }
  true
end

#companyObject



340
341
342
# File 'lib/rubyXL/objects/workbook.rb', line 340

def company
  self.document_properties.company && self.document_properties.company.value
end

#company=(v) ⇒ Object



344
345
346
347
# File 'lib/rubyXL/objects/workbook.rb', line 344

def company=(v)
  self.document_properties.company ||= StringNode.new
  self.document_properties.company.value = v
end

#created_atObject



383
384
385
# File 'lib/rubyXL/objects/workbook.rb', line 383

def created_at
  self.core_properties.created_at
end

#created_at=(v) ⇒ Object



387
388
389
# File 'lib/rubyXL/objects/workbook.rb', line 387

def created_at=(v)
  self.core_properties.created_at = v
end

#creatorObject



367
368
369
# File 'lib/rubyXL/objects/workbook.rb', line 367

def creator
  self.core_properties.creator
end

#creator=(v) ⇒ Object



371
372
373
# File 'lib/rubyXL/objects/workbook.rb', line 371

def creator=(v)
  self.core_properties.creator = v
end

#date1904Object



331
332
333
# File 'lib/rubyXL/objects/workbook.rb', line 331

def date1904
  workbook_properties && workbook_properties.date1904
end

#date1904=(v) ⇒ Object



335
336
337
338
# File 'lib/rubyXL/objects/workbook.rb', line 335

def date1904=(v)
  self.workbook_properties ||= RubyXL::WorkbookProperties.new
  workbook_properties.date1904 = v
end

#modified_atObject



391
392
393
# File 'lib/rubyXL/objects/workbook.rb', line 391

def modified_at
  self.core_properties.modified_at
end

#modified_at=(v) ⇒ Object



395
396
397
# File 'lib/rubyXL/objects/workbook.rb', line 395

def modified_at=(v)
  self.core_properties.modified_at = v
end

#modifierObject



375
376
377
# File 'lib/rubyXL/objects/workbook.rb', line 375

def modifier
  self.core_properties.modifier
end

#modifier=(v) ⇒ Object



379
380
381
# File 'lib/rubyXL/objects/workbook.rb', line 379

def modifier=(v)
  self.core_properties.modifier = v
end