Frank Schönheit - Sun Microsystems Germany wrote:
Hi Fernand,
I hope Frank is still there :-)
forcing me to answer your mails this way won't work forever :)
Please do not see it as "forcing" where the hell sould i find the
information who is apparently only in your head ??
But i understood alsoo your point, I will never do it again :-)
I Try to change the column format in a Data Source Browser
I used following code with no suces, the Formatkey off the column
properties is changed but no visual changes
oModel = oDataSourcebrowser.com_sun_star_awt_XTabController_getModel
oMOdel.columns.getbyname("docdat").setpropertyvalue("FormatKey",2) '
2 = DATE
oMOdel.reset
omodel.reload
Try omitting the "columns". What you access here is the *database
column*, not the *grid column*.
That is, oModel is an css.sdb.RowSet, which is a ResultSet, which
provides the XColumnsSupplier interface, giving you access to the single
columns of this result set. Those columns also support a FormatKey
property, but the grid columns are not expected to react on their changes.
On the other hand, "oModel.getByName( <gridcolumnname> )" would give you
the *grid column*. Usually, every grid column is bound to a result set
column (in that it fetches from and stores to this result set column).
Upon creating the grid column and binding it to a result set column, the
FormatKey from the latter is transferred to the former, but there's no
life connection.
So, a
oModel.getByName( <gridcolname >).setPropertyValue( "FormatKey", 2 )
for the completness: your omodel is
oModel = oDataSourcebrowser.com_sun_star_awt_XTabController_getModel
oGridModel = omodel.getbyindex(0)
and for who wanted to force the format to the "local" version :
oSupp = oGridModel.getbyName(mydatecolumni).FormatsSupplier
Dim aLocale as new com.sun.star.lang.Locale, oCell1 as Object, _
aLocale.Language = "ne"
aLocale.Country = "BE"
sFormat = "DD/MM/YY" ' or wathever other version of the date
formats;......
vFormatKey = oSupp.getNumberFormats().queryKey (sFormat, aLocale,
TRUE)
vFormatkey = oSupp.getNumberFormats().addNew ( sFormat, aLocale )
oGridMOdel.getbyName(mydatecolumn).setpropertyvalue("FormatKey",vFormatkey)
next i
thanks
Fernand
should do.
Ciao
Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]