Forcing text to be known as string

I cannot find support in your product to force a text to be recognized as a string. This is for .NumberFormat="@". Where can I set that using your tool? This is not available as is in the TFlxFormat class.



I have some strings starting with 0, or a digit, such as 9-3, and this is interpreted as a date. I need to force the format from your library up to Excel so it would recognize it as .NumberFormat="@" or the type Text. I tried .Format="Text" but this is no good.



For now, I am forcing CHR(0)+lcString to fake it. But, this creates a small indent which I would like to avoid.

Hi,
Is this using reports or the API?

if you are using the API, just call SetCellValue with a string:
xls.SetCellValue(1,1,”1”); will enter the string “1” into cell A1.
xls.SetCellValue(1,1,1) will enter the number 1 into cell A1.

You might be confused by “SetCellFromString”, which is a method that explicitly does what you are sayin: if you enter the string “1” it will convert it to a number. But SetCellFromString is for particular cases, you should normally use SetCellValue, and pass a variable/constant of the appropriate type as cell value.

If you are using reports, make sure that the database fields or properties used in the reports are strings, and they will be strings too in the final report.

Hi



Thanks



You are right. I needed to add a condition to use that method instead of the other one when initializing a content which should be known as a string:



               ' If this is a character

               If loField.Type = "C" Or loField.Type = "M" Or loField.Type = "O" Or _

                 loField.Type = "V" Or loField.Type = "X" Or loField.Type = "Y" Then



                    ' Initialize the value in the cell

                    loXlsFile.SetCellValue(lnCounter + 2, lnColumn, lcValue)



               Else



                    ' Initialize the value in the cell

                    loXlsFile.SetCellFromString(lnCounter + 2, lnColumn, lcValue)



               End If