class TaskJuggler::TextReport
This is the most basic type of report. It only contains 5 RichText
elements. It’s got a header and footer and a central text with margin elements left and right.
Attributes
center[RW]
header[RW]
left[RW]
right[RW]
Public Class Methods
new(report)
click to toggle source
Calls superclass method
TaskJuggler::ReportBase::new
# File lib/taskjuggler/reports/TextReport.rb, line 25 def initialize(report) super @lWidth = @cWidth = @rWidth = 0 @lPadding = @cPadding = @rPadding = 0 end
Public Instance Methods
generateIntermediateFormat()
click to toggle source
Calls superclass method
TaskJuggler::ReportBase#generateIntermediateFormat
# File lib/taskjuggler/reports/TextReport.rb, line 32 def generateIntermediateFormat super # A width of 0 means, the columns flexible. if a('center') if a('left') && a('right') @lWidth = @rWidth = 20 @cWidth = 60 @lPadding = @cPadding = 2 elsif a('left') && !a('right') @lWidth = 25 @cWidth = 75 @lPadding = 2 elsif !a('left') && a('right') @cWidth = 75 @rWidth = 25 @cPadding = 2 else @cWidth = 100 end else if a('left') && a('right') @lWidth = @rWidth = 50 @lPadding = 2 elsif a('left') && !a('right') @lWidth = 100 elsif !a('left') && a('right') @rWidth = 100 end end end
to_csv()
click to toggle source
# File lib/taskjuggler/reports/TextReport.rb, line 90 def to_csv @report.warning('text_report_no_csv', "textreport '#{@report.fullId}' cannot be converted " + "into CSV format") nil end
to_html()
click to toggle source
# File lib/taskjuggler/reports/TextReport.rb, line 64 def to_html html = [] html << rt_to_html('header') if a('left') || a('center') || a('right') html << (table = XMLElement.new('table', 'class' => 'tj_text_page', 'cellspacing' => '0')) table << (row = XMLElement.new('tr', 'class' => 'tj_text_row')) %w( left center right).each do |i| width = instance_variable_get('@' + i[0].chr + 'Width') padding = instance_variable_get('@' + i[0].chr + 'Padding') if a(i) row << (col = XMLElement.new('td', 'class' => "tj_column_#{i}")) style = '' style += "width:#{width}%; " if width > 0 style += "padding-right:#{padding}%; " if padding > 0 col['style'] = style col << rt_to_html(i) end end end html << rt_to_html('footer') html end