HotDocs.Server.Assembly Class

An Assembly represents a single template that HotDocs Server is currently assembling, waiting to assemble, or has already assembled. For example, if you want to assemble a new document, you could do the following:

  1. Create an Assembly object and initialize properties like TemplatePath, AnswerCollection, and DocumentPath.

  2. Call the GetInterview method to present an answer-gathering interview to the user.

  3. Update the AnswerCollection with the answers returned by the interview.

  4. Call the Assemble method to generate the assembled document.

The methods and properties available in the Assembly object provide many ways for you to customize the interview behavior and appearance, and then ultimately generate (assemble) a document.

In the .NET API, an Assembly object cannot be created by itself. To create a new Assembly object, you must use the AssemblyCollection.AddNew method.

Namespace: HotDocs.Server
Assembly: HotDocs.Server in HotDocs.Server.dll

This class implements the following interfaces:

  • IDisposable:The class can be disposed.

Methods

Method Description
AddCustomInterviewButton This method adds a custom button to the interview toolbar. When a user clicks the button, JavaScript code is executed to perform any action you may wish to make available to users of your host application, such as displaying your host application's help file.

This method was deprecated in HotDocs Server 11. The functionality is now available in the Javascript API.

Assemble This method assembles a document.
Dispose This method is an implementation of the IDisposable.Dispose method that releases unmanaged resources held by an instance of the Assembly class.
GetInterview This method returns a browser-based HTML interview for the Assembly.
RemoveCustomInterviewButton This method removes a custom button from the interview toolbar. The index parameter is the index of the button returned by AddCustomInterviewButton when the button was created.

This method was deprecated in HotDocs Server 11. The functionality is now available in the Javascript API.

Properties

Property Description
AnswerCollection [Read/Write] This property is an AnswerCollection object, which represents the answers used in the assembly.
AnswerFilePath [Read/Write] This property is the path and file name for the answer file used by the assembly.
AnswerFilePathData [Read/Write] This property is not used by HotDocs Server, but you may choose to set it to a string that is useful for your host application. For example, you could set it to the file name (without the path) of the answer file associated with the Assembly object.
AssembleMarkupDocument [Read/Write] This property indicates whether or not the document will be assembled in Markup View. (The default value comes from the Session.DefaultAssembleMarkupDocument property.)
Completed [Read/Write] This Boolean property indicates whether or not the Assembly has been completed. Once this property is set to true, HotDocs Server moves it from the Session.Assemblies collection to the Session.CompletedAssemblies collection.
ComponentCollection [Read-only] This property is a ComponentCollection object, which represents all of the components in the Assembly.
DocumentExtension [Read-only] This property returns the file name extension for documents created by the Assembly. For example, if the Assembly represents a Word RTF template, this property would return .RTF. Likewise, if the Assembly represents a PDF-based (.HPT) template, this property would return .HPD.
DocumentPath [Read/Write] This property is the file name and path of the document to be generated from the Assembly.
DocumentPathData [Read/Write] This property is not used by HotDocs Server, but you may choose to set it to a string that is useful for your host application. For example, you could set it to the file name (without the path) of the document file to be generated by the Assembly object.
DocumentPreview [Read/Write] This Boolean property indicates whether or not the Document Preview Document Preview button should appear on the interview toolbar. The default value of this property is determined by the Allow document preview setting in the HotDocs Server Management Console.
DocumentPreviewUrl [Read/Write] This property represents the URL of the document preview handler page.
FormActionUrl [Read/Write] This property is the URL for the page to which interview results are posted.
HotDocsCSSUrl [Read/Write] This property represents the URL that HotDocs Server should use for the user cascading style sheet (e.g., hdsuser.css). If the Session.DefaultHotDocsCSSUrl property is set, this property is defaulted to that URL.
HotDocsImageUrl [Read/Write] This property represents the URL that HotDocs Server should use for the image files. If the Session.DefaultHotDocsImageUrl property is set, this property is defaulted to that URL.

This property was deprecated in HotDocs Server 11.

