# Change Layout::FormattedText nested in a table

**URL:** <https://forums.sketchup.com/t/change-layout-formattedtext-nested-in-a-table/61927>\
**Category:** Ruby API\
**Tags:** layoutapi\
**Created:** [February 13, 2018, 6:29am UTC](https://forums.sketchup.com/t/change-layout-formattedtext-nested-in-a-table/61927 "2018-02-13T06:29:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![drewmorse](https://avatars.discourse-cdn.com/v4/letter/d/da6949/32.png) [@drewmorse](https://forums.sketchup.com/u/drewmorse)\
**Post date:** [February 13, 2018, 6:29am UTC](https://forums.sketchup.com/t/change-layout-formattedtext-nested-in-a-table/61927/1 "2018-02-13T06:29:45Z")

</div>

I’m trying to use the LayOut Ruby API to change existing text objects within LayOut.

When I access a Layout::FormattedText object that’s just an entity on a Page, or is nested in a Group, using the #plain\_text= method to assign a new string works fine.

However, when I access a FormattedText object in a Table (or in a Dimension), I’m unable to change the existing text using the #plain\_text= method. I can understand this limitation for a Dimension, but any ideas why this won’t work for text in a TableCell?

Does anyone have ideas for how to change the text in a LayOut table programmatically?

Thanks,  
Andrew

---

<div class="post-metadata">

**Author:** ![adam](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/adam/32/1621_2.png) [@adam](https://forums.sketchup.com/u/adam)\
**Post date:** [March 5, 2018, 6:34pm UTC](https://forums.sketchup.com/t/change-layout-formattedtext-nested-in-a-table/61927/2 "2018-03-05T18:34:55Z")

</div>

> [@drewmorse](#):
>
> However, when I access a FormattedText object in a Table (or in a Dimension), I’m unable to change the existing text using the #plain\_text= method. I can understand this limitation for a Dimension, but any ideas why this won’t work for text in a TableCell?

After you’ve modified your FormattedText object, you will need to use [TableCell#data=](http://ruby.sketchup.com/Layout/TableCell.html#data=-instance_method). The reason for this is that you got a _copy_ of the TableCell’s text entity, not the original.

Hope this helps,  
Adam

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sketchup/original/3X/f/2/f2a121500b085ed60806607a82720b092d800bb3.png) [@system](https://forums.sketchup.com/u/system)\
**Post date:** [June 5, 2018, 10:34am UTC](https://forums.sketchup.com/t/change-layout-formattedtext-nested-in-a-table/61927/3 "2018-06-05T10:34:56Z")

</div>

Closed on June 5, 2018, 10:34am UTC

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.
