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 a graph summary is used for the description. try { (new NodeXLGraphGalleryExporter()).ExportToNodeXLGraphGallery( oWorkbook, oNodeXLControl, GraphTitleCreator.CreateGraphTitle(oWorkbook), 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); } }
ReplaceGraphSummaryMacro ( String sMessageBody, Microsoft.Office.Interop.Excel.Workbook oWorkbook ) { Debug.Assert(oWorkbook != null); if (sMessageBody != null && sMessageBody.IndexOf(GraphSummaryMacro) >= 0) { sMessageBody = sMessageBody.Replace(GraphSummaryMacro, GraphSummarizer.SummarizeGraph(oWorkbook).Trim()); } return(sMessageBody); }