Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » Export in Excel and Download a file(RAP and Kepler version)
Export in Excel and Download a file [message #1440415] Wed, 08 October 2014 06:35 Go to next message
Eclipse UserFriend
Hi all,
I have the need to export some data to Excel and I also the need to create a XML file, creating a file on the client pc.

How can I specify the destination folder in the RAP?

The RAP filechooser you can only upload files. Download is not possible as the javadoc says:
/**
   * Load or Save
   * <ul>
   * <li><code>true</code> loads the file from the file system into the application.</li>
   * <li><code>false</code> saves the file from the application to the file system. Attention: This does not work in
   * RAP/Web-UI</li>
   * </ul>
   */


Thanks in advance for any help

[Updated on: Wed, 08 October 2014 06:37] by Moderator

Re: Export in Excel and Download a file [message #1440426 is a reply to message #1440415] Wed, 08 October 2014 06:54 Go to previous messageGo to next message
Eclipse UserFriend
Hi Marco,

what I would do is to create the files on the server and provide a simple link to the user. When the user clicks on the link the download starts.

Alternatively you could try start the download automatically with the following method
org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop.openUrlInBrowser(String)


I think you can use it this way
ClientSyncJob.getCurrentSession().getDesktop().openUrlInBrowser(url);


However I didn't try by myself
Re: Export in Excel and Download a file [message #1440444 is a reply to message #1440426] Wed, 08 October 2014 07:27 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Matthias for this suggestion, it's a point of view that I had not thought.

I try to follow this way, if I need help I post here my questions.
icon3.gif  Re: Export in Excel and Download a file [message #1442004 is a reply to message #1440444] Fri, 10 October 2014 09:31 Go to previous messageGo to next message
Eclipse UserFriend
Hi Matthias,
Now I write the file to the server and return it to the client the server path where to find the file you just created.
I can create two different file: one is a xml file (xxxx.xml) and one is Excel file (xxxx.xlsx)

I visualize the full path in a link button, but now I would like that the user can click directly on this element to open the remote file.

Is this way possible or not? If yes, I can open Excel?

To open the xml file, I can use your suggestion (see below), correct?
Quote:

Alternatively you could try start the download automatically with the following method
org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop.openUrlInBrowser(String)


I think you can use it this way
ClientSyncJob.getCurrentSession().getDesktop().openUrlInBrowser(url);




Thanks in advance for any help and explanation

[Updated on: Fri, 10 October 2014 09:33] by Moderator

Re: Export in Excel and Download a file [message #1442007 is a reply to message #1442004] Fri, 10 October 2014 09:35 Go to previous messageGo to next message
Eclipse UserFriend
Hi marco,

If I understand correctly you have the path of your files available on the client. So when you paste the path into the Browser (e.g. Chrome) the download of the file should start.

Now in Scout when you click on the link button, I think you can do the following:

  public class DownloadButton extends AbstractLinkButton {

    @Override
    protected String getConfiguredLabel() {
      return "Download";
    }
    

    @Override
    protected void execClickAction() throws ProcessingException {
      ClientSyncJob.getCurrentSession().getDesktop().openUrlInBrowser(PATH_OF_THE_FILE_ON_THE_SERVER);
    }
  }


Hope this helps.
Re: Export in Excel and Download a file [message #1442018 is a reply to message #1442007] Fri, 10 October 2014 09:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi Matthias,
perfect ... works fine but the function is a bit different:

ClientSyncJob.getCurrentSession().getDesktop().openBrowserWindow(PATH_OF_THE_FILE_ON_THE_SERVER);
Re: Export in Excel and Download a file [message #1443724 is a reply to message #1442018] Mon, 13 October 2014 02:12 Go to previous message
Eclipse UserFriend
Hi marco,

thanks for the update Smile Glad it works.

Matthias
Previous Topic:Run scout server standalone?
Next Topic:Custom Servlet => use SERVICES.getService(..)
Goto Forum:
  


Current Time: Sun Jul 13 14:59:20 EDT 2025

Powered by FUDForum. Page generated in 0.04841 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top