The invention relates to a template-based multi-format
layout file generation method and
system, and the method comprises the following steps: generating a template object and a data object through analyzing a template file and a
data file, constructing a document object of a fixed page through a dynamic
paging calculator and a preset strategy
class diagram, and supporting multi-format output; data volume self-adaptive
paging is realized through a
paging strategy, and cross-
page table header repeated rendering and
cell merging are supported; a middle data layer is adopted to separate contents and formats, and a coordinate
system conversion
algorithm is utilized to realize output of formats such as PDF and OFD. I / O consumption is reduced by
lazy loading of a
font resource pool, and table dynamic expansion and cross-page association are realized based on gridding modeling. According to the method and the device, the problems of incapability of self-adaptive paging and poor compatibility of multi-format output of traditional template sleeve printing are solved, and the efficiency and the consistency of
layout file generation in a government affair electronic scene are remarkably improved.