Excel对象的语法。 更改数字格式

我做了一个从SQL Select中提取logging到Excel的应用程序。
我想在保存之前更改excel列的数字格式。 我创build了EXCEL OLE对象,然后将数据写入它

Excel_Sheet.Cells[i + j,k] = s_col 

我想根据列types更改数字格式。 我已经知道如何获得列types,但没有运气改变数字格式。

我用这些:使标题粗体和改变宽度取决于数据使用AutoFit ..所有我在互联网上find:

 Excel_Sheet.Range(s_into_row + String(j) + ":" +s_into_col + String(j)).Select Excel_Obj.Selection.Font.Bold = True Excel_Sheet.Range("A"+String(j)+":A"+String(j)).Select Excel_Sheet.Columns(s_into_row + ":" + s_into_col ).EntireColumn.AutoFit 

我正在使用powerbuilder

Sid,我没有和Powerbuilder一起工作,但是你尝试过类似的东西

Excel_Sheet.Columns(s_into_row).NumberFormat = "0.00"

HTH

希德

我在一个和这个类似的项目中有一些代码:

 choose case lower(ls_coltype) case "char" lole_Excel.Selection.NumberFormat = "@" case "date" lole_Excel.Selection.NumberFormat = "mm/dd/yyyy" case "int", "long", "ulong" lole_Excel.Selection.NumberFormat = "0" case "time" lole_Excel.Selection.NumberFormat = "h:mm AM/PM" ... end choose 

其中ls_coltype是具有“(”和删除后的所有内容的列types。