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



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

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

.xlsx_pathObject



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

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

Instance Method Details

#applicationObject



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

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

#application=(v) ⇒ Object



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

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

#appversionObject



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

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

#appversion=(v) ⇒ Object



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

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
# 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, :sheet_id => sheet.sheet_id || (i + 1),
                                :state => sheet.state, :r_id => rel.id)
  }
  true
end

#companyObject



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

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

#company=(v) ⇒ Object



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

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

#created_atObject



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

def created_at
  self.core_properties.created_at
end

#created_at=(v) ⇒ Object



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

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

#creatorObject



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

def creator
  self.core_properties.creator
end

#creator=(v) ⇒ Object



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

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

#date1904Object



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

def date1904
  workbook_properties && workbook_properties.date1904
end

#date1904=(v) ⇒ Object



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

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

#modified_atObject



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

def modified_at
  self.core_properties.modified_at
end

#modified_at=(v) ⇒ Object



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

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

#modifierObject



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

def modifier
  self.core_properties.modifier
end

#modifier=(v) ⇒ Object



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

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