TinyButStrong - the PHP Template Engine
Categories > OpenTBS with XLSX >

Set xlsx cell to text format

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Max
Date: 2016-12-05
Time: 15:28

Set xlsx cell to text format

Hello

I try to export some data into a xlsx file.
One column must be "Text" format. Numbers can be in it (216346, 12.2143.1354., 321SEDFDDD21) but the cell should be "text" formated.
I didn't find any way to change from format "Standard" to "Text".

Any hint ?

Thanks in advance
By: Skrol29
Date: 2016-12-06
Time: 15:13

Re: Set xlsx cell to text format

In Ms Excel, go to the Format of the cell (from the contextual menu), and in the Number tab, choose « Text ».
By: Max
Date: 2016-12-19
Time: 14:13

Re: Set xlsx cell to text format

If i do that on the "template" file, for the whole column or for cells only, it loses the format and comes back to "standard".
I can't do it after generating the file, it has to be sent elsewhere to be automatically treated (and has to have this column at text format).
By: Skrol29
Date: 2016-12-21
Time: 23:39

Re: Set xlsx cell to text format

I cannot reproduce your problem.

If I set the cell format to Standard or to Text, then the values you given are merged as visually as text, and the format of their cells stay unchanged (Standard or Text).
With both formats, the first value (216346) is display as is but with an automatic green comment « number saved as text ».

If you still have the problem, can you send your template to me ?
By: Max
Date: 2016-12-29
Time: 15:33

Re: Set xlsx cell to text format

I still have the problem and the file is a bit confidential...
Could we do the contrary and you send me a template file well formatted so i can see what i do wrong ?
Because, as i told you, i put a row with values such as [b.total_hours;ope=tbs:num], and it's ok for numbers. But if i want a number to be considered as text, i didn't find any ope:tbs=text, and the formatting i defined for the cell turns back to "standard" for every row created.
By: Max
Date: 2017-01-13
Time: 11:49

Re: Set xlsx cell to text format

I figured out the problem.
If a cell is styled, the format has to be defined in the cell.