<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Create non-existant text style in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/create-non-existant-text-style/m-p/9189299#M20687</link>
    <description>&lt;P&gt;This is to set the big font file property of text style.&lt;/P&gt;
&lt;P&gt;If your new style is not shx font, then you can ignore this variable by giving an empty string ( "")&lt;/P&gt;
&lt;P&gt;If you want to use then use and big font file name , like bigfont.shx or other&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 327px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/705579iB729055C5A00EDAF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 08 Dec 2019 06:32:48 GMT</pubDate>
    <dc:creator>Ajilal.Vijayan</dc:creator>
    <dc:date>2019-12-08T06:32:48Z</dc:date>
    <item>
      <title>Create non-existant text style</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-non-existant-text-style/m-p/9185596#M20686</link>
      <description>&lt;P&gt;Some .doc files don't contain a text style I want to use.&lt;/P&gt;&lt;P&gt;The code:&amp;nbsp;GetOrCreateTextStyle I found somewhere uses a variable called "bgfilename" which I assume points to a generic font template file.&lt;/P&gt;&lt;P&gt;Does anyone know what file path this variable might refer to?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Public Function GetOrCreateTextStyle(ByVal stylename As String, ByVal fontfilename As String, ByVal bgfilename As String, ByVal textheight As Double, ByRef trans As Transaction) As ObjectId
        Dim id As ObjectId = GetTextStyle(stylename, trans)
        If id = Nothing Then
            id = CreateTextStyle(stylename, fontfilename, bgfilename, textheight, trans)
        End If
        Return id
    End Function
    Public Function GetTextStyle(ByVal stylename As String, ByRef trans As Transaction) As ObjectId
        Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
        Return GetNonErasedTableRecordId(db.TextStyleTableId, stylename, trans)
    End Function
    Public Function GetNonErasedTableRecordId(ByVal TableId As ObjectId, ByVal Name As String, ByRef trans As Transaction) As ObjectId
        Dim id As ObjectId = Nothing
        Dim table As SymbolTable = DirectCast(trans.GetObject(TableId, OpenMode.ForRead), SymbolTable)
        If table.Has(Name) Then
            id = table(Name)
            If Not id.IsErased Then
                Return id
            End If
            For Each recId As ObjectId In table
                If Not recId.IsErased Then
                    Dim rec As SymbolTableRecord = DirectCast(trans.GetObject(recId, OpenMode.ForRead), SymbolTableRecord)
                    If String.Compare(rec.Name, Name, True) = 0 Then
                        Return recId
                    End If
                End If
            Next
        End If
        Return id
    End Function
    Public Function CreateTextStyle(ByVal stylename As String, ByVal filename As String, ByVal bgfilename As String, ByVal textheight As Double, ByRef trans As Transaction) As ObjectId
        Dim id As ObjectId = Nothing
        Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
        Try
            Dim tst As TextStyleTable = DirectCast(trans.GetObject(db.TextStyleTableId, OpenMode.ForRead, False), TextStyleTable)
            Using ts As New TextStyleTableRecord()
                ts.Name = stylename
                ts.FileName = filename
                If bgfilename &amp;lt;&amp;gt; String.Empty Then
                    ts.BigFontFileName = bgfilename
                End If
                ts.TextSize = textheight
                ts.XScale = 1.0
                tst.UpgradeOpen()
                tst.Add(ts)
                trans.AddNewlyCreatedDBObject(ts, True)
                id = ts.ObjectId
            End Using
        Catch ex As Exception
            MsgBox(Reflection.MethodBase.GetCurrentMethod.Name() + " Exception: " + ex.Message)
        End Try
        Return id
    End Function&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Dec 2019 19:56:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-non-existant-text-style/m-p/9185596#M20686</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2019-12-05T19:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create non-existant text style</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-non-existant-text-style/m-p/9189299#M20687</link>
      <description>&lt;P&gt;This is to set the big font file property of text style.&lt;/P&gt;
&lt;P&gt;If your new style is not shx font, then you can ignore this variable by giving an empty string ( "")&lt;/P&gt;
&lt;P&gt;If you want to use then use and big font file name , like bigfont.shx or other&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 327px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/705579iB729055C5A00EDAF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 06:32:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-non-existant-text-style/m-p/9189299#M20687</guid>
      <dc:creator>Ajilal.Vijayan</dc:creator>
      <dc:date>2019-12-08T06:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Create non-existant text style</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-non-existant-text-style/m-p/9189617#M20688</link>
      <description>&lt;P&gt;Thanks Ajilal,&lt;/P&gt;&lt;P&gt;That explains things.&lt;/P&gt;&lt;P&gt;I also worked out that the template file with the 'problem' was causing the app to fail to load correctly which was the cause of the missing font.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 15:40:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-non-existant-text-style/m-p/9189617#M20688</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2019-12-08T15:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create non-existant text style</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-non-existant-text-style/m-p/9190237#M20689</link>
      <description>&lt;P&gt;You're welcome, glad I could help.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 05:53:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-non-existant-text-style/m-p/9190237#M20689</guid>
      <dc:creator>Ajilal.Vijayan</dc:creator>
      <dc:date>2019-12-09T05:53:16Z</dc:date>
    </item>
  </channel>
</rss>

