Hi,
I want to change the value of a collection of textfields. When the
textfield is a User TextField, it works ok, but when it is a DataBase
TextField I cannot obtain the field, even thought the field exists.
How can I obtain a DataBase TextField of a document?
Here is the code that I used:
// get XTextFieldsSupplier
XTextFieldsSupplier xTextFieldsSupplier = (XTextFieldsSupplier)
UnoRuntime.queryInterface(XTextFieldsSupplier.class, component);
// access the TextFieldMasters collections
XNameAccess xNamedFieldMasters = xTextFieldsSupplier.getTextFieldMasters();
for (String fieldName : xNamedFieldMasters.getElementNames()) {
logger.debug("Just to make sure the field exists:" + fieldName);
}
//Iterate over the fields collection that are to be changed
for (TextFieldContent textFieldContent : fieldsToChange) {
String completeFieldName = textFieldContent.getCompleteName();
if (xNamedFieldMasters.hasByName(completeFieldName)) {
Object fieldMaster =
xNamedFieldMasters.getByName(completeFieldName);
XPropertySet xPropertySet = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class,fieldMaster);
xPropertySet.setPropertyValue("Content",
textFieldContent.getValue());
} else {
logger.warn(completeFieldName + " does not exists");
}
}
In the log I have both lines:
Just to make sure the field
exists:com.sun.star.text.FieldMaster.DataBase.sicor74.sicor74.SicorDestinatario
and
com.sun.star.text.FieldMaster.Database.sicor74.sicor74.SicorDestinatario does
not exists
How is it possible?
Thanks in advance,
FabrÃcio Lemos
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]