Home › Forums › General XMetaL Discussion › slow range.select() for large Document › Reply To: slow range.select() for large Document
Reply to: slow range.select() for large Document
May 29, 2009 at 12:57 amRange objects are normally hidden and do not cause the document to be updated when moving them around, however, as soon as you make a modification to the document the formatter (the code that draws the document on the screen) runs to update what the user is viewing.
Range.Select() also forces the formatter to run because the selection is made visible.
Depending on what you are doing you may wish to try turning off formatting entirely until whatever your script is doing has completed. This is done using the API ActiveDocument.FormattingUpdating=boolean
Be careful with this API because if you leave it set to false XMetaL will continue to not update what the user sees on screen and they will see odd behaviour when they begin typing or interacting with the document. So, make sure you catch any exceptions and test your code well.