Functions for creating HTML representations of tabular data.

tabular.web.tabular2html(fname=None, X=None, fin=None, title=None, printheader=False, split=True, usecss=None, writecss=None, SERVERNAME=None, SERVER_FROM_CURDIR='../', ROWS_PER_PAGE=1000, returnstring=False, **kwargs)

Creates an html representation of tabular data, either from a tabarray or an externa file (including `.hsv``, .csv, .tsv). If no data is directly provided by passing a tabarray to X, then a tabarray is constructed using tabular.tabarray.tabarray.__new__().


fname : string

Path to the “main” HTML file to be created. This file path must end in .html.

Note that this function will create additional files (e.g. a .css file and multiple linked .html files for large datasets) linked to this HTML file, inside of the directory containing fname.

X : tabarray

If X is None, then one of fin, array, records, columns, SV, HSV, or HSVlist must not be None.

fin : string

File path to to a source of tabular dat, which will be loaded using the tabarray constructor. The load method will be inferred from the file extension and whether or not there is a headerkey in the first line of the file.

title : string

Description to be used in the <title> tag of the created html file.

printheader : boolean

If printheader = True, will print out a “header” and “footer” (both in the body of the HTML documents) on every page. The header contains information about the name of the input file and the number of rows, as well what the current page number is (if split between multiple documents) and links to any other pages. The footer contains the same page number and links.

split : boolean

If split = False, will not split to multiple HTML pages, regardless of value of ROWS_PER_PAGE.

usecss : False or None or string

If usecss is False, no link to a cssfile is included in the page header, and no cssfile is written out. If is a string, that string is assumed to be a path and is linked to as the CSS file. If it is None, then consideration of the writecss variable is made.

writecss : boolean

If usecss is not None, then if writecss is not False: the default css sheet is generated and written to a file whose name is either generated by default (if writecss is None) else given by writecss itself, and linked to in the file header


Server name. For example, this could be the ServerName of a VirtualHost on your local machine, assuming that fname describes a path on the server.


Root path of server relative to the current directory. Assumed to be ‘../’.

ROWS_PER_PAGE : positive integer or ‘all’

This sets the number of records displayed per .html page (if the tabular file has more than ROWS_PER_PAGE rows, it will be split into multiple sections on several .html pages (default = 1000).

If the value is ‘all’ then the page is not split (e.g. it is as if split = False)

See also: the kwargs arguments must be valid keyword arguments for tabular.tabarray.tabarray.__new__(), the tabarray constructor, see documentation for descriptions.

Previous topic


Next topic


This Page