Application.SelectMultipleTemplates2 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.

The difference between this method and SelectMultipleTemplates is the bResolveReferencePaths parameter. When this parameter is FALSE, template paths containing reference keywords are returned as reference paths (e.g., ^PUBpath\templatename.rtf) instead of being resolved to full paths (e.g., C:\Templates\templatename.rtf). You can then use the ResolveReferencePath method to translate the reference path into a full path as needed.

This method was introduced with the release of HotDocs 2005 SP2.

Syntax

void SelectMultipleTemplates2 ( string libPath, bool bOpen, bool bResolveReferencePaths, 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.
bResolveReferencePaths Indicates if reference paths will be resolved into full file paths (TRUE) or left as reference paths (FALSE).
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] 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] 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.SelectMultipleTemplates2(libPath, true, false, 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);
    }
}