The Document Definition shows one fields' order on the Project Setup Station or when the batch is exported while the order retrieved using IPage::IBlock::IFields is different.
Document Definitions' fields are assigned a unique ID when created. The ID increments when new fields are added.
The user can change the order to organize his output layout better during export however the IBlock::IFields gives the collection sorted by the ID.
That's why if you create the fields and change their order on the Project Setup Station (1 to 3 below is the creation order: intellectual was added first):
The order retrieved via IBlock::IFields will remain unchanged:
However, the output will follow the changed structure:
Currently - FC 12 SDK R1 U6 - no functionality exists to change the order obtained via API.
A possible workaround may be the following:
- Export the document to a CSV file containing the order of the Document Structure;
- Open this file using filesystem APIs;
- Parse the file and show the output to the user.