# Namespace: plugins

## lib/basicgen. plugins

Plugin API effecting all the instances of the officegen object.

### Methods

#### staticmodule:lib/basicgen.plugins.getDocTypeByName(typeName)

lib/basicgen.js, line 562
  Get a document type object by name.
  This method get a document type object.

  Name | Type | Description
  --- | --- | ---
  `typeName` | string | The name of the document type.

  ##### Returns:

  The plugin object of the document type.

#### staticmodule:lib/basicgen.plugins.getPrototypeByName(typeName)

lib/basicgen.js, line 592
  Get a document prototype object by name.
  This method get a prototype object.

  Name | Type | Description
  --- | --- | ---
  `typeName` | string | The name of the prototype object.

  ##### Returns:

  The prototype plugin object.

#### staticmodule:lib/basicgen.plugins.registerDocType(typeName, createFunc, schema_data, docType, displayName)

lib/basicgen.js, line 545
  Register a new type of document that we can generate.
  This method registering a new type of document that we can generate. You can extend officegen to support any type of document that based on resources files inside ZIP stream.

  Name | Type | Description
  --- | --- | ---
  `typeName` | string | The type of the document file.
  `createFunc` | function | The function to use to create this type of file.
  `schema_data` | object | Information needed by Schema-API to generate this kind of document.
  `docType` | string | Document type.
  `displayName` | string | The display name of this type.

#### staticmodule:lib/basicgen.plugins.registerParserType(typeName, parserFunc, extra_data, displayName)

lib/basicgen.js, line 610
  Register a new resource parser.
  This method registering a new resource parser. One use of this feature is in case that you are developing a new type of document and you want to extend officegen to use some kind of template engine as jade, ejs, haml* or CoffeeKup. In this case you can use a template engine to generate one or more of the resources inside the output archive. Another use of this method is to replace an existing plugin with different implementation.

  Name | Type | Description
  --- | --- | ---
  `typeName` | string | The type of the parser plugin.
  `parserFunc` | function | The resource generating function.
  `extra_data` | object | Optional additional data that may be required by the parser function.
  `displayName` | string | The display name of this type.

#### staticmodule:lib/basicgen.plugins.registerPrototype(typeName, baseObj, displayName)

lib/basicgen.js, line 577
  Register a document prototype object.
  This method registering a prototype document object. You can place all the common code needed by a group of document types in a single prototype object.

  Name | Type | Description
  --- | --- | ---
  `typeName` | string | The name of the prototype object.
  `baseObj` | object | The prototype object.
  `displayName` | string | The display name of this type.