# How to change the format of the Column and CellText of a table

**URL:** <https://discourse.slicer.org/t/how-to-change-the-format-of-the-column-and-celltext-of-a-table/14189>\
**Category:** Support\
**Created:** [October 21, 2020, 5:00pm UTC](https://discourse.slicer.org/t/how-to-change-the-format-of-the-column-and-celltext-of-a-table/14189 "2020-10-21T17:00:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jj31](https://avatars.discourse-cdn.com/v4/letter/j/ccd318/32.png) [@jj31](https://discourse.slicer.org/u/jj31)\
**Post date:** [October 21, 2020, 5:00pm UTC](https://discourse.slicer.org/t/how-to-change-the-format-of-the-column-and-celltext-of-a-table/14189/1 "2020-10-21T17:00:29Z")

</div>

I would like to change the format of the font (bold, size, family, etc) for both the title and the CellText of a TableNode. I would also like to fix the width of the Table (something like Column width). Using the lines below, I can define the text for the column and the rows. However, I haven’t been able to figure out how to adjust the format. Any suggestions?

slicer.vtkMRMLTableNode().AddColumn().SetName(“column text”)  
slicer.vtkMRMLTableNode().SetCellText(0,0,“row text”)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 21, 2020, 5:15pm UTC](https://discourse.slicer.org/t/how-to-change-the-format-of-the-column-and-celltext-of-a-table/14189/2 "2020-10-21T17:15:55Z")

</div>

Table nodes can store name, type, and additional metadata (description, unit, null value, any other custom field).

Table widget (`slicer.qMRMLTableWidget`) currently does not support any formatting, such as font type or size, but since you can store arbitrary column metadata, this would not be very hard to implement.

For cell-level custom formatting, probably the best approach would be to introduce a new html or markdown data type, which would be rendered using QTextDocument (see [1](https://stackoverflow.com/questions/1956542/how-to-make-item-view-render-rich-html-text-in-qt) or [2](https://www.codesd.com/item/how-to-make-qtableview-fast-with-html-formatted-and-clickable-cells.html) for examples).

If you decide to work on implementing any of these then we can help you getting started and reviewing and integrating the end result. If you want to rich table display without any Slicer core development, then you can simple create a table in html and display it using slicer.qSlicerWebWidget.

---

<div class="post-metadata">

**Author:** ![jj31](https://avatars.discourse-cdn.com/v4/letter/j/ccd318/32.png) [@jj31](https://discourse.slicer.org/u/jj31)\
**Post date:** [October 23, 2020, 12:25am UTC](https://discourse.slicer.org/t/how-to-change-the-format-of-the-column-and-celltext-of-a-table/14189/3 "2020-10-23T00:25:50Z")

</div>

Thanks, Andras. I will look into these examples in more detail and get back if I need any help.
