<?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: tab when the text has a different size in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10204761#M16907</link>
    <description>&lt;P&gt;I think the idea of trying to display single text string in a table/column style is bad idea: most text fonts do not have the fixed width for all characters, so unless your entire text string only uses a SINGLE character, there is no way to guarantee text entity's width of certain count of characters, whether you use "\t", or pad the string (left or right).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might want to explain why you have to use a single MTEXT to display text string in a table/column style? Why do you not use multiple text entities so that you can position/align them what ever way you want to? Or you can define a block as a table row with attributes at each column position.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Apr 2021 13:23:06 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2021-04-01T13:23:06Z</dc:date>
    <item>
      <title>tab when the text has a different size</title>
      <link>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10202649#M16904</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to insert a Text, I almost succeeded in doing so, but since sometimes my text is a different size, they don't line up.&lt;/P&gt;&lt;P&gt;I enclose what I have, as well as my code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="devranakdogan_0-1617211858844.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/900835iA6EDCC14A58C4EFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="devranakdogan_0-1617211858844.png" alt="devranakdogan_0-1617211858844.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; [CommandMethod("TABULATION")]
        public static void Tab()
        {
            CommandTemplates.ActionCall((Document doc, Editor ed, Database db, Transaction tr) =&amp;gt;
            {
                Dictionary&amp;lt;string, int&amp;gt; ItemList = new Dictionary&amp;lt;string, int&amp;gt;();
                var T1 = new Dictionary&amp;lt;string, string&amp;gt;()
                {
                    ["ALPHA"] = "1",
                    ["BETA"] = "2",
                    ["OMEGA"] = "3"
                };
                var T2 = new Dictionary&amp;lt;string, string&amp;gt;()
                {
                    ["ALPHA"] = "aaaaaaaaaaaaaaaaaaaaaaaaaa",
                    ["BETA"] = "bbbbbbbb",
                    ["OMEGA"] = "ccc"
                };
                var T3 = new Dictionary&amp;lt;string, string&amp;gt;()
                {
                    ["ALPHA"] = "they are not in the same colone",
                    ["BETA"] = "they are not in the same colone",
                    ["OMEGA"] = "they are not in the same colone"
                };
                var mtext = new MText();
                mtext.Contents = string.Join("\\P", T1.Select(pair =&amp;gt; pair.Key + "\t"+ T2[pair.Key] + "\t" + T3[pair.Key]));
                var A = mtext.Contents.ToString();
                CreateMText(A, ed); 
            });
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 31 Mar 2021 17:31:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10202649#M16904</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-31T17:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: tab when the text has a different size</title>
      <link>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10203487#M16905</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&amp;nbsp;&lt;/P&gt;&lt;P&gt;try use&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/dotnet/api/system.string.padright?view=net-5.0" target="_blank" rel="noopener"&gt;string.PadRight()&lt;/A&gt;&amp;nbsp;/ string.PadLeft to align text Left/Right&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 01:59:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10203487#M16905</guid>
      <dc:creator>essam-salah</dc:creator>
      <dc:date>2021-04-01T01:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: tab when the text has a different size</title>
      <link>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10203489#M16906</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;&lt;/P&gt;&lt;P&gt;try this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Columns
                var T1 = new Dictionary&amp;lt;string, string&amp;gt;()
                {
                    ["ALPHA"] = "1",
                    ["BETA"] = "2",
                    ["OMEGA"] = "3"
                };
                var T2 = new Dictionary&amp;lt;string, string&amp;gt;()
                {
                    ["ALPHA"] = "aaaaaaaaaaaaaaaaaaaaaaaaaa",
                    ["BETA"] = "bbbbbbbb",
                    ["OMEGA"] = "ccc"
                };
                var T3 = new Dictionary&amp;lt;string, string&amp;gt;()
                {
                    ["ALPHA"] = "they are not in the same colone",
                    ["BETA"] = "they are not in the same colone",
                    ["OMEGA"] = "they are not in the same colone"
                };

                var WidthArr = new int[]
                {
                    T1.Values.Select(s =&amp;gt; s.Length).Max(),
                    T2.Values.Select(s =&amp;gt; s.Length).Max(),
                    T3.Values.Select(s =&amp;gt; s.Length).Max(),
                };
                var table = string.Join("\n", T1.Keys.Select(key =&amp;gt;
                    $"{T1[key].PadRight(WidthArr[0])}\t" +
                    $"{T2[key].PadRight(WidthArr[1])}\t" +
                    $"{T3[key].PadRight(WidthArr[2])}"));&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 01 Apr 2021 02:01:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10203489#M16906</guid>
      <dc:creator>essam-salah</dc:creator>
      <dc:date>2021-04-01T02:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: tab when the text has a different size</title>
      <link>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10204761#M16907</link>
      <description>&lt;P&gt;I think the idea of trying to display single text string in a table/column style is bad idea: most text fonts do not have the fixed width for all characters, so unless your entire text string only uses a SINGLE character, there is no way to guarantee text entity's width of certain count of characters, whether you use "\t", or pad the string (left or right).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might want to explain why you have to use a single MTEXT to display text string in a table/column style? Why do you not use multiple text entities so that you can position/align them what ever way you want to? Or you can define a block as a table row with attributes at each column position.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 13:23:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10204761#M16907</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2021-04-01T13:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: tab when the text has a different size</title>
      <link>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10215710#M16908</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp; &amp;amp;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3650456"&gt;@essam-salah&lt;/a&gt; ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you both, you helped me a lot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have make this&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;mtext.Contents = string.Join("\\P", ItemList.Select(pair =&amp;gt;"\\pxt10, 48, 63;"  + pair.Key + "\t" + Designation[pair.Key] + "\t" + pair.Value + "\t" + Certificat[pair.Key] ));&lt;/LI-CODE&gt;&lt;P&gt;But now, i want to modify&amp;nbsp;the space between two lines. (modify my "\\P" value)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks a lot !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 14:55:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10215710#M16908</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-06T14:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: tab when the text has a different size</title>
      <link>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10217725#M16909</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;i want to modify&amp;nbsp;the space between two lines. (modify my "\\P" value)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I don't Know what "\\P" means, but you can add new line by &lt;STRONG&gt;"\n"&lt;/STRONG&gt;&amp;nbsp; or&amp;nbsp;&lt;STRONG&gt;Environment.NewLine&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 06:47:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10217725#M16909</guid>
      <dc:creator>essam-salah</dc:creator>
      <dc:date>2021-04-07T06:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: tab when the text has a different size</title>
      <link>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10218917#M16910</link>
      <description>&lt;P&gt;I am still skeptical on why you need to show data of rows/columns with a single MText entity. But for changing the space between lines of a MText, you can look into MText's properties: LineSpaceDistance, LineSpaceFactor and LineSpaceStyle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 14:38:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/tab-when-the-text-has-a-different-size/m-p/10218917#M16910</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2021-04-07T14:38:39Z</dc:date>
    </item>
  </channel>
</rss>

