By the way, this howto works in React Web as well, with some expected and minor updates.
Attach your exporting script under Scripts instead of resources:
And then make sure the page where you want the exports to occur, has access to that script:
And finally, you can set the AdvancedFormat JSON in an "on initialize" event for that page.
And it works!