Worked just fine.
Thank you, Stephan.
But, in my application, I need to hide a textfield that has a given
name. How would be the code for that?
On 8/29/05, Stephan Wunderlich - Sun Germany - ham02 - Hamburg
<[EMAIL PROTECTED]> wrote:
> Hi Fabricio,
>
> > How can I hide a document text field using the API (without macros)?
> > Here“s the code that I use for accessing the textfield:
> >
> > XTextFieldsSupplier xTextFieldsSupplier = (XTextFieldsSupplier)
> > UnoRuntime.queryInterface(
> > XTextFieldsSupplier.class, component);
> >
> > XNameAccess xNamedFieldMasters = xTextFieldsSupplier.getTextFieldMasters();
> >
> > XEnumerationAccess xEnumeratedFields = xTextFieldsSupplier.getTextFields();
> >
> > String completeName = "com.sun.star.text.FieldMaster.User." + textFieldName;
> >
> > Object fieldMaster = xNamedFieldMasters.getByName(completeName);
>
> the TextFields has a property called "IsVisible" ... setting this to
> false will hide your User-TextFields.
>
> Somethings like
>
> XPropertySet FieldProperties = (XPropertySet)
> UnoRuntime.queryInterface(XPropertySet.class,
> xEnumeratedFields.nextElement())
>
> FieldProperties.setPropertyValue("IsVisible",Boolean.FALSE)
>
> should hide the first textfield in your enumeration ... that is if it is
> a User-Field ;-)
>
> Hope that helps
>
> Regards
>
> Stephan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]