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); } }
btnOK_Click ( object sender, EventArgs e ) { AssertValid(); if (!DoDataExchange(true)) { return; } if (m_eMode == DialogMode.Normal) { NodeXLGraphGalleryExporter oNodeXLGraphGalleryExporter = new NodeXLGraphGalleryExporter(); this.Cursor = Cursors.WaitCursor; try { Debug.Assert(m_oNodeXLControl != null); oNodeXLGraphGalleryExporter.ExportToNodeXLGraphGallery( m_oWorkbook, m_oNodeXLControl, txbTitle.Text, txbDescription.Text, m_oExportToNodeXLGraphGalleryUserSettings. SpaceDelimitedTags, m_oExportToNodeXLGraphGalleryUserSettings.Author, m_oExportToNodeXLGraphGalleryUserSettings.UseCredentials ? m_oPasswordUserSettings.NodeXLGraphGalleryPassword : null, m_oExportToNodeXLGraphGalleryUserSettings. ExportWorkbookAndSettings, m_oExportToNodeXLGraphGalleryUserSettings.ExportGraphML, m_oExportToNodeXLGraphGalleryUserSettings .UseFixedAspectRatio ); } catch (Exception oException) { String sMessage; if (NodeXLGraphGalleryExceptionHandler .TryGetMessageForRecognizedException(oException, out sMessage) ) { this.ShowWarning(sMessage); } else { ErrorUtil.OnException(oException); } return; } finally { this.Cursor = Cursors.Default; } } m_oExportToNodeXLGraphGalleryUserSettings.Save(); m_oPasswordUserSettings.Save(); this.DialogResult = DialogResult.OK; this.Close(); }