Generate Excel documents from Seaside (Pharo)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Generate Excel documents from Seaside (Pharo)

Esteban A. Maringolo
I need to download the contents of a html table generated with Seaside as a file (actually the whole contents if the table is paginated).

I wonder if somebody already implemented the feature to generate an Excel file programatically?

I'm using CSV files, but the customer prefers Excel (it can be XLSX).

Any thoughts? Command line converters? (linux)

Regards,

Esteban A. Maringolo

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

drush66

Not what you are asking for, but back in days, it was enough to create html table and poke a bit with content type, and excel would open it upon download, just as if it has been excel format.

On Jan 31, 2014 4:11 PM, "Esteban A. Maringolo" <[hidden email]> wrote:
I need to download the contents of a html table generated with Seaside as a file (actually the whole contents if the table is paginated).

I wonder if somebody already implemented the feature to generate an Excel file programatically?

I'm using CSV files, but the customer prefers Excel (it can be XLSX).

Any thoughts? Command line converters? (linux)

Regards,

Esteban A. Maringolo

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

blake watson
In reply to this post by Esteban A. Maringolo
FWIW, I do this by renaming the CSV to XLS. 

If you open a CSV in Excel it asks you about parsing and blah-blah-blah, which you don't want if you're sending it to execs who can't be bothered with clicking the default buttons a few times.

If you give a CSV an XLS extension, Excel just opens it without complaint using the default parsing.

That's how I've handled it. Beats messing with some conversion program.


On Fri, Jan 31, 2014 at 7:10 AM, Esteban A. Maringolo <[hidden email]> wrote:
I need to download the contents of a html table generated with Seaside as a file (actually the whole contents if the table is paginated).

I wonder if somebody already implemented the feature to generate an Excel file programatically?

I'm using CSV files, but the customer prefers Excel (it can be XLSX).

Any thoughts? Command line converters? (linux)

Regards,

Esteban A. Maringolo

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

Daniel Lyons

blake writes:

> If you give a CSV an XLS extension, Excel just opens it without complaint
> using the default parsing.
>
> That's how I've handled it. Beats messing with some conversion program.

I've done this as well. In my experience, the people who gripe are not
technical enough to notice this. :)

--
Daniel Lyons
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

sebastianconcept@gmail.co
On Jan 31, 2014, at 8:42 PM, Daniel Lyons <[hidden email]> wrote:

I've done this as well. In my experience, the people who gripe are not
technical enough to notice this. :)

+1 we do the same

I know you sometimes want to comply just to please the client’s perception but beside that is there a particular (technical?) reason why a csv isn’t enough for your client?



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

Esteban A. Maringolo
2014-01-31 Sebastian Sastre <[hidden email]>:
> I know you sometimes want to comply just to please the client's perception
> but beside that is there a particular (technical?) reason why a csv isn't
> enough for your client?

There is no particular reason, except formatting.

And I'd rather use "open formats" above anything else. In the context
of a web app, it's not mandatory.

In other cases, the output from your system (a report/spreadsheet)
needs format, and many other things.
Excel is the oldest of the available, though esoteric, EDI files :)

Regards!
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

sebastianconcept@gmail.co

On Jan 31, 2014, at 9:30 PM, Esteban A. Maringolo <[hidden email]> wrote:

There is no particular reason, except formatting.

one thing clients are asking us these days requires something printable, we are thinking in rendering a clean page with what they want and a download as PDF 

I was about to try this one:


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

Daniel Lyons

Sebastian Sastre writes:

> On Jan 31, 2014, at 9:30 PM, Esteban A. Maringolo <[hidden email]> wrote:
>
>> There is no particular reason, except formatting.
>
> one thing clients are asking us these days requires something printable, we are thinking in rendering a clean page with what they want and a download as PDF
>
> I was about to try this one:
> https://code.google.com/p/wkhtmltopdf/

I have had luck recently with generating XML, converting it to XSL FO
and passing it to Apache FOP. The principal advantage is that your
styles are decoupled from the rest of your system. FO is pretty gross
though, and FOP has a lot of gaps, so you have to weigh that against it.

