Visual Basic (Declaration) | |
---|---|
Public Property CustomTextElements As IDictionary(Of String,String) |
C# | |
---|---|
public IDictionary<string,string> CustomTextElements {get; set;} |
In order to programmatically change a generic Text Element in the marginalia of a map from the client, first a custom Layout Template must be created using ArcMap. The author of the Layout Template .mxd file must share with the developer the Element Name of the inserted Text Element so that this can be used in constructing the Dictionary that is passed to the Printing.LayoutOptions.CustomTextElements Property. The following is a screen shot of the Properties dialog for a Text Element that was added to the Layout View design surface of a Layout Template .mxd file (note that the Element Name is "MyCustomTextElement"):
And the corresponding code snippet to programmatically change the Text Element when using the PrintTask:
C#
ESRI.ArcGIS.Client.Printing.PrintParameters myPrintParameters = new ESRI.ArcGIS.Client.Printing.PrintParameters(MyMap); ... ESRI.ArcGIS.Client.Printing.LayoutOptions myLayoutOptions = new ESRI.ArcGIS.Client.Printing.LayoutOptions(); Dictionary<string, string> myCustomElements = new Dictionary<string, string>(); // The "MyCustomTextElement" is the Element Name in the Layout Template .mxd file. myCustomElements.Add("MyCustomTextElement", "LOOK I CAN CHANGE THIS STRING"); myLayoutOptions.CustomTextElements = myCustomElements; ... myPrintParameters.LayoutOptions = myLayoutOptions;
VB.NET
Dim myPrintParameters As New ESRI.ArcGIS.Client.Printing.PrintParameters(MyMap) ... Dim myLayoutOptions As New ESRI.ArcGIS.Client.Printing.LayoutOptions Dim myCustomElements As New Dictionary(Of String, String) ' The "MyCustomTextElement" is the Element Name in the Layout Template .mxd file. myCustomElements.Add("MyCustomTextElement", "LOOK I CAN CHANGE THIS STRING") myLayoutOptions.CustomTextElements = myCustomElements ... myPrintParameters.LayoutOptions = myLayoutOptions
Property Value
The custom text elements.Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8