<?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: Modifying CharacterSet Property of MText Object in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7810913#M27117</link>
    <description>&lt;P&gt;Thanks for the help, this code accomplished the requirement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public static void SetTextToModifiedCharacterSet(Document document)&lt;BR /&gt;{&lt;BR /&gt;Database db = document.Database;&lt;BR /&gt;Editor ed = document.Editor;&lt;BR /&gt;TypedValue[] tvs = new[]&lt;BR /&gt;{&lt;BR /&gt;new TypedValue(0, "MTEXT"), // only MText&lt;BR /&gt;new TypedValue(410, "Model") // in model space&lt;BR /&gt;};&lt;BR /&gt;SelectionFilter filter = new SelectionFilter(tvs);&lt;BR /&gt;PromptSelectionResult selection = ed.SelectAll(filter);&lt;BR /&gt;if (selection.Status != PromptStatus.OK)&lt;BR /&gt;return;&lt;BR /&gt;using (Transaction tr = db.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;BR /&gt;foreach (SelectedObject obj in selection.Value)&lt;BR /&gt;{&lt;BR /&gt;ObjectId id = obj.ObjectId;&lt;BR /&gt;if (id.ObjectClass.DxfName == "MTEXT")&lt;BR /&gt;{&lt;BR /&gt;MText mtext = (MText)tr.GetObject(id, OpenMode.ForWrite);&lt;BR /&gt;TextEditor textEditor = TextEditor.CreateTextEditor(mtext);&lt;BR /&gt;textEditor.SelectAll();&lt;BR /&gt;TextEditorSelection sel = textEditor.Selection;&lt;BR /&gt;sel.Language = (int)System.Windows.Forms.VisualStyles.TextMetricsCharacterSet.Russian;&lt;BR /&gt;textEditor.Close(TextEditor.ExitStatus.ExitSave);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;tr.Commit();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Mon, 26 Feb 2018 23:36:22 GMT</pubDate>
    <dc:creator>drewj</dc:creator>
    <dc:date>2018-02-26T23:36:22Z</dc:date>
    <item>
      <title>Modifying CharacterSet Property of MText Object</title>
      <link>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7810356#M27113</link>
      <description>&lt;P&gt;Is it possible to modify the CharacterSet of a MTEXT element?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can modify it on the ribbon (see attached CharacterSet image) but I the only reference I can see for it is that it is readonly on the Font rather than on the individual mtext element (see FontCharacterSet image).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Drew&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2018 19:22:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7810356#M27113</guid>
      <dc:creator>drewj</dc:creator>
      <dc:date>2018-02-26T19:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying CharacterSet Property of MText Object</title>
      <link>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7810776#M27114</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;&lt;P&gt;Is it possible to modify the CharacterSet of a MTEXT element?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can modify it on the ribbon (see attached CharacterSet image) but I the only reference I can see for it is that it is readonly on the Font rather than on the individual mtext element (see FontCharacterSet image).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Drew&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I'm pretty sure that the way to do this is via the TextEditor class. You call TextEdtior.CreateTextEditor() passing in the MText.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, you establish the selection or range of text that you want to modify (or use SelectAll() to modify the entire MText), then you use the &lt;STRONG&gt;Language&lt;/STRONG&gt; property of the TextEditorSelection object returned by the TextEditor's Selection property. The value of the Language property is an int, which can be cast to/from System.Windows.Forms.VisualStyles.TextMetricsCharacterSet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2018 22:32:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7810776#M27114</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2018-02-26T22:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying CharacterSet Property of MText Object</title>
      <link>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7810783#M27115</link>
      <description>&lt;P&gt;That's exactly the type of push in the right direction I was looking for, thanks. I will report back if I get it working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Drew&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2018 22:24:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7810783#M27115</guid>
      <dc:creator>drewj</dc:creator>
      <dc:date>2018-02-26T22:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying CharacterSet Property of MText Object</title>
      <link>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7810876#M27116</link>
      <description>&lt;P&gt;Whoops, let me check that Language you suggested. I missed that, nearly there.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2018 23:18:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7810876#M27116</guid>
      <dc:creator>drewj</dc:creator>
      <dc:date>2018-02-26T23:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying CharacterSet Property of MText Object</title>
      <link>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7810913#M27117</link>
      <description>&lt;P&gt;Thanks for the help, this code accomplished the requirement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public static void SetTextToModifiedCharacterSet(Document document)&lt;BR /&gt;{&lt;BR /&gt;Database db = document.Database;&lt;BR /&gt;Editor ed = document.Editor;&lt;BR /&gt;TypedValue[] tvs = new[]&lt;BR /&gt;{&lt;BR /&gt;new TypedValue(0, "MTEXT"), // only MText&lt;BR /&gt;new TypedValue(410, "Model") // in model space&lt;BR /&gt;};&lt;BR /&gt;SelectionFilter filter = new SelectionFilter(tvs);&lt;BR /&gt;PromptSelectionResult selection = ed.SelectAll(filter);&lt;BR /&gt;if (selection.Status != PromptStatus.OK)&lt;BR /&gt;return;&lt;BR /&gt;using (Transaction tr = db.TransactionManager.StartTransaction())&lt;BR /&gt;{&lt;BR /&gt;foreach (SelectedObject obj in selection.Value)&lt;BR /&gt;{&lt;BR /&gt;ObjectId id = obj.ObjectId;&lt;BR /&gt;if (id.ObjectClass.DxfName == "MTEXT")&lt;BR /&gt;{&lt;BR /&gt;MText mtext = (MText)tr.GetObject(id, OpenMode.ForWrite);&lt;BR /&gt;TextEditor textEditor = TextEditor.CreateTextEditor(mtext);&lt;BR /&gt;textEditor.SelectAll();&lt;BR /&gt;TextEditorSelection sel = textEditor.Selection;&lt;BR /&gt;sel.Language = (int)System.Windows.Forms.VisualStyles.TextMetricsCharacterSet.Russian;&lt;BR /&gt;textEditor.Close(TextEditor.ExitStatus.ExitSave);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;tr.Commit();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2018 23:36:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7810913#M27117</guid>
      <dc:creator>drewj</dc:creator>
      <dc:date>2018-02-26T23:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying CharacterSet Property of MText Object</title>
      <link>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7811394#M27118</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;&lt;P&gt;Thanks for the help, this code accomplished the requirement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Great. Glad you solved the problem.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 06:08:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/modifying-characterset-property-of-mtext-object/m-p/7811394#M27118</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2018-02-27T06:08:05Z</dc:date>
    </item>
  </channel>
</rss>

