Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 10:35 Go to next message
marco giudici is currently offline marco giudiciFriend
Messages: 204
Registered: February 2013
Location: Italy
Senior Member
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 10:37]

Report message to a moderator

Re: Export in Excel and Download a file [message #1440426 is a reply to message #1440415] Wed, 08 October 2014 10:54 Go to previous messageGo to next message
Matthias Nick is currently offline Matthias NickFriend
Messages: 197
Registered: August 2013
Senior Member
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 11:27 Go to previous messageGo to next message
marco giudici is currently offline marco giudiciFriend
Messages: 204
Registered: February 2013
Location: Italy
Senior Member
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 13:31 Go to previous messageGo to next message
marco giudici is currently offline marco giudiciFriend
Messages: 204
Registered: February 2013
Location: Italy
Senior Member
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 13:33]

Report message to a moderator

Re: Export in Excel and Download a file [message #1442007 is a reply to message #1442004] Fri, 10 October 2014 13:35 Go to previous messageGo to next message
Matthias Nick is currently offline Matthias NickFriend
Messages: 197
Registered: August 2013
Senior Member
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 13:59 Go to previous messageGo to next message
marco giudici is currently offline marco giudiciFriend
Messages: 204
Registered: February 2013
Location: Italy
Senior Member
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 06:12 Go to previous message
Matthias Nick is currently offline Matthias NickFriend
Messages: 197
Registered: August 2013
Senior Member
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: Thu Apr 18 05:19:31 GMT 2024

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

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

Back to the top