Calling IStyleGallery::LoadStyle fails with an unspecified error for a ServerStyleGallery
Last Published: August 25, 2014No Product Found
Bug ID Number
NIM001002
Submitted
February 7, 2006
Last Modified
June 5, 2024
Applies to
No Product Found
Version found
9.1
Version Fixed
N/A
Status
Fixed
The bug has been fixed. See the Version Fixed and Additional Information, if applicable, for more information.
Workaround
The server style gallery doesn’t have an initialized “targetfile” so you need to set it before doing anything. You don’t see this issue with the regular stylegallery because the application sets up the “targetfile” at startup.You need to do it like this:Public Sub Test()Dim pSG As IStyleGallerySet pSG = New ServerStyleGalleryDim pSGS As IStyleGalleryStorageSet pSGS = pSG'TODO - CHANGE THIS TO POINT TO A PATH YOU CAN WRITE TOpSGS.TargetFile = "C:\temp\test.ServerStyle"' TODO - CHANGE THIS TO POINT TO YOUR OWN SERVER STYLE FILE.Dim strStyleFile As StringstrStyleFile = "C:\ArcGIS\Styles\ESRI_Optimized.ServerStyle"pSG.LoadStyle strStyleFile, "Text Symbols"MsgBox pSG.ClassCountEnd Sub