create html and pdf templates -凯发k8网页登录

main content

create html and pdf templates

use one of these approaches to create an html or pdf template for generating a report.

  • use mlreportgen.dom.document.createtemplate to create a copy of the dom api default template that you can then customize. for example:

    mlreportgen.dom.document.createtemplate('mytemplate','html');

    or, for a single-file html template,

    mlreportgen.dom.document.createtemplate('mytemplate','html-file');

    or, for pdf,

    mlreportgen.dom.document.createtemplate('mytemplate','pdf');
  • create a template from scratch.

edit html or pdf templates

a single-file html template embeds style sheets and images as html elements in the html document. an html template can be in a single file, with an .htmt extension, or in a zipped template package, with an .htmtx extension. pdf templates are packaged in a zipped template package, but use a .pdftx extension. to edit a single-file html template, open the .htmt file. to edit one of the packaged templates, unzip it to a folder using the unziptemplate function. for example, to unzip an html template called mytemplate in the current folder:

unziptemplate('mytemplate')

using the .htmtx extension is optional for packaged html templates. however, to unzip a pdf template, you must use the template extension, for example:

unziptemplate('mytemplate.pdftx')

after you unzip the template, you can edit the .css and .html files using a text editor or an html editor. to learn more templates, see .

to repackage a template after you edit it, use the ziptemplate function. for example, package the template stored in a subfolder in the current folder named mytemplate:

ziptemplate('mytemplate.htmtx')

for pdf, use the .pdftx extension:

ziptemplate('mytemplate.pdftx')

if you want to work with your template in a location other than the current folder, you can specify a path with the unziptemplate and ziptemplate functions.

see also

functions

  • |

classes

related topics

网站地图