Module: Uniword::Docx::Reconciler::Body
- Included in:
- Uniword::Docx::Reconciler
- Defined in:
- lib/uniword/docx/reconciler/body.rb
Overview
Document body reconciliation.
Handles section properties, headers/footers, and their mc:Ignorable and paragraph backfill.
Instance Method Summary collapse
Instance Method Details
#reconcile_headers_footers ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/uniword/docx/reconciler/body.rb', line 50 def parts = package.document&. ignorable = Ooxml::Types::McIgnorable.new(FULL_IGNORABLE) parts&.each do |part| next unless part.content next if part.loaded? part.content.mc_ignorable = ignorable end unless builder_managed? (parts, generate_rsid) end end |
#reconcile_section_properties ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/uniword/docx/reconciler/body.rb', line 11 def reconcile_section_properties return unless package.document&.body body = package.document.body unless body.section_properties body.section_properties = Wordprocessingml::SectionProperties.new( page_size: Wordprocessingml::PageDefaults.default_page_size, page_margins: Wordprocessingml::PageDefaults.default_page_margins, columns: Wordprocessingml::PageDefaults.default_columns, doc_grid: Wordprocessingml::PageDefaults.default_doc_grid, ) record_fix(FixCodes::SECTION_PROPERTIES_DEFAULTED, "Added default section properties with US Letter page size", part: "word/document.xml") return end sect_pr = body.section_properties fixed = false unless sect_pr.page_size sect_pr.page_size = Wordprocessingml::PageDefaults.default_page_size fixed = true end unless sect_pr.page_margins sect_pr.page_margins = Wordprocessingml::PageDefaults.default_page_margins fixed = true end unless sect_pr.columns sect_pr.columns = Wordprocessingml::PageDefaults.default_columns fixed = true end if fixed record_fix(FixCodes::SECTION_PROPERTIES_DEFAULTED, "Filled missing pgSz/pgMar/cols in existing section properties", part: "word/document.xml") end end |