I have a design file with 1 Enter Data field element.
How do you get the Font Name from this text string?
Thanks!
Regan
Please follow the MicroStation Programming forum best practices.
Please identify the version of MicroStation, or other product such as PowerDraft, that you are using: MicroStation CONNECT or MicroStation V8i.
The APIs supplied with MicroStation CONNECT are different to those supplied with MicroStation V8i. Consequently, our answers are likely to be different.
Are you writing MDL, C++, C#, VB.NET or MicroStation VBA?
Are you building an in-process app. (i.e. a DLL) or a stand-alone app. (i.e. an EXE)?
When you post code, use the Forum advanced editor's syntax highlighting tool. That's the icon that resembles a pencil:
Regards, Jon Summers LA Solutions
Unknown said: I have a design file with 1 Enter Data field element. How do you get the Font Name from this text string?
I have a design file with 1 Enter Data field element. How do you get the Font Name from this text string?
An enter-data field is part of a TextElement. A TextElement has only one font: you can't have multiple fonts in a TextElement. The answer to your question is: Get the font of the TextElement that stores the enter-data field.
However, there's no straightforward way to get the font of a TextElement. You have to get its TextStyle, then obtain the font from the TextStyle...
Sub GetFont (ByVal oText As TextElement) Dim oStyle As TextStyle Set oStyle = oText.TextStyle If Not oStyle Is Nothing Then Dim oFont As Font Set oFont = oStyle.Font If oFont Is Nothing Then Debug.Print "Text style '" & oStyle.Name & "' has no font" Else Debug.Print "Text style '" & oStyle.Name & "' uses font '" & oFont.Name & "'" End If End If End Sub