Skip to main content
RSS feed Subscribe to feed

 

Skip Navigation LinksHome  Extending the Spotfire Platform  Creating Extensions to the Spotfire Platform  Creating a Tool  How to Create an Export Tool  Export Tool Feature: Result handling in Spotfire Professional

©Spotfire 2011

Export Tool Feature: Result handling in Spotfire Professional

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);
    }
}