com.sun.star.util.XReplaceDescriptor xReplaceDescriptor = null; com.sun.star.util.XSearchDescriptor xSearchDescriptor = null; com.sun.star.util.XReplaceable xReplaceable = null; xReplaceable = (com.sun.star.util.XReplaceable) com.sun.star.uno.UnoRuntime. queryInterface( com.sun.star.util.XReplaceable.class, officeWriter1.getTextDocument()); xReplaceDescriptor = (com.sun.star.util.XReplaceDescriptor) xReplaceable.createReplaceDescriptor(); xReplaceDescriptor.setSearchString("Word"); xReplaceDescriptor.setReplaceString("Writer"); xReplaceable.replaceAll(xReplaceDescriptor);