zipTemplate
Package DOM HTML and PDF template in zip file
Syntax
Description
zipTemplate(
zips
(compresses and puts in a zip file) the unzipped DOM template in unzippedTemplateFolder
)unzippedTemplateFolder
.
The resulting zipped template file name is the name specified in unzippedTemplateFolder
,
plus the file extension htmtx
or pdftx
.
The zipTemplate
function zips all of the files
in the unzipped template folder, including files in subfolders. The
zipped template folder structure duplicates the folder structure of
the unzipped template. The file names in the unzipped template must
contain only ASCII characters.
Use this syntax if you created the unzipped template by unzipping a template created in any of these ways:
Used
mlreportgen.dom.Document.createTemplate
Copied the template from a default DOM template
Created the template without using the DOM API or DOM templates and the zipped file complies with the conditions listed in “Tips”.
zipTemplate(
zips
the unzipped DOM template into the file specified by zippedTemplate
,unzippedTemplateFolder
)zippedTemplate
.
zipTemplate(
zips
the unzipped DOM template into the file specified by zippedTemplate
,unzippedTemplateFolder
,mainDocument
)zippedTemplate
.
Use the mainDocument
argument to specify the name
of main document in the unzipped template if the main document name
in the unzipped template is not report.html
or root.html
and
your document part template library file, if it exists, is in a file
called docpart_templates.html
.
zipTemplate(
zips
the unzipped DOM template into the file specified by zippedTemplate
,unzippedTemplateFolder
,mainDocument
,partTemplates
)zippedTemplate
.
Use this syntax when the unzipped template includes a document part
template library file whose file name is not docpart_templates.html
.
You must specify mainDocument
as the third argument,
even if the main document file is called report.html
or root.html
.
Examples
Input Arguments
Tips
If you created the unzipped template by unzipping a template created by using
mlreportgen.dom.Document.createTemplate
or copying the template from a default DOM template, you can use either of these syntaxes with no further action:zipTemplate(
unzippedTemplateFolder
)zipTemplate(
zippedTemplate
,unzippedTemplateFolder
)You can also use either of those two syntaxes if the unzipped template was created without using the DOM interface and the template complies with the following requirements.
The main document file is named either
report.html
orroot.html
.The unzipped template either does not include a document part template library file, or it includes a document part template library file named
docpart_templates.html
.The unzipped template stores images in a folder named
images
.
If the unzipped template main document file is not named either
report.html
orroot.html
, use themainDocument
input argument.If the unzipped template includes a document part template library file with a name other than
docpart_templates.html
, use thepartTemplates
input argument.If the unzipped template stores images in a folder other than one named
images
in the root folder of the template, include a text file called_imgprefix
in the folder that contains images for the unzipped template. In the_imgprefix
file, you can include a prefix for the DOM interface to use to generate names images appended to documents. For example, if the_imgprefix
file contains the prefixgraphic
, the generated image names aregraphic1.png
,graphic2.png
, and so on. If you leave the_imgprefix
file empty, then the generated images use the prefiximage
.
Version History
Introduced in R2014b