public class EMFFormat : ExportFormat
Public Class EMFFormat Inherits ExportFormat
public class EMFFormat : ExportFormat
Public Class EMFFormat Inherits ExportFormat
//This example demonstrates how to export a layout to EMF. //Added references using ArcGIS.Desktop.Core; //Project using ArcGIS.Desktop.Layouts; //Layout classes using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //Export formats public class ExportLayoutToEMFExample { public static Task ExportLayoutToEMFAsync(string LayoutName, string Path) { //Reference a layoutitem in a project by name LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName)); if (layoutItem == null) return Task.FromResult<Layout>(null); //Create EMF format with appropriate settings EMFFormat EMF = new EMFFormat(); EMF.Resolution = 300; EMF.OutputFileName = Path; return QueuedTask.Run(() => { //Export Layout Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem if (EMF.ValidateOutputFilePath()) { lyt.Export(EMF); } }); } }
//This example demonstrates how to export an individual map frame on a layout to EMF. //Added references using ArcGIS.Desktop.Core; //Project using ArcGIS.Desktop.Layouts; //Layout classes using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //Export formats public class ExportMapFrameToEMFExample { public static Task ExportMapFrameToEMFAsync(string LayoutName, string MFName, string Path) { //Reference a layoutitem in a project by name LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName)); if (layoutItem == null) return Task.FromResult<Layout>(null); //Create EMF format with appropriate settings EMFFormat EMF = new EMFFormat(); EMF.Resolution = 300; EMF.OutputFileName = Path; return QueuedTask.Run(() => { //Export MapFrame Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem MapFrame mf = lyt.FindElement(MFName) as MapFrame; EMF.OutputFileName = Path; if (EMF.ValidateOutputFilePath()) { mf.Export(EMF); } }); } }
//This example demonstrates how to export the active mapview to EMF. //Added references using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //MapView and Export formats public class ExportActiveMapToEMFExample { public static Task ExportActiveMapToEMFAsync(string Path) { return QueuedTask.Run(() => { //Reference the active map view MapView map = MapView.Active; //Create EMF format with appropriate settings EMFFormat EMF = new EMFFormat(); EMF.Resolution = 300; EMF.Height = 500; EMF.Width = 800; EMF.OutputFileName = Path; //Export active map view if (EMF.ValidateOutputFilePath()) { map.Export(EMF); } }); } }
EMFFormat EMF = new EMFFormat();
System.Object
ArcGIS.Desktop.Mapping.ExportFormat
ArcGIS.Desktop.Mapping.EMFFormat
Target Platforms: Windows 11, Windows 10