After the document is assembled, this function is called to output the plug-in to its destination repository.
bool DocumentAssembled (string filePath, bool bIsTempFile, string TemplateTitle, string templateFilePath)
The following Visual C# example implements the DocumentAssembled function. This example takes advantage of the IPluginPreferences interface to save users plug-in preferences and stores those preferences to the registry:
//Copy assembled template to folder of user choice.
private string _dlgfolderPath;
private string _outputPath = "OutputFolder";
public bool DocumentAssembled(string filePath, bool bIsTempFile, string templateTitle, string templateFilePath)
{
RegistryKey getKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(_outputPath, true);
if (getKey != null)
{
string folderPath = (string)getKey.GetValue(_outputPath);
string getExt = System.IO.Path.GetExtension(filePath);
if (System.IO.File.Exists(System.IO.Path.Combine(folderPath, templateTitle) + getExt))
{
int i = 0;
while (System.IO.File.Exists(System.IO.Path.Combine(folderPath, templateTitle) + i + getExt))
{
i++;
}
System.IO.File.Copy(filePath, System.IO.Path.Combine(folderPath, templateTitle) + i + getExt);
}
else
{
System.IO.File.Copy(filePath, System.IO.Path.Combine(folderPath, templateTitle) + getExt);
}
}
else
{
createFolderPath();
}
return true;
}
//Open dialog and allow user to set preferences.
public void createFolderPath()
{
dlgChooseFolder dlg = new dlgChooseFolder();
dlg.Show();
_dlgfolderPath = dlg.folderPath;
}