Class: Uniword::Caption::CrossReference

Inherits:
Object
  • Object
show all
Defined in:
lib/uniword/caption/cross_reference.rb

Overview

Builds a REF fldSimple that references a bookmark, producing display text like "Figure 3" or "Table 2" when Word renders it.

For Word to refresh these fields on open, set Settings#update_fields (the w:updateFields element) to UpdateFields.new before saving.

Instance Method Summary collapse

Constructor Details

#initialize(bookmark_name) ⇒ CrossReference

Returns a new instance of CrossReference.

Parameters:

  • bookmark_name (String)

    target bookmark name



13
14
15
# File 'lib/uniword/caption/cross_reference.rb', line 13

def initialize(bookmark_name)
  @bookmark_name = bookmark_name
end

Instance Method Details

#buildWordprocessingml::SimpleField



18
19
20
21
22
23
# File 'lib/uniword/caption/cross_reference.rb', line 18

def build
  Wordprocessingml::SimpleField.new(
    instr: instruction,
    runs: [placeholder_run],
  )
end