Document Actions
02/24/2006
Enhancing OOo Calc CSV files recognition
CSV files are widely used for data import/export with spreadsheets

Openoffice.org Calc can obviously handle them but restrict the handling of CSV-like files to only some extenstions (csv, txt, tab). The default behaviour is to open unknown files in Writer as plain text ones.

Some months ago i gave the method for handling .dat files by default in OOo 1.1.x as CSV file [fr], so that they open directly in Calc.

Here is the update for OOo 2.x : the sipirit remains the same, the details slightly changed

Making the changes persistent


The filters definition in OOo 2.x are stored in /opt/openoffice.org2.0/share/registry/modules/org/openoffice/TypeDetection/Types
An xcu file is an xml file used by OOo for its configuration

In this directory, you'll find a lot of file dealing with OOo filters definition
The one concerned bu our CSV defibnition is fcfg_calc_types.xcu

Searching for csv string inside it, we will find this structure
    <node oor:name="calc_Text_txt_csv_StarCalc" oor:op="replace" >
<prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop>
<prop oor:name="URLPattern"/>
<prop oor:name="Extensions"><value>csv txt tab</value></prop>
<prop oor:name="MediaType"><value>text/plain</value></prop>
<prop oor:name="Preferred"><value>false</value></prop>
<prop oor:name="PreferredFilter"><value>Text - txt - csv (StarCalc)</value></prop>
<prop oor:name="UIName">
<value>Text - txt - csv (StarOffice Calc)</value>
</prop>
<prop oor:name="ClipboardFormat"/>
</node>

One can the notice that inside this calc_Text_txt_csv_StarCalc node, we find an Extensions property listing all the extension actually handled for csv files

So, the solution is only to append dat or zzz to this property
        <prop oor:name="Extensions"><value>csv txt tab dat zzz</value></prop>

Be carefull that this file is in the main OOo directory, not the user one, so you may need some writing rights on this file

Deploying the solution

Thanks to OOo configuration model and great package manager, one can deploy this configuration easilly
Seeing OOo Configuration as layers (share > User > Packages), we can then define a package taht the user will add using its Tools > Package manager
The modified configuration will me merged to the Configuration XML tree provided the adminsitrator has not finalized the node

This package is straightforward to create :
  • Create a myConf.xcu file taking the heading of fcfg_calc_types.xcu and reproducing the calc_Text_txt_csv_StarCalc node with the desired modification.
  • zip the file
  • you're ready

Here is the example that configures calc to open .dat aand .zzz file sby default once the pacakge installed

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE oor:component-data SYSTEM "../../../../component-update.dtd">
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:package="org.openoffice.TypeDetection" oor:name="Types">
<node oor:name="Types">
<node oor:name="calc_Text_txt_csv_StarCalc" oor:op="replace" >
<prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop>
<prop oor:name="URLPattern"/>
<prop oor:name="Extensions"><value>csv txt tab dat zzz</value></prop>
<prop oor:name="MediaType"><value>text/plain</value></prop>
<prop oor:name="Preferred"><value>false</value></prop>
<prop oor:name="PreferredFilter"><value>Text - txt - csv (StarCalc)</value></prop>
<prop oor:name="UIName">
<value>Text - txt - csv (StarOffice Calc)</value>
</prop>
<prop oor:name="ClipboardFormat"/>
</node>
</node>
</oor:component-data>
Posted by Laurent Godard @ 02/24/2006 11:30 AM. - Categories: openoffice12 comments
02/23/2006
Reminder : OOo Developpers Article Contest
The first session of the Developpers Article Contest is running and will end at the end of the month.

As announced, this contest is to generate new documentation to developpers and everybody can participate. Developpers and technical writers are welcomed to propose articles. The subject has to cover a technical aspect of OOo such as building, patching, addon, extensions or OOo scripting aso.

Submissions have to be sent as attachments in the OASIS OpenDocument file format to the mailing list contest@development.openoffice.org

The contest rules can be found on the OOoWiki. Each month, an article will be elected and the winner author will earn 750 euros. He will also be member of the comitee for three months if he wants The remaining articles will stay in the contest for the next month so you have many chances to win :-)

So, write your articles and submit them. We are all waiting reading them ...
Posted by Laurent Godard @ 02/23/2006 11:19 PM. - Categories: indesko, openoffice -  0 comments
OOoCon2006 : Results ... After Koper, let's go to ...
Lyon has been choosen by votes

The official annoucement by Jacqueline, marketing lead
http://www.openoffice.org/servlets/ReadMsg?list=announce&msgNo=272

After the good work of Cédric at INSA, lets help him now organizing this event.
All the energies are welcomed to make this event as successfull as the previous years

You"ll surely be called for help - Stay tuned !!
Posted by Laurent Godard @ 02/23/2006 10:39 AM. - Categories: indesko, openoffice3 comments
02/10/2006
OOoCon2006 : Votes are opened
The OOoCon is our high level meeting and we as a community have the chance to decide each year where it will be located  !!

The previous locations have been Hamburg (DE), Berlin (DE), Koper (SL)
This year the choice is between Vienna (Austria) and Lyon (France)

This has been announced by Jacqueline, marketing lead, this morning via emails on various lists

As the CCR i can only tell people : go and vote !!!
CAUTION : The deadline is the 19th of february - Hurry up

For participating, it is rather simple, even if in english (what I also regret) - You've to be registered to OOo website before

  • Validate your choice

  • You'll receive an email ( subject : [OpenOffice.org] Please confirm your vote) asking for confirmation with a link inside  you must visit to finalize your vote. Something like
http://survey.services.openoffice.org/ooocon/confirm.php?action=bf386d2ea1b206b1dc16bd98
  •   Your vote is taken into account :)

That's all
Advertize around you to make the choice for the meeting place. (Everywhere it will take place, it will be a wonderfull event)

As member of the french community, i suggest you to vote for Lyon. Really, it's a cool place and Cédric did a great job negociating the hosting place.
Posted by Laurent Godard @ 02/10/2006 10:23 AM. - Categories: openoffice -  0 comments
02/08/2006
The spreadsheet next generation
As office suites evolve, more and more functionalities are proposed to end-users. Regarding spreadsheets, the next Excel generation will propose around 16 billions of cells in one sheet !!
This is done through a 1 000 000 rows versus 16 000 columns sheet

Damned, who needs so many numbers on one sheet ???

Anyway, if it is not enough, for you, powerfull end-users, OpenOffice.org Calc spreadsheet can propose a little bit more with a matrix of 2 000 000 rows versus 32 000 columns
The last cell coordinates of this 64 billions set is AUHT2000000
Formulas even work !

Nota : this is obviously a joke as some minor polish remains to be done on this quick hack (Thanks to Niklas Nebel for its pointers)
We are also waiting for the Office 12 file format to test the export functionality and are actually thinking to a 1 000 000 000 rows version


Posted by Laurent Godard @ 02/08/2006 12:53 PM. - Categories: openoffice1 comments
02/06/2006
ActiveCell : ViewData string meaning
In my previous blog concerning ActiveCell, i proposed a hack to retreive the current column and row, based on some magic string found in CurrentController.ViewData

We all agree that the best will be to extend the existing API. Waiting for it, here is the explanation.
Please note that in most cases, the currentSelection object should be sufficient.

This string is built in <OOoSources>/sc/source/ui/view/viewdata.cxx ScViewData::WriteUserData (thanks to noelp for pointing it). I analyzed it to see what information were stored there

so here is the magic,

but, first, as promised on the dev@api list, i put this statement
"this hack is based on an internal representation of the information not guaranted to be kept over versions"

On a new Calc file
print ThisComponent.CurrentController.ViewData
100/60/1;0;tw:270;17/34/0/0/0/0/2/0/0/0/0;;

here is the meaning identified for each portion

  • 100/60/1;0
  • zoom ratio (%) in normal view
  • zoom ratio (%) in page break view
  • current view mode (0|1 = normal|page break)
  • Active sheet index (0 based)
  • tw:270
  • tw : Nammed constant TAG_TABBARWIDTH
  • 270 : Width of the zone diplaying the sheets tabs (unit : pixels ?)
  • 17/34/0/0/0/0/2/0/0/0/0 - For each calc sheet, semi-colon separated.
  • active col (0 based)
  • active row (0 based)
  • split/freeze vertical (0|1|2) - 1 = split ; 2 = freeze
  • split/freeze horizontal (0|1|2) - 1 = split ; 2 = freeze
  • vertical position = in cell if fixed, in screen unit if frozen
  • horizontal position = in cell if fixed, in screen unit if frozen
  • active zone in the splitted|frozen sheet (0..3 from let to right, top to bottom)
  • X1 = 0 (always ?) - the col of the upper left cell of zone 0 (upper left)
  • X2 the col of the upper left cell of zone 3 (bottom right)
  • Y1 = 0 (always ?) - the row of the upper left cell of zone 0 (upper left)
  • Y2 the row of the upper left cell of zone 3 (bottom right)
                            X2 and Y2 can also be seen as lengths in cell number.
The information are available only if the sheet has been activated/view at least once since the file creation. In our cases, the default calc  document is created with three sheets but  only the first (default) has been accessed

These informations can also be found in the settings.xml file inside the calc file

      <config:config-item-map-entry config:name="Feuille1">
       <config:config-item config:name="CursorPositionX" config:type="int">2</config:config-item>
       <config:config-item config:name="CursorPositionY" config:type="int">14</config:config-item>
       <config:config-item config:name="HorizontalSplitMode" config:type="short">0</config:config-item>
       <config:config-item config:name="VerticalSplitMode" config:type="short">0</config:config-item>
       <config:config-item config:name="HorizontalSplitPosition" config:type="int">0</config:config-item>
       <config:config-item config:name="VerticalSplitPosition" config:type="int">0</config:config-item>
       <config:config-item config:name="ActiveSplitRange" config:type="short">2</config:config-item>
       <config:config-item config:name="PositionLeft" config:type="int">0</config:config-item>
       <config:config-item config:name="PositionRight" config:type="int">0</config:config-item>
       <config:config-item config:name="PositionTop" config:type="int">0</config:config-item>
       <config:config-item config:name="PositionBottom" config:type="int">0</config:config-item>
      </config:config-item-map-entry>
Posted by Laurent Godard @ 02/06/2006 06:59 PM. - Categories: indesko, openoffice -  0 comments
Last modified: 01/25/2005 07:20 PM

Nuxeo Bloggers: Log in!
Nuxeo - Indesko - Nuxeo 5 Project
All content is copyrighted by their author.
CPSSkins is Copyright © 2003-2006 by Jean-Marc Orliaguet. | CPS is Copyright © 2002-2006 by Nuxeo SAS.