Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to change all text style font in a drawing document, regardless of the style they belong to. The problem is I'm getting an error while overwriting some text styles (it works for some styles, then I get the error below). Can someone help with this? I would really appreciate it.
Here is the code I'm using:
Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oTM As TransactionManager = ThisApplication.TransactionManager
Dim oTS As TextStylesEnumerator = oDDoc.StylesManager.TextStyles
Dim sNameTextB As String = "MyTxtStyle"
Dim oStyleB As TextStyle = oTS.Item(sNameTextB)
Dim newTM As Transaction = oTM.StartTransaction(oDDoc, "ChangeTextStyle")
For Each oStyleA As TextStyle In oDDoc.StylesManager.TextStyles
If oStyleA.Font <> oStyleB.Font Then
oStyleA.Font = oStyleB.Font
End If
Next oStyleA
newTM.End()
Solved! Go to Solution.