Systems and techniques for flexibly generating custom documents from data objects are described herein. Templates with embedded code instructions, which may be evaluated separate from a document reading or editing program, may be used to generate custom documents. The template system may use the embedded code instructions to dynamically access properties of data objects. An editing program may be used initially to generate a mockup document that may be used as the basis for a template.