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?
Solved! Go to Solution.
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
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.