Download dynamic file with GWT

前端 未结 3 1108
孤独总比滥情好
孤独总比滥情好 2021-02-14 22:45

I have a GWT page where user enter data (start date, end date, etc.), then this data goes to the server via RPC call. On the server I want to generate Excel report with POI and

3条回答
  •  执念已碎
    2021-02-14 23:17

    You can do that just using GWT RPC and Data URIs:

    1. In your example, make your myMethod return the file content.
    2. On the client side, format a Data URI with the file content received.
    3. Use Window.open to open a file save dialog passing the formatted DataURI.

    Take a look at this reference, to understand the Data URI usage:

    Export to csv in jQuery

提交回复
热议问题