Changeset 1226
- Timestamp:
- 12/10/07 20:39:34 (1 year ago)
- Files:
-
- ruport/trunk/examples/simple_templating_example.rb (modified) (1 diff)
- ruport/trunk/lib/ruport/formatter/csv.rb (modified) (1 diff)
- ruport/trunk/lib/ruport/formatter/html.rb (modified) (1 diff)
- ruport/trunk/lib/ruport/formatter/pdf.rb (modified) (1 diff)
- ruport/trunk/lib/ruport/formatter/template.rb (modified) (7 diffs)
- ruport/trunk/lib/ruport/formatter/text.rb (modified) (1 diff)
- ruport/trunk/test/csv_formatter_test.rb (modified) (1 diff)
- ruport/trunk/test/html_formatter_test.rb (modified) (1 diff)
- ruport/trunk/test/pdf_formatter_test.rb (modified) (1 diff)
- ruport/trunk/test/text_formatter_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ruport/trunk/examples/simple_templating_example.rb
r1174 r1226 1 1 require "ruport" 2 2 3 Ruport::Formatter::Template.create(:simple) do | t|4 t.page_format= {3 Ruport::Formatter::Template.create(:simple) do |format| 4 format.page = { 5 5 :size => "LETTER", 6 6 :layout => :landscape 7 7 } 8 t.text_format = {8 format.text = { 9 9 :font_size => 16 10 10 } 11 t.table_format= {11 format.table = { 12 12 :font_size => 16, 13 13 :show_headings => false 14 14 } 15 t.column_format= {15 format.column = { 16 16 :alignment => :center, 17 17 } 18 t.heading_format= {18 format.heading = { 19 19 :alignment => :right 20 20 } 21 t.grouping_format= {21 format.grouping = { 22 22 :style => :separated 23 23 } ruport/trunk/lib/ruport/formatter/csv.rb
r1224 r1226 36 36 # documentation for the available options and their format. 37 37 def apply_template 38 apply_table_format_template(template.table _format)39 apply_grouping_format_template(template.grouping _format)38 apply_table_format_template(template.table) 39 apply_grouping_format_template(template.grouping) 40 40 41 41 options.format_options ||= template.format_options ruport/trunk/lib/ruport/formatter/html.rb
r1224 r1226 32 32 # documentation for the available options and their format. 33 33 def apply_template 34 apply_table_format_template(template.table _format)35 apply_grouping_format_template(template.grouping _format)34 apply_table_format_template(template.table) 35 apply_grouping_format_template(template.grouping) 36 36 end 37 37 ruport/trunk/lib/ruport/formatter/pdf.rb
r1224 r1226 59 59 # documentation for the available options and their format. 60 60 def apply_template 61 apply_page_format_template(template.page _format)62 apply_text_format_template(template.text _format)63 apply_table_format_template(template.table _format)64 apply_column_format_template(template.column _format)65 apply_heading_format_template(template.heading _format)66 apply_grouping_format_template(template.grouping _format)61 apply_page_format_template(template.page) 62 apply_text_format_template(template.text) 63 apply_table_format_template(template.table) 64 apply_column_format_template(template.column) 65 apply_heading_format_template(template.heading) 66 apply_grouping_format_template(template.grouping) 67 67 end 68 68 ruport/trunk/lib/ruport/formatter/template.rb
r1225 r1226 47 47 # Example: 48 48 # 49 # Ruport::Formatter::Template.create(:simple) do | t|50 # t.page_format= {49 # Ruport::Formatter::Template.create(:simple) do |format| 50 # format.page = { 51 51 # :size => "LETTER", 52 52 # :layout => :landscape … … 54 54 # end 55 55 # 56 # If you define a template with the name :default, then it will be used by 57 # all formatters unless they either specify a template or explicitly turn off 58 # the templating functionality by using :template => false. 59 # 60 # Example: 61 # 62 # Ruport::Formatter::Template.create(:simple) 63 # Ruport::Formatter::Template.create(:default) 64 # 65 # puts g.to_pdf #=> uses the :default template 66 # puts g.to_pdf(:template => :simple) #=> uses the :simple template 67 # puts g.to_pdf(:template => false) #=> doesn't use a template 68 # 56 69 # ==== PDF Formatter Options 57 70 # 58 71 # Option Key Value 59 72 # 60 # page _format:size Any size supported by the :paper73 # page :size Any size supported by the :paper 61 74 # option to PDF::Writer.new 62 75 # 63 76 # :layout :portrait, :landscape 64 77 # 65 # text _formatAny available to Corresponding values78 # text Any available to Corresponding values 66 79 # PDF::Writer#text 67 80 # 68 # table _formatAll attributes of Corresponding values81 # table All attributes of Corresponding values 69 82 # PDF::SimpleTable 70 83 # … … 79 92 # PDF::SimpleTable::Column::Heading } 80 93 # 81 # column _format:alignment :left, :right, :center, :full94 # column :alignment :left, :right, :center, :full 82 95 # 83 96 # :width column width 84 97 # 85 # heading _format:alignment :left, :right, :center, :full98 # heading :alignment :left, :right, :center, :full 86 99 # 87 100 # :bold true or false … … 90 103 # defaults to column name) 91 104 # 92 # grouping _format:style :inline, :justified, :separated, :offset105 # grouping :style :inline, :justified, :separated, :offset 93 106 # 94 107 # … … 97 110 # Option Key Value 98 111 # 99 # table _format:show_headings true or false112 # table :show_headings true or false 100 113 # :width Table width 101 114 # :ignore_width true or false 102 115 # 103 # column _format:alignment :center116 # column :alignment :center 104 117 # :maximum_width Max column width 105 118 # 106 # grouping _format:show_headings true or false119 # grouping :show_headings true or false 107 120 # 108 121 # … … 111 124 # Option Key Value 112 125 # 113 # table _format:show_headings true or false126 # table :show_headings true or false 114 127 # 115 # grouping _format:style :inline, :justified128 # grouping :style :inline, :justified 116 129 # :show_headings true or false 117 130 # … … 121 134 # Option Key Value 122 135 # 123 # table _format:show_headings true or false136 # table :show_headings true or false 124 137 # 125 # grouping _format:style :inline, :justified, :raw138 # grouping :style :inline, :justified, :raw 126 139 # :show_headings true or false 127 140 # ruport/trunk/lib/ruport/formatter/text.rb
r1224 r1226 52 52 # documentation for the available options and their format. 53 53 def apply_template 54 apply_table_format_template(template.table _format)55 apply_column_format_template(template.column _format)56 apply_grouping_format_template(template.grouping _format)54 apply_table_format_template(template.table) 55 apply_column_format_template(template.column) 56 apply_grouping_format_template(template.grouping) 57 57 end 58 58 ruport/trunk/test/csv_formatter_test.rb
r1208 r1226 12 12 13 13 def setup 14 Ruport::Formatter::Template.create(:simple) do | t|15 t.table_format= {14 Ruport::Formatter::Template.create(:simple) do |format| 15 format.table = { 16 16 :show_headings => false 17 17 } 18 t.grouping_format= {18 format.grouping = { 19 19 :style => :justified, 20 20 :show_headings => false 21 21 } 22 t.format_options = { :col_sep => ":" }22 format.format_options = { :col_sep => ":" } 23 23 end 24 24 end ruport/trunk/test/html_formatter_test.rb
r1208 r1226 5 5 6 6 def setup 7 Ruport::Formatter::Template.create(:simple) do | t|8 t.table_format= {7 Ruport::Formatter::Template.create(:simple) do |format| 8 format.table = { 9 9 :show_headings => false 10 10 } 11 t.grouping_format= {11 format.grouping = { 12 12 :style => :justified, 13 13 :show_headings => false ruport/trunk/test/pdf_formatter_test.rb
r1208 r1226 5 5 6 6 def setup 7 Ruport::Formatter::Template.create(:simple) do | t|8 t.page_format= {7 Ruport::Formatter::Template.create(:simple) do |format| 8 format.page = { 9 9 :size => "LETTER", 10 10 :layout => :landscape 11 11 } 12 t.text_format = {12 format.text = { 13 13 :font_size => 16 14 14 } 15 t.table_format= {15 format.table = { 16 16 :show_headings => false 17 17 } 18 t.column_format= {18 format.column = { 19 19 :alignment => :center, 20 20 :width => 50 21 21 } 22 t.heading_format= {22 format.heading = { 23 23 :alignment => :right, 24 24 :bold => false, 25 25 :title => "Test" 26 26 } 27 t.grouping_format= {27 format.grouping = { 28 28 :style => :separated 29 29 } ruport/trunk/test/text_formatter_test.rb
r1208 r1226 5 5 6 6 def setup 7 Ruport::Formatter::Template.create(:simple) do | t|8 t.table_format= {7 Ruport::Formatter::Template.create(:simple) do |format| 8 format.table = { 9 9 :show_headings => false, 10 10 :width => 50, 11 11 :ignore_width => true 12 12 } 13 t.column_format= {13 format.column = { 14 14 :maximum_width => [5,5,7], 15 15 :alignment => :center 16 16 } 17 t.grouping_format= {17 format.grouping = { 18 18 :show_headings => false 19 19 }
