AODL.Document.Content.EmbedObjects.EmbedObjectHandler.CreateEmbedObject C# (CSharp) Method

CreateEmbedObject() public method

create a embed object
public CreateEmbedObject ( XmlNode ParentNode, string MediaType, string ObjectRealPath, string ObjectName ) : EmbedObject
ParentNode System.Xml.XmlNode
MediaType string
ObjectRealPath string
ObjectName string
return EmbedObject
		public EmbedObject CreateEmbedObject(XmlNode ParentNode,string MediaType,string ObjectRealPath,string ObjectName)
		{
			switch(MediaType)
			{
				case "application/vnd.oasis.opendocument.chart":
					return CreateChart(ParentNode,ObjectRealPath,ObjectName);
				case"application/vnd.oasis.opendocument.text":
					return null;
				case "application/vnd.oasis.opendocument.formula":
					return null;
				case "application/vnd.oasis.opendocument.presentation":
					return null;
				default:
					return null;
			}
		}

Usage Example

		private EmbedObject CreateEmbedObject(XmlNode ObjNode)
		{
			try
			{
				XmlNode ObjectNode                  = ObjNode.CloneNode (true);

				XmlNode node                        = ObjectNode.SelectSingleNode ("@xlink:href",this._document .NamespaceManager );

				string ObjectFullPath               = node.InnerText.Substring (2)+"/" ;

				string ObjectRealPath               = node.InnerText .Substring (2);

				string ObjectName                   =ObjectRealPath;

				ObjectRealPath                      = Path.Combine (_document.DirInfo.Dir, ObjectRealPath);
				
				string MediaType                    = GetMediaType(ObjectFullPath);

				EmbedObjectHandler embedobjhandler  = new EmbedObjectHandler (this._document );

				return embedobjhandler.CreateEmbedObject (ObjectNode,MediaType,ObjectRealPath,ObjectName);
			}
			
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Graphic.", ex);
			}
		}