AnswerCollection.Save Method

This method saves the AnswerCollection to a HotDocs answer file. The file type (.ANS or .ANX) is determined by the FileFormat property.

Syntax

void Save ( string answerFileName )

Parameters Description
answerFileName [optional] The path and file name for the resulting answer file. If the answer file already exists, it will be overwritten. If the file name was passed into the Create method, this parameter is not necessary.

Example

The following Visual C# example adds two answers to an answer file, then saves and closes it.

public class ExampleCode
{
    static void Main()
    {
        HotDocs.AnswerCollection ac = new HotDocs.AnswerCollection();
        HotDocs.Answer ans;
         
        ac.Create(@"C:\Documents\HotDocs\Answers\AnswerFile.anx"); 
         
        ans = new HotDocs.Answer();
        ans.Create("Agreement Date", HotDocs.HDVARTYPE.HD_DATETYPE);
        ans.Value = "01/01/2009";
        ac.Add(ans); 
         
        ans = new HotDocs.Answer();
        ans.Create("Company Representative", HotDocs.HDVARTYPE.HD_MULTCHOICETYPE);
        ans.Value = "Stephanie Walker";
        ac.Add(ans); 
        ans = null;
         
        ac.Save(@"C:\Documents\HotDocs\Answers\AnswerFile.anx");
          
        ac.Close();
    }
}