Sha256: 7f0625450a88e7da08a5ed52ebd367f4f276cbff5a1b358c05c2718c1f4c28ae
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true # TODO: Only support create new table for now. # TODO: To parse a table from exist file for replacement someday require 'goldendocx/tables' module Goldendocx module Components class Table include Goldendocx::Element attr_reader :headers namespace :w tag :tbl embeds_one :property, class_name: 'Goldendocx::Tables::Properties::Property', auto_build: true embeds_one :grid_property, class_name: 'Goldendocx::Tables::Properties::GridProperty', auto_build: true embeds_one :header, class_name: 'Goldendocx::Tables::HeaderRow', auto_build: true embeds_many :rows, class_name: 'Goldendocx::Tables::Row' def width=(width) property.table_width.width = width if width end def style=(style) property.table_style.style_id = style if style end def add_header(title, width: nil) header.build_cell(content: title, width:) grid_property.build_grid_column(width:) if width header end def add_row(cells) row = build_row cells.each { |data| row.add_cell data } row end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
goldendocx-0.3.0 | lib/goldendocx/components/table.rb |