I working on mxd with ArcMap 10.3 . The default's legend properties is- Layout – left to right reading (Marked with a red ellipse) :
when it unmarked i get this legend:
i want to know if there a way to mark the default box automatic from right to left reading option so the result will be like that (Very important is that all the legend items will be in straight line from left side):
Does anyone know of a way to do this with arcpy?
UPDATE:
I tried MrBubbles answer and the result was:
while i wanted result like that (i made it manually for the example):
The answer of MrBubbles didn't help me because it very important that all the words in the legend will be right to left configuration
How can i do it?
Best Answer
The trick to doing this is to first create a legend style item either in your user style file or in a custom style file. For the sake of simplicity, I'll show you how to do it using your user style.
You need to create a custom Legend Style item. Specifically, to do what you want to do, you need to create a a Horizontal Legend Style Item.
Right-Click on the Legend Folder in your User Style File and select New > Horizontal... from the context menu. Don't select Horizontal Bar. That's not what you want.
Under the Arrangement tab, select the third radio button from the top, which displays the legend patch all the way to the right. Then press OK and give your legend style item a name. For the sake of simplicity, I named mine 'Justified-Left-Patch-Right'
Close the Style Manager.
Next you need to just insert a plain old legend. In ArcMap, select Insert > Legend and just zip through the Legend Wizard. We need the Legend Element in order to update it with your preferred style. If you plan on creating maps dynamically, you would just keep a default legend in the MXD and then update it as needed prior to export. I don't know of a way to just automatically insert a default legend through arcpy.
Once you've got a default legend and your preferred style item in place, we can update the legend with your preferred style through arcpy.
At this point, you're ready to update your legend with your preferred style. As you can see, I have the normal default legend in my mxd.
All you need to do now, is iterate through the items in the Legend, and update them with your style item.
You can find more information about updating your legend style through arcpy as well as some additional workflows on with legends in the LegendElement documentation.
Note that while this is the method ESRI provides to update the legend through arcpy, I found it to be fairly unstable. I experienced several hard crashes of ArcMap when doing it. It seemed to occur any time I attempted to update the legend layers after immediately after making a configuration change to my style item in the style manager.
Hope this helps.