Apache OpenOffice (AOO) Bugzilla – Issue 11969
How to get text fields from the API
Last modified: 2013-02-24 21:06:59 UTC
zip file: DevelopersGuideSamples.zip source file: TextDocuments.java method: templateExample() line numbers: 187 and 188 code segments: 161 Hashtable recipient = new Hashtable(); 162 recipient.put("Company", "Manatee Books"); 163 recipient.put("Contact", "Rod Martin"); ... 182 // access the TextFields and the TextFieldMasters collections 183 XNameAccess xNamedFieldMasters = xTextFieldsSupplier.getTextFieldMasters(); 184 XEnumerationAccess xEnumeratedFields = xTextFieldsSupplier.getTextFields(); 185 186 // iterate over hashtable and insert values into field masters 187 java.util.Enumeration keys = recipient.keys(); 188 while(keys.hasMoreElements()) { 189 // get column name 190 String key = (String)keys.nextElement(); 191 192 // access corresponding field master 193 Object fieldMaster = xNamedFieldMasters.getByName( 194 "com.sun.star.text.FieldMaster.User." + key); Issue: The text fields are hard coded (lines 161-163). It's my understanding that the text fields are part of the document and can be obtained by the API. Unfortunately the example (lines 182 - 194) doesn't show how this can be done since it uses the hard coded values. The question is, how can the text fields be obtained from the API. (The text fields can then be used to access the database and obtain the value that is to replace the text fields.) Please show how this is done in the example.
I think this issue was assigned to me as a mistake. I reassign it to jcs@openoffice.org
If in doubt, "Reassign issue to owner of selected subcomponent". In this case you may have meant jsc.
please add this to your chapter of the dev guide
Target changed
.
TL: changed type to TASK in order to distinguish it from features and 'regular' bugs.
Now being the time tu update the developers guide for the next release, looking at your sample I'm not completely sure what the problem you like to have covered. From the description following "Issue:" it looks like you're looking for a way to access a list of all text fields of a document in order to look for a specific one. But the example already uses the text field enumeration in line 184ff. Please state what exactly you're missing and/or what you like to do. After this please reassign this issue back to me. Thanks!
Hi, would you please provide some more info about how we can help you? Btw, I think the mailing list dev@api.openoffice.org would be a good resource for questions about API usage. Thanks, Stefan
This Issue requires more information ('needmoreinfo'), but has not been updated within the last year. Please provide feedback as requested and re-test with one of the latest versions of OOo - otherwise the issue may be Resolved as Invalid in the future. Regards Andrew Cleaning-up and Closing old Issues as part of: ~ The Grand Bug Squash, pre v3 ~