Fied order

Hi,

Is it ok to DOC file contains field which start with FieldSeparator. I have one such document.
I used following code which shows field which starts with FieldSeparator, also this is can be checked with DocumentExplorer.

public class FieldsTest
{
    public static void main(String args[]) throws Exception
    {
        Document doc = new Document("k:/bugs/ACTIV+CORP+test.doc");
        
        List fields = getFields(doc);
        
        for (Object field: fields)
        {
            System.out.println(field);
        }
    }
    
    private static List getFields(Document doc) throws Exception
    {
        final List fields = new ArrayList();
        
        doc.accept(new DocumentVisitor()
        {
            @Override
            public int visitFieldEnd(FieldEnd fieldEnd) throws Exception
            {
                fields.add(fieldEnd);
                
                return super.visitFieldEnd(fieldEnd);
            }
            
            @Override
            public int visitFieldSeparator(FieldSeparator fieldSeparator)
                    throws Exception
            {
                fields.add(fieldSeparator);
                
                return super.visitFieldSeparator(fieldSeparator);
            }
            
            @Override
            public int visitFieldStart(FieldStart fieldStart) throws Exception
            {
                fields.add(fieldStart);
                
                return super.visitFieldStart(fieldStart);
            }
        });
        return fields;
    }
}

ACTIV+CORP+test.doc is in attachment.

Thanks,
Zeljko

Hi

Thanks for your request. I see in the header PAGE field does not have FieldEnd. This is not ok. Most likely the field was broken by some manipulations with document. You can see this if open this document in MS Word and press Alt+F9 to see field codes.
I think, you should reinsert the broken field.
Best regards.