document.getRange taking time

Hi,
I am using the following code to lock ref type fields in the document:

    for (com.aspose.words.Field field : document.getRange().getFields()) {
      if (field.getType() == FieldType.FIELD_REF) {
        field.isLocked(true);
      }
    }
  document.updateFields();
  document.updatePageLayout();

But this is taking 30+ seconds for a big document, is there any other efficient way to achieve this?

This topic has been moved to the related forum: document.getRange taking time - Free Support Forum - aspose.com