I would like to add a style to the Style Manager using ArcObjects. I guess this is done using IStyleImporter.Import. However, I haven't found a sample how to get a StyleImporter object. I tried to cocreate it, but it isn't possible. Can anyone help?
Haven't tried it, but what about the StyleGallery ?
e.g.
...
var mxDocument = application.Document as IMxDocument;
var styleGallery = mxDocument.StyleGallery;
styleGallery.LoadStyle(filename, null);
or,
var styleGalleryStorage = mxDocument.StyleGallery as IStyleGalleryStorage;
styleGalleryStorage.AddFile(filename);
See:
ArcObjects 10 .NET SDK Help - IStyleGallery
ArcObjects 10 .NET SDK Help - IStyleGalleryStorage
Thanks, Chris!
IStyleGalleryStorage.AddFile() is used to add a style to Style Manager.
IStyleGallery.LoadStyle() is used to load a style from Style Gallery that is already present in Style Manager.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.