Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4331

[Connect Update 16 C# .NET & COM] Updating text within cell shifts location

$
0
0

I have the following basic code I am using to update text elements within a cell, using the OpenDesignFileForProgram interface, and it seems weird that once in a while the some of the text shifts, its not consistent enough that if you run the same method over and over sometimes it shifts and other times it does not. Is this a known issue and is there a workaround?

private static void UpdateTextNodeElement(TextNodeElement textNodeElement, string newText)
        {
            //if (elem.ID64 == diTextElem.Id)
            //{
                ElementEnumerator enumerator = textNodeElement.GetSubElements();
                int i = 0;
                while (enumerator.MoveNext())
                {
                    var values = newText.Split('\r');
                    if (values.Count() > i)
                    {
                        TextElement t = (TextElement)enumerator.Current;
                        t.Text = newText.Split('\r')[i];
                        t.Rewrite();
                    }

                    i++;
                }
            //}
        }

        private static void UpdateTextElement(TextElement text, string newText)
        {
            text.Text = newText;
            text.Rewrite();
        }

Both should be centered.


Viewing all articles
Browse latest Browse all 4331

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>