Application.SelectMultipleTemplates Method

This method opens the specified library in a modal dialog box, allowing users to select multiple templates by pressing Shift or Ctrl as they click templates. The selected templates are then passed back to the integrating program in a SAFEARRAY structure.

Syntax

void SelectMultipleTemplates ( string libPath, bool bOpen, out int tplCount, out object tplPaths, out object tplTitles, out object tplDescs )

Parameters Description
libPath The file system path to the library the integration must open. This path must point to an .HDL file. If this path is an empty string (""), then HotDocs will attempt to display the last library the user viewed.
bOpen If bOpen == true, then the modal dialog will include an Open button, allowing the user to open a different library file. If bOpen == false, then the modal dialog will not include an Open button and the user will not be able to open a different library file.
tplCount The number of templates the user selected.
tplPaths  It contains an array of (count) that hold the file system paths (including the file name) of the selected templates.
tplTitles [optional in languages supported] It contains an array of (count) that hold the titles of the selected templates. If there is no title for a selected template, that portion of the array will hold an empty string ("").
tplDescs [optional in languages supported] Contains an array of (count) that hold the descriptions of the selected templates. If there is no description for a selected template, that portion of the array will hold an empty string (""). As a note, template descriptions can be quite long, so if you use this parameter, this method could use a lot of memory.

Example (Visual C#)

The following Visual C# example displays a dialog box where users can select multiple templates from the initial library or open a different library. It then displays information about the templates selected:

public class ExampleCode
{
    static void Main()
    {
        HotDocs.Application app = new HotDocs.Application();
         
        string libPath = @"C:\Documents\HotDocs\Libraries\DOCX Tutorial Templates.hdl";
        int tplCount;
        dynamic tplPaths;
        dynamic tplTitles;
        dynamic tplDescs;
         
        app.SelectMultipleTemplates(libPath, true, out tplCount, out tplPaths, out tplTitles, out tplDescs);
         
        MessageBox.Show("You selected " + tplCount + " templates.");
         
        if (tplCount > 0)
        {
            for (int i = 0; i < tplCount; i++)
            {
                MessageBox.Show(tplPaths[i] + "\r\n" + tplTitles[i] + "\r\n" + tplDescs[i]);
            }
        }
         
        System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
    }
}