Assemble Function

This function is called when a file with one of the registered file name extensions is selected and assembled from the library window. For example, you could use this plug-in to set command-line options for all templates with a given file name extension. Then, when a user assembles a template, the command-line options for that item in the library can be ignored or substituted with different options.

This function only checks templates with file types registered using RegisterFileType.

Syntax

Assemble ( string FileName , string switches , ref string alternateFilename , ref string alternateSwitches , ref bool hotdocsProcess )

Parameter Description
FileName Complete path and file name for the selected library item.
switches Command-line options (switches) for the selected library item.
alternateFilename Alternate file name for the selected library item. If the fileName is a document identifier, for example, this parameter could return the actual file name of the template file.
alternateSwitches Alternate command-line options for the selected library item. Using this parameter, the plug-in could be written to ignore any command-line options in a library and only use command-line options specified in this function.
hotdocsProcess If this parameter is TRUE, HotDocs will assemble the template. If it is FALSE, HotDocs will do nothing.

Example (Visual C#)

The following Visual C# example checks the command-line options of the templates being assembled to see if the /stw switch is included. If not, /stw is added so that all assembled templates are automatically sent to the word processor:

public void Assemble(string FileName, string switches, ref string alternateFilename, ref string alternateSwitches, ref bool hotdocsProcess)
{
    if (switches != "/stw")
    {
        alternateSwitches = switches + " /stw";
    }
     
    hotdocsProcess = true;
}