If the tool is run in TIBCO Spotfire Professional, results must be handled differently.
The result is detected from CanFrameworkHandleResult: If it is false, try to save the result instead of just viewing it. If this is not possible, display an error message in an error dialog of HtmlPrintToolErrorDialogtype. In the tool, also add code that “yield returns” a PrintToolErrorModel that contains the exception to be displayed in the error dialog.
if (!result.CanFrameworkHandleResult)
{
// If the framework can't handle the result, as in the context
// of executing the tool in the Windows Forms client, we need
// take care of it here.
Exception exception = null;
try
{
result.Save(Path.GetDirectoryName(settings.IndexFilePath));
}
catch (IOException ioe)
{
exception = ioe;
}
catch (UnauthorizedAccessException uae)
{
exception = uae;
}
if (exception != null)
{
PrintToolErrorModel errorModel = new PrintToolErrorModel(exception);
yield return errorModel;
// Bail out.
yield break;
}
Finally, the page is opened in a Web browser if OpenInWebBrowser is chosen in the settings.
if (settings.OpenInWebBrowser)
{
System.Diagnostics.Process.Start(settings.IndexFilePath);
}
}