--
Daniel Lyons
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

Tobias Pape
In reply to this post by Esteban A. Maringolo
Hay,


On 31.01.2014, at 16:10, Esteban A. Maringolo <[hidden email]> wrote:

> I need to download the contents of a html table generated with Seaside as a file (actually the whole contents if the table is paginated).
>
> I wonder if somebody already implemented the feature to generate an Excel file programatically?
>
> I'm using CSV files, but the customer prefers Excel (it can be XLSX).
>
> Any thoughts? Command line converters? (linux)
>

I've done an excel 2003 xml-exporter for seaside/magritte.
and since excel can open http/https urls, you can even serve it directly

If y’all are interested, I can dig it out of the pit.

Best
        -Tobias

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

signature.asc (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

Tobias Pape
On 01.02.2014, at 01:19, Tobias Pape <[hidden email]> wrote:

> Hay,
>
>
> On 31.01.2014, at 16:10, Esteban A. Maringolo <[hidden email]> wrote:
>
>> I need to download the contents of a html table generated with Seaside as a file (actually the whole contents if the table is paginated).
>>
>> I wonder if somebody already implemented the feature to generate an Excel file programatically?
>>
>> I'm using CSV files, but the customer prefers Excel (it can be XLSX).
>>
>> Any thoughts? Command line converters? (linux)
>>
>
> I've done an excel 2003 xml-exporter for seaside/magritte.
> and since excel can open http/https urls, you can even serve it directly
>
> If y’all are interested, I can dig it out of the pit.
-- which I just did:

have a look at:
        http://ss3.gemtalksystems.com/ss/Sheet.html

Needs Magritte3 and seaside.

Have fun!

Best
        -Tobias

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

signature.asc (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

R: [Seaside] Generate Excel documents from Seaside (Pharo)

Lorenzo
In reply to this post by Tobias Pape
Hi Tobias,

do you mind digging it for me?

Thank you

Lorenzo

-----Messaggio originale-----
Da: [hidden email]
[mailto:[hidden email]] Per conto di Tobias Pape
Inviato: sabato 1 febbraio 2014 01:19
A: Seaside - general discussion
Oggetto: Re: [Seaside] Generate Excel documents from Seaside (Pharo)

Hay,


On 31.01.2014, at 16:10, Esteban A. Maringolo <[hidden email]> wrote:

> I need to download the contents of a html table generated with Seaside as
a file (actually the whole contents if the table is paginated).
>
> I wonder if somebody already implemented the feature to generate an Excel
file programatically?
>
> I'm using CSV files, but the customer prefers Excel (it can be XLSX).
>
> Any thoughts? Command line converters? (linux)
>

I've done an excel 2003 xml-exporter for seaside/magritte.
and since excel can open http/https urls, you can even serve it directly

If y'all are interested, I can dig it out of the pit.

Best
        -Tobias

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

Johan Brichau-2
In reply to this post by Tobias Pape
Hi there,

Another option is to serve a plain html table from your web app and use Excel webqueries [1] to pull in the data from Excell. You can serve a (static) excel file with the webquery embedded and have it pull in the data rather than trying to generate an excel yourself.

We also had the best results generating spreadsheetML (which is the solution Tobias proposes).

If you serve csv, be aware that excell does not treat this very well on all platforms. We tried all that a couple of years ago and finally found that only a CSV in UTF16 format which uses tabs as separator (not commas) is read by excell on all platforms [2,3]

Also, the trick to just put the extension ‘xls’ to a csv file only works if the mime type was defined on the client computer. It does not work everywhere and can break at any time.

cheers,
Johan


On 31.01.2014, at 16:10, Esteban A. Maringolo <[hidden email]> wrote:

I need to download the contents of a html table generated with Seaside as a file (actually the whole contents if the table is paginated).

I wonder if somebody already implemented the feature to generate an Excel file programatically?

I'm using CSV files, but the customer prefers Excel (it can be XLSX).

Any thoughts? Command line converters? (linux)


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

Olivier Auverlot
In reply to this post by sebastianconcept@gmail.co
Hi Sebastian,

Why don't use Artefact (http://smalltalkhub.com/#!/~RMoD/Artefact) ? 

Olivier ;-)

Le 1 févr. 2014 à 00:41, Sebastian Sastre a écrit :


On Jan 31, 2014, at 9:30 PM, Esteban A. Maringolo <[hidden email]> wrote:

There is no particular reason, except formatting.

one thing clients are asking us these days requires something printable, we are thinking in rendering a clean page with what they want and a download as PDF 

I was about to try this one:

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

Tobias Pape
In reply to this post by Lorenzo
On 01.02.2014, at 08:59, Lorenzo Schiavina <[hidden email]> wrote:

> Hi Tobias,
>
> do you mind digging it for me?
>
> Thank you
>
> Lorenzo


See my followup email :)

