new officegen(options)
The constructor of the office generator object.
This constructor function is been called by makegen().
This constructor function is been called by makegen().
The options:
The configuration options effecting the operation of the officegen object. Some of them can be only been declared on the 'options' object passed to the constructor object and the rest can be configured by either a property with the same name or by special function.List of options:
- 'type' - the type of generator to create. Possible options: either 'pptx', 'docx' or 'xlsx'.
- 'creator' - the name of the document's author. The default is 'officegen'.
- 'onend' - callback that been fired after finishing to create the zip stream.
- 'onerr' - callback that been fired on error.
| Name | Type | Description |
|---|---|---|
options |
object | List of configuration options (see in the description of this function). |
Namespaces
Methods
-
addResourceToParse(resource_name, type_of_res, res_data, res_cb)
-
Register a new resource to add into the generated ZIP stream.
Using this method the user can add extra custom resources into the generated ZIP stream.Name Type Description resource_namestring The name of the resource (path). type_of_resstring The type of this resource: either 'file' or 'buffer'. res_dataobject Optional data to use when creating this resource. res_cbfunction Callback to generate this resource (for 'buffer' mode only). -
generate(output_stream, options)
-
Generating the output document stream.
The user of officegen must call this method after filling all the information about what to put inside the generated document. This method is creating the output document directly into the given stream object. The options parameters properties: 'finalize' - callback to be called after finishing to generate the document. 'error' - callback to be called on error.Name Type Description output_streamobject The stream to receive the generated document. optionsobject Way to pass callbacks. -
startNewDoc()
-
Reuse this object for a new document of the same type.
Call this method if you want to start generating a new document of the same type using this object.