# Class: officegen

## officegen

#### new officegen(options)

lib/basicgen.js, line 54
  The constructor of the office generator object.
  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

plugins
private

### Methods

#### addResourceToParse(resource_name, type_of_res, res_data, res_cb)

lib/basicgen.js, line 474
  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_name` | string | The name of the resource (path).
  `type_of_res` | string | The type of this resource: either 'file' or 'buffer'.
  `res_data` | object | Optional data to use when creating this resource.
  `res_cb` | function | Callback to generate this resource (for 'buffer' mode only).

#### generate(output_stream, options)

lib/basicgen.js, line 278
  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_stream` | object | The stream to receive the generated document.
  `options` | object | Way to pass callbacks.

#### startNewDoc()

lib/basicgen.js, line 449
  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.