Class: BerkeleyLibrary::Util::ODS::XML::Office::DocumentContent
- Inherits:
-
ElementNode
- Object
- ElementNode
- BerkeleyLibrary::Util::ODS::XML::Office::DocumentContent
show all
- Defined in:
- lib/berkeley_library/util/ods/xml/office/document_content.rb
Constant Summary
collapse
- OFFICE_VERSION =
'1.2'.freeze
- REQUIRED_NAMESPACES =
Namespace.reject { |ns| ns == Namespace::MANIFEST }
Instance Attribute Summary
Attributes inherited from ElementNode
#doc, #element_name, #namespace
Instance Method Summary
collapse
Methods inherited from ElementNode
#add_child, #attributes, #children, #clear_attribute, #element, #ensure_element!, #prefix, #prefixed_attr_name, #set_attribute
Constructor Details
26
27
28
29
30
31
|
# File 'lib/berkeley_library/util/ods/xml/office/document_content.rb', line 26
def initialize(doc:)
super(:office, 'document-content', doc: doc)
set_default_attributes!
add_default_children!
end
|
Instance Method Details
#add_table(name, table_style = nil, protected: true) ⇒ Object
48
49
50
51
|
# File 'lib/berkeley_library/util/ods/xml/office/document_content.rb', line 48
def add_table(name, table_style = nil, protected: true)
new_table = XML::Table::Table.new(name, table_style, styles: automatic_styles, protected: protected)
new_table.tap { |table| spreadsheet.add_child(table) }
end
|
#automatic_styles ⇒ Object
44
45
46
|
# File 'lib/berkeley_library/util/ods/xml/office/document_content.rb', line 44
def automatic_styles
@automatic_styles ||= Office::AutomaticStyles.new(doc: doc)
end
|
#body ⇒ Object
57
58
59
|
# File 'lib/berkeley_library/util/ods/xml/office/document_content.rb', line 57
def body
@body ||= Body.new(doc: doc).tap { |body| body.add_child(spreadsheet) }
end
|
#create_element ⇒ Object
69
70
71
72
73
74
75
|
# File 'lib/berkeley_library/util/ods/xml/office/document_content.rb', line 69
def create_element
children.reverse_each(&:ensure_element!)
super
end
|
#font_face_decls ⇒ Object
40
41
42
|
# File 'lib/berkeley_library/util/ods/xml/office/document_content.rb', line 40
def font_face_decls
@font_face_decls ||= Office::FontFaceDecls.new(doc: doc)
end
|
#scripts ⇒ Object
Accessors and utility methods
36
37
38
|
# File 'lib/berkeley_library/util/ods/xml/office/document_content.rb', line 36
def scripts
@scripts ||= Scripts.new(doc: doc)
end
|
#spreadsheet ⇒ Object
53
54
55
|
# File 'lib/berkeley_library/util/ods/xml/office/document_content.rb', line 53
def spreadsheet
@spreadsheet ||= Office::Spreadsheet.new(doc: doc)
end
|