'查找并设置文本样式格式
'参数:样式名、字体名、高度、宽度
'若样式不存在则创建,若存在则设置
Function adTextStyle(txtStyleName As String, txtFontName As String, txtStyleHeight As Single, txtStyleWidth As Single) As TextStyle
Dim aTextStyle As TextStyle
Set aTextStyle = ActiveDesignFile.TextStyles.Find(txtStyleName)
If aTextStyle Is Nothing Then
Set aTextStyle = ActiveDesignFile.TextStyles.Add(Nothing, txtStyleName)
aTextStyle.Height = txtStyleHeight
aTextStyle.Width = txtStyleWidth
aTextStyle.Font = FindFontByName(txtFontName)
'Else
'aTextStyle.Height = txtStyleHeight
'aTextStyle.Width = txtStyleWidth
'aTextStyle.Font = FindFontByName(txtFontName)
End If
Set adTextStyle = aTextStyle
End Function
'参数:样式名、字体名、高度、宽度
'若样式不存在则创建,若存在则设置
Function adTextStyle(txtStyleName As String, txtFontName As String, txtStyleHeight As Single, txtStyleWidth As Single) As TextStyle
Dim aTextStyle As TextStyle
Set aTextStyle = ActiveDesignFile.TextStyles.Find(txtStyleName)
If aTextStyle Is Nothing Then
Set aTextStyle = ActiveDesignFile.TextStyles.Add(Nothing, txtStyleName)
aTextStyle.Height = txtStyleHeight
aTextStyle.Width = txtStyleWidth
aTextStyle.Font = FindFontByName(txtFontName)
'Else
'aTextStyle.Height = txtStyleHeight
'aTextStyle.Width = txtStyleWidth
'aTextStyle.Font = FindFontByName(txtFontName)
End If
Set adTextStyle = aTextStyle
End Function