uitable: text-alignment with HTML

3 visualizzazioni (ultimi 30 giorni)
M.
M. il 26 Mar 2014
Commentato: Walter Roberson il 19 Gen 2023
Hello everybody!
To customize uitbales in Matlab I used the solution posted in:
which works perfectly.
Additionally, I would like to align each cell content (strings) to the center of the cell. To do so I tried changing:
colText('Blue text', 'blue'), ...
to
colText('<HTML><p style="text-align:center">Blue text</p></HTML>', 'blue')
But it does not show any effect.
Can you tell me how it is possible to change the text alignment in the cells using the suggested code snippet from the posted link and maybe give an example?
Thank you very much in advance!

Risposte (2)

Walter Roberson
Walter Roberson il 26 Mar 2014
Modificato: Walter Roberson il 19 Gen 2023
style attributes and css are newer than the HTML that is supported. Use the HTML CENTER tag instead.
  2 Commenti
M.
M. il 26 Mar 2014
Modificato: M. il 28 Mar 2014
Thank you for your answer. Do you mean
colText('<html><center>test</center></html>', 'blue'), ...
?
Unfortunatelly that doesn't work either =/
Walter Roberson
Walter Roberson il 19 Gen 2023
Note: in the time since this question was originally asked, uifigure() were added. uitable() that exist within uifigure() have additional formatting possibilities

Accedi per commentare.


Prof. X
Prof. X il 19 Gen 2023
Modificato: Prof. X il 19 Gen 2023
Use this as reference. This centers the text, makes the background red, and changes the font color to white:
uitable('data',{'<html><tr><td width=9999 style="color:White;background-color:#FF0000;text-align:center">X'})

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by