Cancel export in FileFormat plugin?

Is it possible to have a “Cancel” button in a Python FileFormat plugin? If so, how to implement it?

You mean to cancel an export operation.
That is tricky. To be able to interact with the UI, you need to show a modal dialog and run your export operation on a background thread. On that dialog you put a cancel button. When pressed, it sets a flag that you need to check from the background thread and stop the operation.