Use ArcMap control to paste from Clipboard

1847
4
12-30-2011 06:38 AM
AndrewBrown1
Occasional Contributor II
Greetings,

How do I programmatically use VB.Net within my ArcMap Add-In to paste whatever content is currently stored on the clipboard?

I need to insert an Excel table as a SVG, scalable vector graphic, instead of inserting a raster image jpg/gif/bmp file, in order to preserve quality.

Thank you,

Andrew
0 Kudos
4 Replies
AndrewBrown1
Occasional Contributor II
Also, question #2: How do I access properties of an image that has just been pasted into ArcMap? I need to programmatically re-size it.

Thanks,
Andrew
0 Kudos
EdgarBejarano
Occasional Contributor
The ISelection Interface (ESRI.ArcGIS.Carto.ISelection) manages clipboard type operations on a selection.  A reference to ISelection can be obtained from IActiveView.Selection where IActiveView represents either the Map (Data View) or the PageLayout (Layout View) of ArcMap.

According to the documentation on ISelection,
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//001200000qm8000000
3 ArcObjects coclasses implement that interface:  ElementSelection, MapSelection and SimpleElementSelection.  Based on their respective descriptions, it sounds like your ISelection reference would be an instance of the ElementSelection coclass, so click on that coclass in the document to see which other interfaces you can cast to that would offer other useful methods or properties, e.g. IEnumElement > IEnumElement.Next().

Also see the IActiveView.Selection Property documentation:
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Selection_Property/00120...
0 Kudos
EdgarBejarano
Occasional Contributor
As for your second question, an image on a map (IMap) or pagelayout (IPageLayout) is a graphic element just like when you add text (ITextElement) or a marker (IMarkerElement) using the Drawing toolbar of ArcMap. 

IElement
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/IElement_Interface/00120...

In the document above, look for the coclass that represents the exact type of picture element representing your image, e.g. PngPictureElement or JpgPictureElement.  Notice both coclass implement some generic ArcObjects interfaces like IElement and the more specific IPictureElement.

One of those many interfaces is bound to offer the image properties like IElementProperties, IElementProperties2 or IElementProperties3
0 Kudos
AndrewBrown1
Occasional Contributor II
Thank you! This works 🙂
0 Kudos