10-26-2020
02:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-26-2020
02:52 PM
i could not find a command for Replacing a text style. But i found a way to delete the style and copy the other. it works like this:
Dim originalStyleName As String = "ReplaceMe" Dim replaceBy As String = "replaceWithMe" Dim doc As PartDocument = ThisDoc.Document Dim def As PartComponentDefinition = doc.ComponentDefinition Dim textStyleOrg As TextStyle = Nothing Dim textStyleNew As TextStyle = Nothing For Each style As TextStyle In doc.TextStyles If (Style.Name = originalStyleName) Then textStyleOrg = Style End If If (Style.Name = replaceBy) Then textStyleNew = Style End If Next textStyleOrg.Delete() textStyleNew.Copy(originalStyleName)
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com