Best
        -Tobias


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

signature.asc (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

R: [Seaside] Generate Excel documents from Seaside (Pharo)

Lorenzo
Seen; thanks

Lorenzo


-----Messaggio originale-----
Da: [hidden email]
[mailto:[hidden email]] Per conto di Tobias Pape
Inviato: sabato 1 febbraio 2014 12:16
A: Seaside - general discussion
Oggetto: Re: [Seaside] Generate Excel documents from Seaside (Pharo)

On 01.02.2014, at 08:59, Lorenzo Schiavina <[hidden email]> wrote:

> Hi Tobias,
>
> do you mind digging it for me?
>
> Thank you
>
> Lorenzo


See my followup email :)

Best
        -Tobias


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

vaidasd
In reply to this post by Johan Brichau-2
Create Gnumeric file and ask the converter to convert to excel afterwards.


On Sat, Feb 1, 2014 at 10:30 AM, Johan Brichau <[hidden email]> wrote:
Hi there,

Another option is to serve a plain html table from your web app and use Excel webqueries [1] to pull in the data from Excell. You can serve a (static) excel file with the webquery embedded and have it pull in the data rather than trying to generate an excel yourself.

We also had the best results generating spreadsheetML (which is the solution Tobias proposes).

If you serve csv, be aware that excell does not treat this very well on all platforms. We tried all that a couple of years ago and finally found that only a CSV in UTF16 format which uses tabs as separator (not commas) is read by excell on all platforms [2,3]

Also, the trick to just put the extension ‘xls’ to a csv file only works if the mime type was defined on the client computer. It does not work everywhere and can break at any time.

cheers,
Johan


On <a href="tel:31.01.2014" value="+37031012014" target="_blank">31.01.2014, at 16:10, Esteban A. Maringolo <[hidden email]> wrote:

I need to download the contents of a html table generated with Seaside as a file (actually the whole contents if the table is paginated).

I wonder if somebody already implemented the feature to generate an Excel file programatically?

I'm using CSV files, but the customer prefers Excel (it can be XLSX).

Any thoughts? Command line converters? (linux)


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Generate Excel documents from Seaside (Pharo)

Louis LaBrunda
In reply to this post by sebastianconcept@gmail.co
Hi Guys,

Sorry for being a little off topic.  First a +1 for XLS as CSV.

>one thing clients are asking us these days requires something printable, we are thinking in rendering a clean page with what they want and a download as PDF

>I was about to try this one:
>https://code.google.com/p/wkhtmltopdf/

I have used wkhtmltopdf in the past and was very pleased with it.  Worked
well from both windows (where I develop and test) and Linux.

Lou
-----------------------------------------------------------
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:[hidden email] http://www.Keystone-Software.com

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

Esteban A. Maringolo
Thanks for all your responses.

I'll take a look into Tobias' work. It is the kind of solution I'm
interested in. If I can "untie" it from Magritte, then better. :)

Sending CSV contents disguised as an application/vnd.ms-excel is a
trick that doesn't work always, particularly if the content is not in
the expected encoding (which is not UTF-8, but Windows1252 or
similar).

Best regards,



Esteban A. Maringolo


2014-02-02 Louis LaBrunda <[hidden email]>:

