Namespace: plugins

officegen# plugins

Plugin API effecting all the instances of the officegen object.

Methods

staticofficegen#plugins.getDocTypeByName(typeName)

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.

staticofficegen#plugins.getPrototypeByName(typeName)

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.

staticofficegen#plugins.registerDocType(typeName, createFunc, schema_data, docType, displayName)

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.

staticofficegen#plugins.registerParserType(typeName, parserFunc, extra_data, displayName)

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.

staticofficegen#plugins.registerPrototype(typeName, baseObj, displayName)

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.