TryExportToNodeXLGraphGallery
(
Microsoft.Office.Interop.Excel.Workbook oWorkbook,
NodeXLControl oNodeXLControl
)
{
Debug.Assert(oWorkbook != null);
Debug.Assert(oNodeXLControl != null);
ExportToNodeXLGraphGalleryUserSettings
oExportToNodeXLGraphGalleryUserSettings =
new ExportToNodeXLGraphGalleryUserSettings();
String sAuthor, sPassword;
GetGraphGalleryAuthorAndPassword(
oExportToNodeXLGraphGalleryUserSettings, out sAuthor,
out sPassword);
// Note that the workbook's name is used for the title, and a graph
// summary is used for the description.
Debug.Assert( !String.IsNullOrEmpty(oWorkbook.Name) );
try
{
( new NodeXLGraphGalleryExporter() ).ExportToNodeXLGraphGallery(
oWorkbook,
oNodeXLControl,
oWorkbook.Name,
GraphSummarizer.SummarizeGraph(oWorkbook),
oExportToNodeXLGraphGalleryUserSettings.SpaceDelimitedTags,
sAuthor,
sPassword,
oExportToNodeXLGraphGalleryUserSettings
.ExportWorkbookAndSettings,
oExportToNodeXLGraphGalleryUserSettings.ExportGraphML,
oExportToNodeXLGraphGalleryUserSettings.UseFixedAspectRatio
);
return (true);
}
catch (Exception oException)
{
String sMessage;
if ( NodeXLGraphGalleryExceptionHandler
.TryGetMessageForRecognizedException(
oException, out sMessage) )
{
FormUtil.ShowWarning(sMessage);
}
else
{
ErrorUtil.OnException(oException);
}
return (false);
}
}