> Hi Guys,
>
> Sorry for being a little off topic.  First a +1 for XLS as CSV.
>
>>one thing clients are asking us these days requires something printable, we are thinking in rendering a clean page with what they want and a download as PDF
>
>>I was about to try this one:
>>https://code.google.com/p/wkhtmltopdf/
>
> I have used wkhtmltopdf in the past and was very pleased with it.  Worked
> well from both windows (where I develop and test) and Linux.
>
> Lou
> -----------------------------------------------------------
> Louis LaBrunda
> Keystone Software Corp.
> SkypeMe callto://PhotonDemon
> mailto:[hidden email] http://www.Keystone-Software.com
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Generate Excel documents from Seaside (Pharo)

Tobias Pape
On 03.02.2014, at 22:23, Esteban A. Maringolo <[hidden email]> wrote:

> Thanks for all your responses.
>
> I'll take a look into Tobias' work. It is the kind of solution I'm
> interested in. If I can "untie" it from Magritte, then better. :)
>

Sure, just don’t load Sheet-magritte :)
(haha, I know. I just now splitted Sheet into 3 packages.
Just load Sheet-Core.)

And then do something like this:

self requestContext respond: [:response |
  response
    doNotCache;
    attachmentWithFileName: 'name.xml';  
    contentType: (WAMimeType main: 'application' sub: 'xml');
    nextPutAll: (
      ((WABuilder on: ShSpreadsheetCanvas)
        rootClass: ShSpreadsheetRoot;
        documentClass: WAXmlDocument;
        yourself)
          fullDocument: true;
          rootBlock: [ :root | " nothing, or what you want... " ];
          render: [ :sheet | "this is a spreadsheet canvas"
            sheet workbook with: [
              sheet documentProperties: [
                sheet
                  author: 'esteban';
                  created: (String streamContents: [:stream | |now|
                    now := DateAndTime now.
                    GRPrinter isoDate print: now on: stream.
                    stream nextPut: $T.
                    GRPrinter isoTime print: now on: stream.
                    stream nextPut: $Z]);
                  version: '12.00'].
              sheet excelWorkbook: [
                (sheet tag: 'WindowHeight') with: '6795'.
                (sheet tag: 'WindowWidth') with: '8460'.
                (sheet tag: 'WindowTopX') with: '120'.
                (sheet tag: 'WindowTopY') with: '15'.
                (sheet tag: 'NoAutorRecover').
                (sheet tag: 'ProtectStructure') with: 'False'.
                (sheet tag: 'ProtectWindows') with: 'False'].
              sheet styles: [ "do whatever style you need here" ].
              sheet worksheet
                name: 'sheet 1';
                with: [
                  sheet table
                    fullColumns: 1;
                    fullRows: 1;  
                    expandedRowCount: 42;
                    expandedColumnCount: 34;  
                    with: [ "example data." | heads |
                        heads := #( 'Title' 'First Name' 'Last Name' 'Email' 'Homepage' 'Phone').
                        heads do: [:header | sheet column caption: header; style: #header].
                        sheet row: [
                          heads do: [:header |
                            sheet cell
                              style: #header;
                              with: [sheet data: [sheet text: header greaseString]]]].
                       #(
                        #( 'Mr.' 'James' 'Bond' '[hidden email]' 'bond.mi5.gov.uk' '0044 12345 007' )
                        #( 'Herr' 'Ernst Stavro' 'Blofeld' '[hidden email]' 'herrbloboese.de' '0049 30 1234567' )
                        #( 'Dr.' 'Julius' 'No' '[hidden email]' nil '0049 30 987654321' )
                        #( nil 'Francisco' 'Scaramanga' '[hidden email]' nil '0039 12 3456 781')
                      ) do: [:dataLine |
                        sheet row: [
                          dataLine do: [:datum |  
                            sheet cell
                              style: #default;
                              with: [
                                datum ifNotNil: [
                                  sheet data
                                    with: [sheet text: datum greaseString]]]]]]]]]]
)]


:D

HTH!

Best
        -Tobias

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

signature.asc (1K) Download Attachment