<?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 Issue with AutoCAD Table Plotting '####' in Cells with Formulas in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/issue-with-autocad-table-plotting-in-cells-with-formulas/m-p/12775240#M3949</link>
    <description>&lt;P&gt;(The prompt for this post was written by me and fed to ChatGPT in an effort to make it easier to read and diagnose the issue)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV class=""&gt;Problem Description&lt;P class=""&gt;I am experiencing an issue when publishing a drawing in AutoCAD. A table created using the AutoCAD API is plotted with '####' in a cell that contains a formula for the Total Sum of a column of lengths.&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;Code Snippet&lt;P class=""&gt;Below is the main code responsible for creating the table:&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private static Table BuildTable(string title, List&amp;lt;string&amp;gt; headers, Point3d insertPoint, LoopDataCollection tableData)
{
    Table tb = new Table();

    try
    {
        tb.Position = insertPoint;
        tb.TableStyle = Active.Database.Tablestyle;
        tb.SetSize(tableData.Count + 3, 1);
        tb.SetRowHeight(.5);
        tb.SetColumnWidth(1.5);
        tb.Cells[0, 0].SetValue(title, ParseOption.ParseOptionNone);
        tb.Cells[0, 0].TextHeight = .22;

        // Set the width of the columns
        tb.InsertColumns(0, 1.00, 1);
        tb.InsertColumns(0, 1.625, 1);
        tb.InsertColumns(0, 1.5, 1);

        // Insert headers
        int irowcount = 1;
        int icolcount = 0;
        foreach (String header in headers)
        {
            tb.Cells[irowcount, icolcount].SetValue(header, ParseOption.ParseOptionNone);
            tb.Cells[irowcount, icolcount].TextHeight = 0.20;
            icolcount++;
        }

        // Set header row height
        tb.Rows[irowcount].Height = .50;

        // Insert data rows
        irowcount = 2;
        foreach (LoopMarkerData loop in tableData)
        {
            tb.Cells[irowcount, 0].SetValue(loop.ZoneId, ParseOption.ParseOptionNone);
            tb.Cells[irowcount, 0].TextHeight = 0.20;

            tb.Cells[irowcount, 1].SetValue(loop.Manifold, ParseOption.ParseOptionNone);
            tb.Cells[irowcount, 1].TextHeight = 0.20;

            tb.Cells[irowcount, 2].SetValue(loop.Loop, ParseOption.ParseOptionNone);
            tb.Cells[irowcount, 2].TextHeight = 0.20;

            tb.Cells[irowcount, 3].TextString = loop.LengthTotal;
            tb.Cells[irowcount, 3].TextHeight = 0.20;

            // Set row height for data
            tb.Rows[irowcount].Height = .375;

            // Move to the next row
            irowcount++;
        }

        // Add Totals
        tb.Cells[tb.Rows.Count - 1, 1].SetValue("Total", ParseOption.ParseOptionNone);
        tb.Cells[tb.Rows.Count - 1, 1].TextHeight = 0.25;

        tb.Cells[tb.Rows.Count - 1, 3].Contents.Add();
        tb.Cells[tb.Rows.Count - 1, 3].Contents[0].Formula = "=Sum(D3:D" + (tb.Rows.Count - 1) + ")";
        
        // Generate the layout
        tb.GenerateLayout();
    }
    catch (Autodesk.AutoCAD.Runtime.Exception ex)
    {
        return null;
    }
    return tb;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;Repository&lt;P class=""&gt;The rest of the code can be found in this repository:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/WB-nshupe/TableTestShare/" target="_blank" rel="noopener"&gt;GitHub - WB-nshupe/TableTestShare&lt;/A&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P class=""&gt;The project folder contains a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Drawing1.dwg&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file and a bundle folder with a .dll that includes one command,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;AddTable. I've minimized the code in the plugin to isolate the issue.&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;Steps to Reproduce&lt;OL&gt;&lt;LI&gt;Open&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Drawing1.dwg.&lt;/LI&gt;&lt;LI&gt;Run the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;AddTable&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;command.&lt;/LI&gt;&lt;LI&gt;Select the marker in model space and press Enter.&lt;/LI&gt;&lt;LI&gt;Select a point to insert the new table.&lt;/LI&gt;&lt;LI&gt;Delete the old table.&lt;/LI&gt;&lt;LI&gt;Use "Save As" to save the drawing to a new folder (e.g., create a 'test' folder in the same directory as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Drawing1.dwg).&lt;/LI&gt;&lt;LI&gt;Without closing or saving the file, select both layouts and publish.&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P class=""&gt;The generated PDF will show the table with '####' in the cells, and the table in paper space will also have '####'.&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;Temporary Solution&lt;P class=""&gt;The only workaround I've found is to close and reopen the drawing after running "Save As". This makes the table display correctly.&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;Question&lt;P class=""&gt;Is there anything I can do differently in my table generation code to resolve this problem?&lt;/P&gt;&lt;/DIV&gt;&lt;P class=""&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 15 May 2024 15:21:14 GMT</pubDate>
    <dc:creator>nshupeFMPE3</dc:creator>
    <dc:date>2024-05-15T15:21:14Z</dc:date>
    <item>
      <title>Issue with AutoCAD Table Plotting '####' in Cells with Formulas</title>
      <link>https://forums.autodesk.com/t5/net-forum/issue-with-autocad-table-plotting-in-cells-with-formulas/m-p/12775240#M3949</link>
      <description>&lt;P&gt;(The prompt for this post was written by me and fed to ChatGPT in an effort to make it easier to read and diagnose the issue)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV class=""&gt;Problem Description&lt;P class=""&gt;I am experiencing an issue when publishing a drawing in AutoCAD. A table created using the AutoCAD API is plotted with '####' in a cell that contains a formula for the Total Sum of a column of lengths.&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;Code Snippet&lt;P class=""&gt;Below is the main code responsible for creating the table:&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private static Table BuildTable(string title, List&amp;lt;string&amp;gt; headers, Point3d insertPoint, LoopDataCollection tableData)
{
    Table tb = new Table();

    try
    {
        tb.Position = insertPoint;
        tb.TableStyle = Active.Database.Tablestyle;
        tb.SetSize(tableData.Count + 3, 1);
        tb.SetRowHeight(.5);
        tb.SetColumnWidth(1.5);
        tb.Cells[0, 0].SetValue(title, ParseOption.ParseOptionNone);
        tb.Cells[0, 0].TextHeight = .22;

        // Set the width of the columns
        tb.InsertColumns(0, 1.00, 1);
        tb.InsertColumns(0, 1.625, 1);
        tb.InsertColumns(0, 1.5, 1);

        // Insert headers
        int irowcount = 1;
        int icolcount = 0;
        foreach (String header in headers)
        {
            tb.Cells[irowcount, icolcount].SetValue(header, ParseOption.ParseOptionNone);
            tb.Cells[irowcount, icolcount].TextHeight = 0.20;
            icolcount++;
        }

        // Set header row height
        tb.Rows[irowcount].Height = .50;

        // Insert data rows
        irowcount = 2;
        foreach (LoopMarkerData loop in tableData)
        {
            tb.Cells[irowcount, 0].SetValue(loop.ZoneId, ParseOption.ParseOptionNone);
            tb.Cells[irowcount, 0].TextHeight = 0.20;

            tb.Cells[irowcount, 1].SetValue(loop.Manifold, ParseOption.ParseOptionNone);
            tb.Cells[irowcount, 1].TextHeight = 0.20;

            tb.Cells[irowcount, 2].SetValue(loop.Loop, ParseOption.ParseOptionNone);
            tb.Cells[irowcount, 2].TextHeight = 0.20;

            tb.Cells[irowcount, 3].TextString = loop.LengthTotal;
            tb.Cells[irowcount, 3].TextHeight = 0.20;

            // Set row height for data
            tb.Rows[irowcount].Height = .375;

            // Move to the next row
            irowcount++;
        }

        // Add Totals
        tb.Cells[tb.Rows.Count - 1, 1].SetValue("Total", ParseOption.ParseOptionNone);
        tb.Cells[tb.Rows.Count - 1, 1].TextHeight = 0.25;

        tb.Cells[tb.Rows.Count - 1, 3].Contents.Add();
        tb.Cells[tb.Rows.Count - 1, 3].Contents[0].Formula = "=Sum(D3:D" + (tb.Rows.Count - 1) + ")";
        
        // Generate the layout
        tb.GenerateLayout();
    }
    catch (Autodesk.AutoCAD.Runtime.Exception ex)
    {
        return null;
    }
    return tb;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;Repository&lt;P class=""&gt;The rest of the code can be found in this repository:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/WB-nshupe/TableTestShare/" target="_blank" rel="noopener"&gt;GitHub - WB-nshupe/TableTestShare&lt;/A&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P class=""&gt;The project folder contains a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Drawing1.dwg&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file and a bundle folder with a .dll that includes one command,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;AddTable. I've minimized the code in the plugin to isolate the issue.&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;Steps to Reproduce&lt;OL&gt;&lt;LI&gt;Open&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Drawing1.dwg.&lt;/LI&gt;&lt;LI&gt;Run the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;AddTable&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;command.&lt;/LI&gt;&lt;LI&gt;Select the marker in model space and press Enter.&lt;/LI&gt;&lt;LI&gt;Select a point to insert the new table.&lt;/LI&gt;&lt;LI&gt;Delete the old table.&lt;/LI&gt;&lt;LI&gt;Use "Save As" to save the drawing to a new folder (e.g., create a 'test' folder in the same directory as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Drawing1.dwg).&lt;/LI&gt;&lt;LI&gt;Without closing or saving the file, select both layouts and publish.&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P class=""&gt;The generated PDF will show the table with '####' in the cells, and the table in paper space will also have '####'.&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;Temporary Solution&lt;P class=""&gt;The only workaround I've found is to close and reopen the drawing after running "Save As". This makes the table display correctly.&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;Question&lt;P class=""&gt;Is there anything I can do differently in my table generation code to resolve this problem?&lt;/P&gt;&lt;/DIV&gt;&lt;P class=""&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 15:21:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issue-with-autocad-table-plotting-in-cells-with-formulas/m-p/12775240#M3949</guid>
      <dc:creator>nshupeFMPE3</dc:creator>
      <dc:date>2024-05-15T15:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with AutoCAD Table Plotting '####' in Cells with Formulas</title>
      <link>https://forums.autodesk.com/t5/net-forum/issue-with-autocad-table-plotting-in-cells-with-formulas/m-p/12775937#M3950</link>
      <description>&lt;LI-CODE lang="csharp"&gt;tb.Cells[tb.Rows.Count - 1, 3].Contents[0].Formula = "%&amp;lt;\\AcExpr (Sum(" + "D3:D" + (tb.Rows.Count).ToString() + "))&amp;gt;%";&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 May 2024 20:09:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issue-with-autocad-table-plotting-in-cells-with-formulas/m-p/12775937#M3950</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2024-05-15T20:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with AutoCAD Table Plotting '####' in Cells with Formulas</title>
      <link>https://forums.autodesk.com/t5/net-forum/issue-with-autocad-table-plotting-in-cells-with-formulas/m-p/12776085#M3951</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/565180"&gt;@Gepaha&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you for the replay, unfortunately this is what happens with the suggested code&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nshupeFMPE3_0-1715809408119.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1362787i7100FBC58D33D7F1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nshupeFMPE3_0-1715809408119.png" alt="nshupeFMPE3_0-1715809408119.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Interestingly, when I Save As the formula immediately "corrupts" instead of requiring a Publish&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nshupeFMPE3_1-1715809462363.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1362788i00B7DB35B621E093/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nshupeFMPE3_1-1715809462363.png" alt="nshupeFMPE3_1-1715809462363.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 21:44:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issue-with-autocad-table-plotting-in-cells-with-formulas/m-p/12776085#M3951</guid>
      <dc:creator>nshupeFMPE3</dc:creator>
      <dc:date>2024-05-15T21:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with AutoCAD Table Plotting '####' in Cells with Formulas</title>
      <link>https://forums.autodesk.com/t5/net-forum/issue-with-autocad-table-plotting-in-cells-with-formulas/m-p/12778078#M3952</link>
      <description>&lt;P&gt;Strange, I tested your code for the formula and it works correctly.&lt;BR /&gt;Is the cell selection range correct?&lt;BR /&gt;Have you tried adding the formula through AutoCAD? Does it work correctly?&lt;/P&gt;</description>
      <pubDate>Thu, 16 May 2024 14:51:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/issue-with-autocad-table-plotting-in-cells-with-formulas/m-p/12778078#M3952</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2024-05-16T14:51:20Z</dc:date>
    </item>
  </channel>
</rss>

