Namespace: plugs

officegen#private# plugs

API for plugins.

Officegen plugins can extend officegen to support more document formats.

Examples how to do it can be found on lib/gendocx.js, lib/genpptx.js and lib/genxlsx.js.

Example

Adding a new document type to officegen

var baseobj = require ( "officegen" );

function makeMyDoc ( officegenObj, typeCodeName, options, officegenObjPlugins, typeInfo ) {
	// officegenObjPlugins = Plugins access to extend officegenObj.
}

baseobj.plugins.registerDocType (
	'mydoctype', // The document type's code name.
	makeMyDoc,
	{},
	baseobj.docType.TEXT,
	"My Special Document File Format"
);

Members

staticofficegen#private#plugs.type

Any additional plugin API must be placed here.

Methods

staticofficegen#private#plugs.intAddAnyResourceToParse(resource_name, type_of_res, res_data, res_cb, is_always, removed_after_used)

Add a resource to the list of resources to place inside the output zip file.

This method adding a resource to the list of resources to place inside the output document ZIP.
Changed by vtloc in 2014Jan10.
Name Type Description
resource_name string The name of the resource (path).
type_of_res string The type of this resource: either 'file', 'buffer', 'stream' or 'officegen' (the last one allow you to put office document inside office document).
res_data object Optional data to use when creating this resource.
res_cb function Callback to generate this resource (for 'buffer' mode only).
is_always boolean Is true if this resource is perment for all the zip of this document type.
removed_after_used boolean Is true if we need to delete this file after used.