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:


and I have used the function FORMAT…

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



You have to use


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


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.


where the ‘@’ formats as text in Excel


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


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


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’;