https://bugs.freedesktop.org/show_bug.cgi?id=42073
--- Comment #4 from John Manko <john.ma...@gmail.com> 2012-01-18 13:07:02 PST --- I tried your code (and mine), and it does work (sort of). When running the code (with the document visible), the input fields do not show the newly set text. ie, they are collapsed. In order to view the text, I have to enable "Field Names" from the View menu, then disable them again. Only after doing that does the text show. More so, if I export the document to a file (through code) prior to the enable/disable workaround, the data in the fields does not get saved. Only after performing the enable/disable function does the export include the field data. Obviously is wrong/bad, because I can't sit here for automated system. The latest test is running LO 3.4.4 on Ubuntu Linux 11.10, but the same thing occurs on my Windows installation. @Test public void test_fdo42073() throws Exception { initializeOpenOffice(); PropertyValue[] loadProps = createPropertyValueArray( createPropertyValue("AsTemplate", new Any(Type.BOOLEAN, Boolean.TRUE)), createPropertyValue("Hidden", new Any(Type.BOOLEAN, Boolean.FALSE))); XComponent component = componentImport("/home/jmanko/VirtualBox VMs/PCID_042_LO_3.4.3/shared/templates/0198.OTT", loadProps); XTextDocument document = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, component); XMultiServiceFactory xDocFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document); Object xField = xDocFactory.createInstance("com.sun.star.text.TextField.Input"); XText xBodyText = document.getText(); XTextCursor xCursor = xBodyText.createTextCursor(); XTextContent xContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xField); xBodyText.insertTextContent(xCursor, xContent, true); XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xField); String content = "this is not surprising"; xPropSet.setPropertyValue("Content", content); XTextFieldsSupplier supplier = (XTextFieldsSupplier) UnoRuntime.queryInterface(XTextFieldsSupplier.class, document); XEnumerationAccess enumAccess = supplier.getTextFields(); XEnumeration xEnum = enumAccess.createEnumeration(); Map textFields = new HashMap(); while (xEnum.hasMoreElements()) { Object o = xEnum.nextElement(); XTextField text = (XTextField) UnoRuntime.queryInterface(XTextField.class, o); XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, text); XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, text); if (xServiceInfo.supportsService("com.sun.star.text.TextField.Input")) { textFields.put(((String) xPropertySet.getPropertyValue("Hint")), text); } } Object o = textFields.get("POLICY_NO"); XTextField text = text = (XTextField) UnoRuntime.queryInterface(XTextField.class, o); XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, text); xPropertySet.setPropertyValue("Content", "123456789"); PropertyValue[] saveProps = createPropertyValueArray( createPropertyValue("FilterName", new Any(Type.STRING, DocumentType.WRITER_OPENDOCUMENT_TEXT)), createPropertyValue("CompressionMode", new Any(Type.STRING, "1")), createPropertyValue("Pages", new Any(Type.STRING, "All")), createPropertyValue("Overwrite", new Any(Type.BOOLEAN, Boolean.TRUE))); /** BREAKPOINT PRIOR TO SAVING TO VIEW THE DOCUMENT. **/ componentExport(component, saveProps, "/home/jmanko/VirtualBox VMs/PCID_042_LO_3.4.3/shared/templates/0198_AFTER.ODT"); closeComponent(component); } -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. _______________________________________________ Libreoffice-bugs mailing list Libreoffice-bugs@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs