Tabular: XLSX import

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

Re: Tabular: XLSX import

Hannes Hirzel
P.S. Code in
http://ss3.gemtalksystems.com/ss/Tabular/Tabular-HannesHirzel.59.mcz

On 8/14/15, H. Hirzel <[hidden email]> wrote:

> I am now looking for the place in the SAX parser where the cell
> content is assigned.
>
>
> Test script (debug it)
>
> |wbk wsheet  wimported cell fname4|
>      fname4 := 'TabularConstructed4Exported.xlsx'.
> wbk := TabularWorkbook new.
> self assert:  (wbk worksheets isEmpty).
>
> wsheet := TabularWorksheet new.
> wsheet
> at: 1 @ 1 putData: 'abc 11';
> at: 2 @ 1 putData: 'def 21';
> at: 3 @ 1 putData: 'ghi 31'.
> wbk worksheets add: wsheet.
> TabularXSLXExport workbook: wbk fileName: fname4.
>
> wimported := XLSXImporter import: (FileLocator home / fname4 ) .
> cell := ((wimported worksheetNamed: 'Sheet1') at: 1@1).
>
> Put a halt into
> TabularWorksheet>>at:putCell:
>
> to come near the place. The cell attributes are there (inline string
> in this case)
>
> But I did not find the exact place where the cell content  'abc 11' is
> assigned.
>
> Any help?
>
> --Hannes
>
> On 8/14/15, H. Hirzel <[hidden email]> wrote:
>> On 8/2/15, Ben Coman <[hidden email]> wrote:
>>> Cool.  I might have a use for this soon.
>>> cheers -ben
>>
>> Hello Ben
>>
>> The standard to implement is huge. We are dealing with a subset.
>>
>> Example test documents I consider using are here
>>
>> http://www.openoffice.org/sc/testdocs/index.html
>>
>> (all which are labeled 'XML')
>>
>> What we have so far in the tabular package is quite usable, depending
>> on the project.
>>
>> My interest for next steps are
>>
>> a. get round trip :
>>       1. create tabular model
>>       2. export workbook
>>       3. import workbook
>>     working fine.
>>     (the issue is inline string parsing currently but I will soon be
>> there)
>>
>> b. cell styles
>>
>> c. multiple worksheets on export (currently limited to one with a fix
>> name; import
>>    can deal with several worksheets in a workbook)
>>
>> -- Hannes
>>
>>
>>
>>
>>> On Sun, Aug 2, 2015 at 2:58 AM, Юрий Мироненко <[hidden email]>
>>> wrote:
>>>> Hello.
>>>> Some time ago I announced Tabular, some effort to make a tool for
>>>> spreadsheets import/export.
>>>>
>>>> This is short notice: Vincent Blondeau have added XLSX import
>>>> functionality!
>>>> It's also mostly proof-of-concept now, but even at this stage it's
>>>> quite
>>>> usable.
>>>>
>>>> Thanks, Vincent!
>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Tabular: XLSX import

Hannes Hirzel
Problem solved so far

http://ss3.gemtalksystems.com/ss/Tabular/Tabular-HannesHirzel.63.mcz

Now found out how to parse inline strings with the SAX parser

I had to include

       t

in
    registeredElements
        ^ #(row c v t)


and add a method

   t_characters: aString
        self cell data: aString.


This parses XML code snippets like this

<row r="1" spans="1:1">
<c r="A1" t="inlineStr">
<is><t>This is inline string example</t></is>
</c>
</row>

Just hope that t is always a string and not dependent on being
surrounded by <is>....</is>.


Now two tests more work. But I have to do more to get the data types
of the cell correct  (number, strings).  In the round trip parsing
numbers are given back as strings. This seems to be unrelated to the
string parsing. I'll have to check.



On 8/14/15, H. Hirzel <[hidden email]> wrote:

> P.S. Code in
> http://ss3.gemtalksystems.com/ss/Tabular/Tabular-HannesHirzel.59.mcz
>
> On 8/14/15, H. Hirzel <[hidden email]> wrote:
>> I am now looking for the place in the SAX parser where the cell
>> content is assigned.
>>
>>
>> Test script (debug it)
>>
>> |wbk wsheet  wimported cell fname4|
>>      fname4 := 'TabularConstructed4Exported.xlsx'.
>> wbk := TabularWorkbook new.
>> self assert:  (wbk worksheets isEmpty).
>>
>> wsheet := TabularWorksheet new.
>> wsheet
>> at: 1 @ 1 putData: 'abc 11';
>> at: 2 @ 1 putData: 'def 21';
>> at: 3 @ 1 putData: 'ghi 31'.
>> wbk worksheets add: wsheet.
>> TabularXSLXExport workbook: wbk fileName: fname4.
>>
>> wimported := XLSXImporter import: (FileLocator home / fname4 ) .
>> cell := ((wimported worksheetNamed: 'Sheet1') at: 1@1).
>>
>> Put a halt into
>> TabularWorksheet>>at:putCell:
>>
>> to come near the place. The cell attributes are there (inline string
>> in this case)
>>
>> But I did not find the exact place where the cell content  'abc 11' is
>> assigned.
>>
>> Any help?
>>
>> --Hannes
>>
>> On 8/14/15, H. Hirzel <[hidden email]> wrote:
>>> On 8/2/15, Ben Coman <[hidden email]> wrote:
>>>> Cool.  I might have a use for this soon.
>>>> cheers -ben
>>>
>>> Hello Ben
>>>
>>> The standard to implement is huge. We are dealing with a subset.
>>>
>>> Example test documents I consider using are here
>>>
>>> http://www.openoffice.org/sc/testdocs/index.html
>>>
>>> (all which are labeled 'XML')
>>>
>>> What we have so far in the tabular package is quite usable, depending
>>> on the project.
>>>
>>> My interest for next steps are
>>>
>>> a. get round trip :
>>>       1. create tabular model
>>>       2. export workbook
>>>       3. import workbook
>>>     working fine.
>>>     (the issue is inline string parsing currently but I will soon be
>>> there)
>>>
>>> b. cell styles
>>>
>>> c. multiple worksheets on export (currently limited to one with a fix
>>> name; import
>>>    can deal with several worksheets in a workbook)
>>>
>>> -- Hannes
>>>
>>>
>>>
>>>
>>>> On Sun, Aug 2, 2015 at 2:58 AM, Юрий Мироненко <[hidden email]>
>>>> wrote:
>>>>> Hello.
>>>>> Some time ago I announced Tabular, some effort to make a tool for
>>>>> spreadsheets import/export.
>>>>>
>>>>> This is short notice: Vincent Blondeau have added XLSX import
>>>>> functionality!
>>>>> It's also mostly proof-of-concept now, but even at this stage it's
>>>>> quite
>>>>> usable.
>>>>>
>>>>> Thanks, Vincent!
>>>>
>>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Tabular: XLSX import

Stephan Eggermont-3
In reply to this post by Yuriy Mironenko
On 01/08/15 20:58, Юрий Мироненко wrote:
> Hello.
> Some time ago I announced Tabular
> <http://ss3.gemtalksystems.com/ss/Tabular.html>, some effort to make a
> tool for spreadsheets import/export.
>
> This is short notice: Vincent Blondeau have added XLSX import functionality!
> It's also mostly proof-of-concept now, but even at this stage it's quite
> usable.

You might be interested in this work by a.o. @Felienne:
https://github.com/PerfectXL/XLParser

Stephan



Reply | Threaded
Open this post in threaded view
|

Re: Tabular: XLSX import

Hannes Hirzel
Thank you for the pointer about parsing formulas
https://github.com/PerfectXL/XLParser

Current status is that simple DOCX export now works

https://ci.inria.fr/pharo-contribution/job/Tabular/
http://ss3.gemtalksystems.com/ss/Tabular.html
http://ss3.gemtalksystems.com/ss/Tabular/Tabular-HannesHirzel.82.mcz

Feedback welcome.
Next thing I will be working on is DOCX import of several simple tables.

--Hannes


On 8/17/15, Stephan Eggermont <[hidden email]> wrote:

> On 01/08/15 20:58, Юрий Мироненко wrote:
>> Hello.
>> Some time ago I announced Tabular
>> <http://ss3.gemtalksystems.com/ss/Tabular.html>, some effort to make a
>> tool for spreadsheets import/export.
>>
>> This is short notice: Vincent Blondeau have added XLSX import
>> functionality!
>> It's also mostly proof-of-concept now, but even at this stage it's quite
>> usable.
>
> You might be interested in this work by a.o. @Felienne:
> https://github.com/PerfectXL/XLParser
>
> Stephan
>
>
>
>

123