Skip to content

Commit

Permalink
Merge pull request #62 from nerde/patch-1
Browse files Browse the repository at this point in the history
README improvements.
  • Loading branch information
sandrods committed Dec 9, 2014
2 parents 7c011d3 + d4c4d93 commit 3d4c5d6
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions README.textile
Expand Up @@ -18,10 +18,8 @@ h2. USAGE

h3. Step 1 -- the template

First of all, you need to create a .odt file to serve as a template

Templates are normal .odt files with placeholders for Substitutions

First of all, you need to create a .odt file to serve as a template.
Templates are normal .odt files with placeholders for *substitutions*.
There are now *four* kinds of substitutions available: *fields*, *tables*, *images* and *sections*.

h3. Fields placeholders
Expand Down Expand Up @@ -62,7 +60,7 @@ report = ODFReport::Report.new("Users/john/my_template.odt") do |r|

r.add_table("TABLE_1", @list_of_itens, :header=>true) do |t|
t.add_column(:item_id, :id)
t.add_column(:description) do { |item| "==> #{item.description}" }
t.add_column(:description) { |item| "==> #{item.description}" }
end

end
Expand All @@ -76,12 +74,12 @@ and considering you have a table like this in your template
---------------------------------

* this is my lame attempt to draw a table.
you don't suppose to type this.
you are not supposed to type this.
you have to use an actual table.
i don't know... just thought I'd mention it ;-)
i don't know... just thought I should mention it ;-)
</pre>

and a collection @list_of_itens, it will be created one row for each item in the collection, and the replacement will take place accordingly.
and a collection @list_of_itens, it will create one row for each item in the collection, and the replacement will take place accordingly.

Any format applied to the fields in the template will be preserved.

Expand Down

0 comments on commit 3d4c5d6

Please sign in to comment.