Class: Docxer::Word::Document
- Inherits:
-
Object
- Object
- Docxer::Word::Document
- Includes:
- Helpers
- Defined in:
- lib/docxer/word/document.rb
Instance Attribute Summary collapse
-
#effects ⇒ Object
Returns the value of attribute effects.
-
#endnotes ⇒ Object
Returns the value of attribute endnotes.
-
#fonts ⇒ Object
Returns the value of attribute fonts.
-
#footers ⇒ Object
Returns the value of attribute footers.
-
#footnotes ⇒ Object
Returns the value of attribute footnotes.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#numbering ⇒ Object
Returns the value of attribute numbering.
-
#options ⇒ Object
Returns the value of attribute options.
-
#relationships ⇒ Object
Returns the value of attribute relationships.
-
#setings ⇒ Object
Returns the value of attribute setings.
-
#styles ⇒ Object
Returns the value of attribute styles.
-
#themes ⇒ Object
Returns the value of attribute themes.
-
#web_settings ⇒ Object
Returns the value of attribute web_settings.
Instance Method Summary collapse
- #add_footer(footer, options = {}) ⇒ Object
- #add_header(header, options = {}) ⇒ Object
- #add_media(file, options = {}) ⇒ Object
-
#initialize(options) ⇒ Document
constructor
A new instance of Document.
- #medias ⇒ Object
- #render(zip) ⇒ Object
- #settings ⇒ Object
Methods included from Helpers
#br, #p, #table, #table_of_content, #text
Constructor Details
#initialize(options) ⇒ Document
Returns a new instance of Document.
9 10 11 12 |
# File 'lib/docxer/word/document.rb', line 9 def initialize() @options = @content = [] end |
Instance Attribute Details
#effects ⇒ Object
Returns the value of attribute effects.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def effects @effects end |
#endnotes ⇒ Object
Returns the value of attribute endnotes.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def endnotes @endnotes end |
#fonts ⇒ Object
Returns the value of attribute fonts.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def fonts @fonts end |
#footers ⇒ Object
Returns the value of attribute footers.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def @footers end |
#footnotes ⇒ Object
Returns the value of attribute footnotes.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def footnotes @footnotes end |
#headers ⇒ Object
Returns the value of attribute headers.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def headers @headers end |
#numbering ⇒ Object
Returns the value of attribute numbering.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def numbering @numbering end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def @options end |
#relationships ⇒ Object
Returns the value of attribute relationships.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def relationships @relationships end |
#setings ⇒ Object
Returns the value of attribute setings.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def setings @setings end |
#styles ⇒ Object
Returns the value of attribute styles.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def styles @styles end |
#themes ⇒ Object
Returns the value of attribute themes.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def themes @themes end |
#web_settings ⇒ Object
Returns the value of attribute web_settings.
7 8 9 |
# File 'lib/docxer/word/document.rb', line 7 def web_settings @web_settings end |
Instance Method Details
#add_footer(footer, options = {}) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/docxer/word/document.rb', line 21 def (, ={}) .id = .sequence rel = relationships.add(.content_type, .target) .sequence = rel.id .add() @footer = end |
#add_header(header, options = {}) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/docxer/word/document.rb', line 29 def add_header(header, ={}) header.id = headers.sequence rel = relationships.add(header.content_type, header.target) header.sequence = rel.id headers.add(header) @header = header end |
#add_media(file, options = {}) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/docxer/word/document.rb', line 14 def add_media(file, ={}) media = Medias::Media.new(medias.sequence, file, ) rel = relationships.add(media.content_type, media.target) media.set_sequence(rel.id) medias.add(media) end |
#medias ⇒ Object
65 66 67 |
# File 'lib/docxer/word/document.rb', line 65 def medias @medias ||= Medias.new end |
#render(zip) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/docxer/word/document.rb', line 89 def render(zip) zip.put_next_entry('word/document.xml') zip.write(Docxer.to_xml(document)) fonts.render(zip) settings.render(zip) styles.render(zip) effects.render(zip) numbering.render(zip) web_settings.render(zip) themes.render(zip) footnotes.render(zip) endnotes.render(zip) headers.render(zip) .render(zip) medias.render(zip) relationships.render(zip) end |