ExportToNodeXLGraphGallery ( Microsoft.Office.Interop.Excel.Workbook workbook, NodeXLControl nodeXLControl, String title, String description, String spaceDelimitedTags, String author, String password, Boolean exportWorkbookAndSettings, Boolean exportGraphML, Boolean useFixedAspectRatio ) { Debug.Assert(workbook != null); Debug.Assert(nodeXLControl != null); Debug.Assert(nodeXLControl.ActualWidth >= GraphExporterUtil.MinimumNodeXLControlWidth); Debug.Assert(nodeXLControl.ActualHeight >= GraphExporterUtil.MinimumNodeXLControlHeight); Debug.Assert( !String.IsNullOrEmpty(title) ); Debug.Assert( !String.IsNullOrEmpty(author) ); AssertValid(); Byte [] abtFullSizeImage, abtThumbnail, abtWorkbookContents, abtGraphML; String sWorkbookSettings; // Note that the name of the Zipped GraphML is not important. When a // user downloads the GraphML from the Graph Gallery website, the // website will rename the GraphML before giving it to the user. GraphExporterUtil.GetDataToExport(workbook, nodeXLControl, exportWorkbookAndSettings, exportGraphML, "GraphML.xml", useFixedAspectRatio, out abtFullSizeImage, out abtThumbnail, out abtWorkbookContents, out sWorkbookSettings, out abtGraphML); NodeXLGraphGalleryServiceClient oClient = new NodeXLGraphGalleryServiceClient(GetWcfServiceBinding(), new EndpointAddress( ProjectInformation.NodeXLGraphGalleryWcfServiceUrl) ); oClient.Endpoint.Binding.SendTimeout = new TimeSpan(0, SendTimeoutMinutes, 0); try { oClient.AddGraph4(title, author, password, description, spaceDelimitedTags, abtFullSizeImage, abtThumbnail, abtWorkbookContents, sWorkbookSettings, abtGraphML); } catch (ProtocolException oProtocolException) { // The following text search detects an exception thrown by the WCF // service when the exported byte count exceeds the maximum that // can be handled by the WCF service. // // This isn't a very robust test. Is there a better way to do // it? An earlier version attempted to calculate the number of // bytes that would be exported before attempting to export them, // but it didn't seem to be doing so accurately. // // See the MaximumBytes constant for more details. if (oProtocolException.Message.IndexOf("(400) Bad Request") >= 0) { throw new GraphTooLargeException(); } throw (oProtocolException); } }
ExportToNodeXLGraphGallery ( Microsoft.Office.Interop.Excel.Workbook workbook, NodeXLControl nodeXLControl, String title, String description, String spaceDelimitedTags, String author, String password, Boolean exportWorkbookAndSettings, Boolean exportGraphML, Boolean useFixedAspectRatio ) { Debug.Assert(workbook != null); Debug.Assert(nodeXLControl != null); Debug.Assert(nodeXLControl.ActualWidth >= GraphExporterUtil.MinimumNodeXLControlWidth); Debug.Assert(nodeXLControl.ActualHeight >= GraphExporterUtil.MinimumNodeXLControlHeight); Debug.Assert(!String.IsNullOrEmpty(title)); Debug.Assert(!String.IsNullOrEmpty(author)); AssertValid(); Byte [] abtFullSizeImage, abtThumbnail, abtWorkbookContents, abtGraphML; String sWorkbookSettings; // Note that the name of the Zipped GraphML is not important. When a // user downloads the GraphML from the Graph Gallery website, the // website will rename the GraphML before giving it to the user. GraphExporterUtil.GetDataToExport(workbook, nodeXLControl, exportWorkbookAndSettings, exportGraphML, "GraphML.xml", useFixedAspectRatio, out abtFullSizeImage, out abtThumbnail, out abtWorkbookContents, out sWorkbookSettings, out abtGraphML); NodeXLGraphGalleryServiceClient oClient = new NodeXLGraphGalleryServiceClient(GetWcfServiceBinding(), new EndpointAddress( ProjectInformation.NodeXLGraphGalleryWcfServiceUrl) ); oClient.Endpoint.Binding.SendTimeout = new TimeSpan(0, SendTimeoutMinutes, 0); try { oClient.AddGraph4(title, author, password, description, spaceDelimitedTags, abtFullSizeImage, abtThumbnail, abtWorkbookContents, sWorkbookSettings, abtGraphML); } catch (ProtocolException oProtocolException) { // The following text search detects an exception thrown by the WCF // service when the exported byte count exceeds the maximum that // can be handled by the WCF service. // // This isn't a very robust test. Is there a better way to do // it? An earlier version attempted to calculate the number of // bytes that would be exported before attempting to export them, // but it didn't seem to be doing so accurately. // // See the MaximumBytes constant for more details. if (oProtocolException.Message.IndexOf("(400) Bad Request") >= 0) { throw new GraphTooLargeException(); } throw (oProtocolException); } }