HotDocsJavaScriptUrl [Read/Write] This property represents the URL that HotDocs Server should use for JavaScript files. If the Session.DefaultHotDocsJavaScriptUrl property is set, this property is defaulted to that URL.
HotDocsVersion [Read-only] This property returns the version of HotDocs used to create the template.
ID [Read-only] A unique identifier (GUID) for the Assembly object.
InsertedTemplates [Read-only] A string of templates inserted into the current assembly.
InterviewAnswers [Read/Write] A string of answers to overlay on top of the existing answers in the Assembly.
InterviewDefinitionUrl [Read/Write] This property represents the URL where the interview will request its definition.
InterviewFilePath [Read/Write] The file name and path to the interview (.JS) file associated with the Assembly object.

This property was deprecated in HotDocs Server 11.

InterviewFormat [Read/Write] This property specifies the format of the interview--either JavaScript or Silverlight.
InterviewVersion [Read-only] The version of HotDocs that was used to create the interview.
OriginalFileName [Read-only] The original file name of the assembly.
Parent [Read-only] The AssemblyCollection object to which the assembly belongs.
ParentInterviewBasePath [Read-only] This property returns the base path of the parent interview.
ParentTemplateBasePath [Read-only] This property returns the base path of the parent template.
PendingAssemblies [Read-only] This property returns an AssemblyCollection object, which represents all of the assemblies that are pending based on completion of the current assembly. For example, if a template contains two ASSEMBLE instructions, the collection returned by this property would include two Assembly objects—one for each ASSEMBLE instruction. Because HotDocs Server must assemble a template to find any ASSEMBLE instructions, the AssemblyCollection returned by this property is empty until the template has been assembled at least once. Likewise, because logic in a template may conditionally include or exclude an ASSEMBLE instruction, the number of assemblies in this collection may change depending on answers in the AnswerCollection.
SaveAnswersPageUrl [Read/Write] This property is the URL of a page you can create to handle saving answer files in the middle of an interview. (If the user clicks the Save Answers button on the toolbar, this URL will be loaded to handle that command.)
StatelessInterview [Read/Write] This property indicates whether or not the interview will be stateless. (In a stateless interview, the complete answer collection is sent to and returned from the interview, which means the server does not need to keep any state information between requests to get an interview and assemble a document.)
Switches [Read/Write] This property is a string value that contains all of the command line options used by the assembly. For example, your host application could examine this property to determine if any switches indicate that the interview should not be displayed.
TempInterviewPath [Read-only] This property indicates the path to a folder where temporary files are created during the interview. For example, when an interview is displayed that uses Image dialog elements, the image files are copied to this folder so the browser interview can find them. Likewise, when HotDocs Server generates a document preview, the files it creates for the document preview are placed in this folder. Files in this folder are automatically deleted at an appropriate time after completing the assembly.
TempInterviewUrl [Read-only] This property indicates the URL to a folder where temporary files are created during the interview. For example, when an interview is displayed that uses Image dialog elements, the image files are copied to this folder so the browser interview can find them. Likewise, when HotDocs Server generates a document preview, the files it creates for the document preview are placed in this folder. Files in this folder are automatically deleted at an appropriate time after completing the assembly.
TemplatePath [Read/Write] This property is the file name and path of the template.
TemplatePathData [Read/Write] This property is not used by HotDocs Server, but you may choose to set it to a string that is useful for your host application.
TemplateTitle [Read/Write] The title of the template being assembled.
UnansweredVariables [Read-only] This Boolean property indicates whether or not there were unanswered variables when the document was assembled.
UnansweredVariablesList [Read/Write] This property is a string that contains a serialized list of the unanswered variables.
VariableCollection [Read-only] This property returns a VariableCollection object, which represents all of the variables asked in the interview.

Example

Example Visual C# code:

string tplf = "C:\template.docx"; //get the template path from someplace
if (Path.GetExtension(tplf).ToLower()==".hpt")
{
    // check to see if PDF Advantage is enabled
    if (!_session.PDFAdvantageInstalled)
    {
        MessageBox.Show("This template requires HotDocs PDF Advantage, which is not authorized on this server.");
        return;
    }
}
//create a new assembly
HotDocs.Server.Assembly asm = _session.Assemblies.AddNew();
asm.TemplatePathData = tplf;
asm.TemplatePath = Settings.TemplatePath + tplf;