04-03-2024
09:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-03-2024
09:08 AM
Copy Styles From Template File
Good Afternoon,
I'm trying to copy styles from a template file and add/update the local styles.
I found similar code written by @WCrihfield and tweaked it to be what I'm looking for. But it doesn't appear to be overriding the existing styles.
Reference:
Dim oTDDoc As DrawingDocument = ThisApplication.Documents.Open(oTFN, False)
Dim oTStylesMgr As DrawingStylesManager = oTDDoc.StylesManager Dim oStylesMgr As DrawingStylesManager = oDDoc.StylesManager Dim oStyle As Style For Each oTStyle As Style In oTStylesMgr.Styles MsgBox(oTStyle.Name) If oTStyle.StyleLocation = StyleLocationEnum.kLibraryStyleLocation Then oTStyle.ConvertToLocal ElseIf oTStyle.StyleLocation = StyleLocationEnum.kBothStyleLocation Or _ oTStyle.StyleLocation = StyleLocationEnum.kLocalStyleLocation Then oStyle = oStylesMgr.Styles.Item(oTStyle.Name) Dim oTSCol As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection oTSCol.Add(oTStyle) oTStylesMgr.ReplaceStyles(oTSCol, oStyle, True) End If Next