Format of a text variable- Output to Excel

Hi all,

I have a report which has a print to Excel functionality. I have a column which is of type text but the text is too long and it is not displaying well.

The output is as such:



35686E+14

and I have used the function FORMAT…

Please help if there are some built-in functions to display the text correctly.

Thanks

Liizz

You have to use

xlWorkSheet.Range(‘A:Z’).Columns.AutoFit;

at the end,before

xlApp.Visible := TRUE;

Only the columns have been fixed according to the text size but still the value of the column is showing

3.53496E+14

try, export it as

‘’’ + FORMAT(your value); (3 single quotes…)

Hi Liizz,

How are you exporting to Excel?

If using Excel Buffer then the last argument is the format type e.g.

ExcelBuf.AddColumn(format(MyValue),FALSE,’’,FALSE,FALSE,FALSE,’@’);

where the ‘@’ formats as text in Excel

Hi.

Am not using Excel Buffer.

I am using this instead.

xlWorksheet.Range(‘A’+ FORMAT(intRowNo)).Value :=FORMAT(myvalue);

I have also placed this near ‘’’ + 'FORMAT(myvalue) but it is not working.

Please help

Liizz

Did you try with
‘’’ + FORMAT(myvalue)

Try

xlWorksheet.Range(‘A’+ FORMAT(intRowNo)).Value := myvalue;

xlWorksheet.Range(‘A’+ FORMAT(intRowNo)).NumberFormat := “#,##0.00”;

You can play around wih “#,##.00” and try “##0” or “#,##0

xlWorkSheet.Range(‘A’ + FORMAT(ColNo)).NumberFormat:=’#.##0,0’;