HTML::FormatTableCell - Format HTML Table


FormatNroff documentation Contained in the FormatNroff distribution.

Index


Code Index:

NAME

Top

HTML::FormatTableCell - Format HTML Table

SYNOPSIS

Top

 require HTML::FormatTableCell;
 @ISA=qw(HTML::FormatTableCell);

DESCRIPTION

Top

The HTML::FormatTableCell is a base class used to record information about a table entry as part of FormatTable processing. It is necessary to record information for formatting into languages such as nroff tbl which require formatting information ahead of the table data.

METHODS

Top

$cell = new HTML::FormatTableCellNroff(%attr);

Since FormatTableCell is a base class, a derived class constructor such as FormatTableCellNroff should be called.

The following attributes are supported:

        header - is a header (default is '')
	nowrap - do not wrap if defined
	rowspan - number of rows cell spans (default is 1)
	colspan - number of columns cell spans (default is 1)
	align - alignment of cell contents (default is 'left')
	valign - vertical alignment of cell (default is 'middle')
	contents - contents of cell (default is '')

$cell->add_text($text);

Add additional contents to cell.

$alignment = $cell->alignment();

Return cell alignment.

$colspan = $cell->colspan();

Return cell colspan.

$text = $cell->text();

Return cell text.

$width = $cell->width();

Return cell width in characters.

SEE ALSO

Top

HTML::FormatNroff, HTML::FormatTableCellNroff, HTML::FormatTableRow, HTML::FormatTableRowNroff

COPYRIGHT

Top

AUTHOR

Top

Frederick Hirsch <f.hirsch@opengroup.org>


FormatNroff documentation Contained in the FormatNroff distribution.
package HTML::FormatTableCell;

require 5.004;

use strict;
use Carp;

sub new {
    my($class, %attr) = @_;

    my $self = bless {	
	header => $attr{'header'} || '',
	nowrap => $attr{'nowrap'} || 'nowrap',
	rowspan => $attr{'rowspan'} || 1,
	colspan => $attr{'colspan'} || 1,
	align => $attr{'align'} || 'left',
	valign => $attr{'valign'} || 'middle',
	contents => $attr{'contents'} || '',

	text => "",
    }, $class;

    return $self;
}

sub add_text {
    my($self, $text) = @_;
    
    $self->{'text'} .= $text;
}

sub alignment {
    my($self) = @_;

    return $self->{'align'};
}

sub colspan {
    my($self) = @_;

    return $self->{'colspan'};
}

sub text {
    my($self) = @_;

    return $self->{'text'};
}

sub width {
    my($self) = @_;

    length($self->{'text'});
}

1;