Skip to content
southcitygene edited this page Jan 3, 2013 · 2 revisions

Syntax

Tables are formed as a list of lists like so:

table [
  ["R1C1", "R1C2", "R1C3"],
  ["R2C1", "R2C2", "R2C3"],
  ["R3C1", "R3C2", "R3C3"],
]

Options

Border

(Default: false)

Borders are off by default to turn them on pass "borders: true" after the table content

Border Type

(Default: none)

Border type can include several different options. Single, thick, double, dash, wave, etc.
More options can be found here: OOXML

Border Color

(Default: auto)

Border color can be adjusted by handing it a hex color. e.g. "#909090"

Table Heading

(Default: true)

To disable use "headings: false"

Examples

Creating a simple table

document = Rocx::Document.new do
  body do
    heading "Let's create a table"
    table [
      ["A", "B", "C"],
      [1, 2, 3]
    ]
  end
end

Creating a table with borders

document = Rocx::Document.new do
  body do
    heading "Let's create a table with dashed grey borders"
    table [
      ["I", "Have"],
      ["Dashed", "Borders"]
    ], borders: true, border_type: 'dash', border_color: "#C0C0C0"
  end
end
Clone this wiki locally