# How to use the TableText commando to create a table from a spredsheet with a variable number of rows

M.E shared this question 1 year ago

I would like to create a table from cell content in the spreadsheet with a variable number of rows by using the TableText command.

How can I do that ?

1

attached a sample

1

Thanks.

Sorry, I see I should have read this a bit more carefully in relation to how to place rows and columns in the command: https://wiki.geogebra.org/e...

Is it possible to use the command to have one column where the content is left aligned, while the rest of the columns are centered ?

Or how can I make that ?

1

see attachment

1

your first example is easier with TableText({A1:A200, B1:B200, C1:C200}, "vcrl")

1

Thank you both. :)

It's quite smart so easy it is.

"v" stands for that every element of the list (for example "A1:A200", "B1:B200" and "C1:C200") is a column.

I see the last three letters stands for the alignment of the content in each column in the listed order of the columns.

The letter "c" stands for centered, "r" for right and "l" for left alignment.

And if one would like to have the table with all borders showed, then the command will be:

TableText[ { A1:A200, B1:B200, C1:C200 }, "|_vcrl" ]

Be aware that this "|" is not a letter, but instead a symbol.

"|" stands for showed borders to the left and right of every column. And "_" stands for showed borders above and below each row.

1

Moved below.

1

No words to express my thanks. Timely help. Though posted a year ago, it is fabulous

1

Dear Colleagues,

Is there a way of controlling the column width of the columns when using either

TableText[ { A1:A200, B1:B200, C1:C200 }, "|_vcrl" ]

or the multiple table solution suggested by Rami? And, Rami, if yes, can you make the relative position to A responsive to the width of the table?

Many thanks!

1

Quote: "relative position to A responsive to the width of the table"

yes: see definition T_2, T_3 with using Corner(T_x, 3)

1

To illustrate my question better, I have created a GeoGebra file.

1

@Rami, thank you again, for all your kind and generous support! very much appreciated.

A small follow up on your response "yes: see definition T_2, T_3 with using Corner(T_x, 3)".

In the sample file you have supplied, the top of each table T_1, T_2 and T_3 are no longer vertically aligned -- is there something to be done to solve that/

2

Quote: "To illustrate my question"

use Text Tool with laTex

See text13

1

sample with T_1, T_2, T_3 "no loger vertically"

no problem in my environment (windows 10 GGB5.0.588 and GGB6.0.588 WEB)

If you transfer my sample in your file: check the sequence of objects in Construction Protokoll

1

Quote: "use Text Tool with laTex"

@Rami, thank you, thank you very much. I really and very deeply appreciate your incredible kindness in responding as generously as you do! Thank you -- thank you is all I have here -- it feels inadequate. Sorry!

1

What if I would like to have a table where all the cells in the table should be aligned centered except B2:B11 which should be aligned left. Meaning that the first cell in the B column (which contain a category) also should be centered.

So my question is: How can I get the first cell in a column to have another alignment than the rest of the cells in the same column ?

1

doing two tables and combining in one table like rami did

1

Yes, but how to handle the different width of the first cell in every column and the other cells in the column.

For example see the image below.

1

Maybe one way could be to shift from v to h so that the alignment is controlled by each row instead of each column. But then I don't know how to make the table with a variable number of rows.

1

Arh, I forgot that it isn't possible to get the cells in the range B2:B10 aligned left at the same time.

So the first row has to be created as an object for itself. And somehow combined with the others so that all the cells in each column has the same width.

1

I can't find a way to do it... :(

1

you can try spaces or phantom in 1,2 position for centering the first label onlyand clcc for each column

https://wiki.geogebra.org/e...

1

What is a "phantom" - could you insert the symbol

Sorry, I'm not sure how the script should be for this: "try spaces or phantom in 1,2 position for centering the first label only and clcc for each column." Could you write an example of a script here.

Thank you, for the link. I missed much of it earlier. But it is still very useful.

But sorry, I still can't see how to make a table according to my requirements. On the page they only describes how to make other or more simplified kind of tables. Either multi-column or tables where all cells in a column have the same alignment.

1

What is a "phantom"

más no puedo hacer

1

Thanks.

It's a low practical way to do it, but it works/does the job, so it's okay. :)

1

try in LAtex

\begin{array}{|r|l|c|}

\hline

\multicolumn{1}{|c|}{Titldfdfdfde} \multicolumn{1}{c|}{gggggklkje}{sfsdf}\\

\hline

xjhgjhgjhgnbvnbvnbjhgjh & yjhgjhgjhgjhgjhgjhgjhgjhgjhghjhmnh&jhjhgjhgjhgjhgjhgjhgjhgjhgjhgjhgjhg\\

\hline

amnbnvnbv & bhgjhgjhgj&hg\\

c & cjjgjhgjhgjhgjhgjh&gjhg\\

d & e\\ \hline

\end{array}

https://www.geogebra.org/m/RC7Pnnk5

1

Yes, that is a better way to do it. :)

Than you very much for your time and effort ! :)

And thank you for the link.