Hello,
we use the wincom-Frontend-Functions to Format the Excel-Table after filing the cells.
therefore we use an Array to set the Column-Format, I think a Date-Format must be able to.
define gl_zellenformat record # bestimmt das Spaltenformat für
s01 string, # die Entsprechende Excel-Zeile
s02 string, # @=Textformat
s03 string, # #.##0,00 tausenderpunkte mit 2 NK
s04 string, #################### ganze Zahl ohne Nachkommastellen
s05 string,
s06 string,
....
then with the Wincom-Frontcall I set the Format for each Column
#Formate für die Spalten
if gl_zellenformat.s01 is not null then
let lo_format = gl_zellenformat.s01
let lo_zelle = "A:A"
let lo_anweisung = "Range(\"", lo_zelle clipped, "\").Select"
call ui.interface.frontcall("WinCOM", "CallMethod", [gl_xlapp, lo_anweisung clipped], [lo_fehler])
call ui.Interface.frontCall("WinCOM", "SetProperty", [gl_xlapp, "Selection.NumberFormat",
lo_format],[lo_fehler])
end if
a second way is to set the format for each cell (it is a little bit slow)
therefore I have several Functions, to format the cell.
f.e.:
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
function zellen_schriftgroesse(lo_zelle, lo_groesse)
define lo_zelle string,
lo_farbe string,
lo_groesse string,
lo_err string,
lo_anweisung string
let lo_anweisung = "Range(\"", lo_zelle clipped, "\").Select"
call ui.interface.frontcall("WinCOM", "CallMethod", [gl_xlapp, lo_anweisung], [lo_err])
call ui.Interface.frontCall("WinCOM", "SetProperty", [gl_xlapp, "Selection.Font.Size", lo_groesse],[lo_err])
call CheckError(lo_err, __LINE__)
end function
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
function zellen_ausrichtung(lo_zelle, lo_grad)
define lo_zelle string,
lo_farbe string,
lo_grad string,
lo_err string,
lo_anweisung string
let lo_anweisung = "Range(\"", lo_zelle clipped, "\").Select"
call ui.interface.frontcall("WinCOM", "CallMethod", [gl_xlapp, lo_anweisung], [lo_err])
call ui.Interface.frontCall("WinCOM", "SetProperty", [gl_xlapp, "Selection.Orientation", lo_grad],[lo_err])
call CheckError(lo_err, __LINE__)
end function
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
function zellen_zahlenformat(lo_zelle, lo_format)
define lo_zelle string, # @=Textformat
lo_farbe string, # #.##0,00
lo_format string, # ######## ganze Zahl ohne Nachkommastellen
lo_err string, # 00000 fünfstellig mit führenden nullen
lo_anweisung string
let lo_anweisung = "Range(\"", lo_zelle clipped, "\").Select"
call ui.interface.frontcall("WinCOM", "CallMethod", [gl_xlapp, lo_anweisung], [lo_err])
call ui.Interface.frontCall("WinCOM", "SetProperty", [gl_xlapp, "Selection.NumberFormat", lo_format],[lo_err])
call CheckError(lo_err, __LINE__)
end function