DaLi Liu created ODFTOOLKIT-338:
-----------------------------------

             Summary: [Simple API]The Value of VariableField always is "" when 
try to get a VariableField instance by 
TextDocument.getVariableFieldByName(String)
                 Key: ODFTOOLKIT-338
                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-338
             Project: ODF Toolkit
          Issue Type: Bug
          Components: simple api
    Affects Versions: 0.7
            Reporter: DaLi Liu
             Fix For: 0.8


The Value of VariableField always is "" when try to get a VariableField 
instance by TextDocument.getVariableFieldByName.
Here is the sample codes to show the error.

try {
                TextDocument sourcedoc = (TextDocument) 
Document.loadDocument(ResourceUtilities.getAbsolutePath("TestMySelectionResultsssss.odt"));
                        VariableField userVariableField = 
sourcedoc.getVariableFieldByName("textt");
                        if (userVariableField.getOdfElement() instanceof 
TextUserFieldDeclElement) {
                                TextUserFieldDeclElement 
textUserFieldDeclElement = (TextUserFieldDeclElement) 
userVariableField.getOdfElement();
                                String fieldname = 
userVariableField.getVariableName();
                                String value = 
textUserFieldDeclElement.getOfficeStringValueAttribute();
                                System.out.println("FieldName:" + fieldname);
                                System.out.println("Fieldvalue:" + value);// 
value always is ""
                        }
                } catch (FileNotFoundException e1) {
                        e1.printStackTrace();
                } catch (Exception e1) {
                        e1.printStackTrace();
                }



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to