Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
7 replies Latest Post - ‏2013-05-13T13:36:49Z by leo_gg1852
unalki
unalki
25 Posts
ACCEPTED ANSWER

Pinned topic EGL RUI EXCEL export

‏2010-04-16T07:52:00Z |
Hi all,

How can i export data from egl rui page ? I want to export data from datatable to excel file. How can i do it ?

Thanks,
Updated on 2010-04-19T09:24:05Z at 2010-04-19T09:24:05Z by unalki
  • SystemAdmin
    SystemAdmin
    6195 Posts
    ACCEPTED ANSWER

    Re: EGL RUI EXCEL export

    ‏2010-04-16T19:03:47Z  in response to unalki
    I've had some good success developing a web service to do this. It's a fair amount of work, but you can write a service that accepts an array of records that represent the data in your grid. Depending on how elaborate you want to get, you can turn this into an Excel file using Apache-POI, or just write out a .csv file to some folder in your web server. What you do with it then is up to you, but one thing you could do is pass back a hyperlink that the user could click on to open/save the Excel file.
    • bsvihovec
      bsvihovec
      194 Posts
      ACCEPTED ANSWER

      Re: EGL RUI EXCEL export

      ‏2010-08-22T00:00:36Z  in response to SystemAdmin

      Kendall,
      Can you elaborate on 'writing a .csv file to some folder on your web server'? I was going to propose a similar solution, but I am not sure how you would write a CSV file to a directory that can then be accesed via a link in the RUI application If the Service is deployed as a WAR, is there a temporary directory that you can write to within the same context root? Would this be a different directory based on the session, and would the files be cleaned up when the session ended?
      I was thinking that the RUI application could invoke a Service and pass along the same conditions used to create the Grid on the client. The service could load the data and create an EGLCSVRecord, similar to what is described in the EGL Foundations Presentations: EGL Foundations Presentations. The location of the file could then be sent back to the client to be used in a HyperLink widget.
      Another, much less elegant, solution would be to pop up a dialog in the
      browser with a text string containing the data from the grid as a CSV
      string. This string would have to be generated manually, but it should be easy
      enough to create. The users would then copy this data and paste it
      into their own excel document.
      It may also be possible to forward the grid conditions from the RUI
      application to a JSF application that can load the data and create the
      file using the approach linked above.
      -Brian

      Edited by: markevans on Aug 21, 2010 7:57 PM
      Updated on 2010-08-22T00:00:36Z at 2010-08-22T00:00:36Z by bsvihovec
      • SystemAdmin
        SystemAdmin
        6195 Posts
        ACCEPTED ANSWER

        Re: EGL RUI EXCEL export

        ‏2010-04-16T20:15:09Z  in response to bsvihovec
        Hey Brian,

        What we've done in our application is to add a folder called, say, /excel_reports under WebContent in the web service project. This gets deployed as part of the .war and becomes a folder under the context root of the deployed app. Our service knows the (full) path to that folder and writes the Excel files there. When we construct file filename, we also build a string for the hyperlink. This string might look something like: "http://myServer:8080/myApp/excel_reports/myExcelFile_12345.xls". This is returned to the RUI client where it is displayed using the hyperlink widget, like you said. When the user clicks on the link, they are prompted by the browser to "open or save" the file. We're actually using POI, but I would guess that creating a .csv file could, also as you said, following Jon's PowerPoint technique to write out a .csv file to that folder.

        And, yes, unless you do something about it, the files will stay in that folder on the server. We attempt to delete each one if they user moves off the page, but if they have it open in their browser, that doesn't work, so we have a weekly cleanup routine that empties that folder.
        • unalki
          unalki
          25 Posts
          ACCEPTED ANSWER

          Re: EGL RUI EXCEL export

          ‏2010-04-19T09:24:05Z  in response to SystemAdmin
          hi,
          have you got any sample project or example of this Kendall ?
          Thanks for your suggestion
        • leo_gg1852
          leo_gg1852
          2 Posts
          ACCEPTED ANSWER

          Re: EGL RUI EXCEL export

          ‏2013-05-10T21:21:03Z  in response to SystemAdmin

          Hi,

          The similar finctionaly I had implemented in my project by creating a reusable widget for export to CSV. The problem right now Iam facing is to how to classify the excel sheet being downloaded from the RUI. Any suggestions.

          • Kendall.Coolidge
            Kendall.Coolidge
            80 Posts
            ACCEPTED ANSWER

            Re: EGL RUI EXCEL export

            ‏2013-05-11T11:29:36Z  in response to leo_gg1852

            Can you explain more about what you mean when you say "classify" ?

             

            Kendall

            • leo_gg1852
              leo_gg1852
              2 Posts
              ACCEPTED ANSWER

              Re: EGL RUI EXCEL export

              ‏2013-05-13T13:36:49Z  in response to Kendall.Coolidge

              As part of scabba review there is a finding that an excel file was opened without a data classification label as proof of the

              vulnerability.