user defined TextField remove com.sun.star.text.XTextFieldsSupplier com.sun.star.text.FieldMaster.User Rodrigo Nunes Tom Schindl How can I remove a user defined textfield so that it does show up in the list of fields anymore?

Given that the text field was created this way:

XDependentTextField myField = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, xTextDocumentFactory.createInstance("com.sun.star.text.TextField.User")); XPropertySet xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xTextDocumentFactory.createInstance("com.sun.star.text.FieldMaster.User")); xPropertySet.setPropertyValue("Name", "myField"); xPropertySet.setPropertyValue("Value", new Integer(1)); myField.attachTextFieldMaster(xPropertySet);
XTextFieldsSupplier xTFS = (XTextFieldsSupplier) UnoRuntime.queryInterface(XTextFieldsSupplier.class, yourTextDocument); if (xTFS != null) { XNameAccess xEA = xTFS.getTextFieldMasters(); if (xEA.hasByName(yourFieldName)) { try { Object xTFL = xEA.getByName(yourFieldName); XComponent xC = (XComponent)UnoRuntime.queryInterface(XComponent.class, xTFL); xC.dispose(); } catch (java.lang.Exception ex) { ex.printStackTrace(); } } } Modified to match codesnippet.dtd v2.0 Initial version