def set_footer(string = '', margin = 0.3, options = {})
      raise 'Footer string must be less than 255 characters' if string.length >= 255

      @page_setup.footer                = string.dup

      # Replace the Excel placeholder &[Picture] with the internal &G.
      @page_setup.footer = string.gsub(/&\[Picture\]/, '&G')

      if string.size >= 255
        raise 'Header string must be less than 255 characters'
      end

      if options[:align_with_margins]
        @page_setup.header_footer_aligns = options[:align_with_margins]
      end

      if options[:scale_with_doc]
        @page_setup.header_footer_scales = options[:scale_with_doc]
      end

      # Reset the array in case the function is called more than once.
      @footer_images = []

      [
       [:image_left, 'LF'], [:image_center, 'CF'], [:image_right, 'RF']
      ].each do |p|
        if options[p.first]
          @footer_images << [options[p.first], p.last]
        end
      end

      # placeholeder /&G/ の数
      placeholder_count = @page_setup.footer.scan(/&G/).count

      image_count = @footer_images.count

      if image_count != placeholder_count
        raise "Number of footer image (#{image_count}) doesn't match placeholder count (#{placeholder_count}) in string: #{@page_setup.footer}"
      end

      @has_header_vml = true if image_count > 0

      @page_setup.margin_footer         = margin
      @page_setup.header_footer_changed = true
    end
def set_footer(string = '', margin = 0.3, options = {})
      raise 'Footer string must be less than 255 characters' if string.length >= 255

      @page_setup.footer                = string.dup

      # Replace the Excel placeholder &[Picture] with the internal &G.
      @page_setup.footer = string.gsub(/&\[Picture\]/, '&G')

      if string.size >= 255
        raise 'Header string must be less than 255 characters'
      end

      if options[:align_with_margins]
        @page_setup.header_footer_aligns = options[:align_with_margins]
      end

      if options[:scale_with_doc]
        @page_setup.header_footer_scales = options[:scale_with_doc]
      end

      # Reset the array in case the function is called more than once.
      @footer_images = []

      [
       [:image_left, 'LF'], [:image_center, 'CF'], [:image_right, 'RF']
      ].each do |p|
        if options[p.first]
          @footer_images << [options[p.first], p.last]
        end
      end

      # placeholeder /&G/ の数
      placeholder_count = @page_setup.footer.scan(/&G/).count

      image_count = @footer_images.count

      if image_count != placeholder_count
        raise "Number of footer image (#{image_count}) doesn't match placeholder count (#{placeholder_count}) in string: #{@page_setup.footer}"
      end

      @has_header_vml = true if image_count > 0

      @page_setup.margin_footer         = margin
      @page_setup.header_footer_changed = true
    end
Set the page footer caption and optional margin.

 The syntax of the set_footer() method is the same as set_header()