Converting some files to OOo writer

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting some files to OOo writer

Yannick Patois
Hi,

I have some files in an old (proprietary) format.
The format looks not too complex and the reverse seems to work fine for
now (that's just some old electronic typewriter, there is not too much
fanciness).

So, now, I want to to convert them to some good open and usable format,
and I thought to OOo.

I dont know much about OOo internal format, and I'm still pondering how
to generate it.


- My first thought was simply to create a simple OOo file with no text,
unzip the .sxw generated, find the content.xml and insert the converted
document text with the tags for formating, only a few tens of option
this typewritter supported.
Advantage: self consistant, looks simple.
Inconveniant: Didnt tried yet, might be unexpected pitfalls (I may
generate inconsistant index or I dont know what), maybee not too elegent.

- Looking for a more elegent solution, found pyuno (I'm programming the
prototype in python, but could switch to C++ if useful). I just read a
bit of it's documentation, didnt undestand much yet: looks like I have
to actually *run* an instance of OOo to make use of pyuno. Seems a bit
overkill to me. Linking against some OOo API and run "typewriter2oo
*.tpw" in a directory is one thing; having to launch Ooo somewhere just
to run a cli script doesnt appeal to me very much. But maybe I'm
misleaded and there's a way to have a self-consistant script?

- To the point I'm now, why not just creating an import filter for OOo?
That would give users a very easy way to open and convert the files
interactively, and likely generate a hook tha could be called from a
pyuno cli script, if wanted.
But... Can filter be wrote and distributed independently of OOo itself,
or would I have to recompile the whole software including my hack? Is it
difficult to create and insert a new filter in OOo?
I really dont know.


So, I would ask you, what solution do you belive is the most suitable
for what I want to do?

Thanks for any suggestion, help or comment.

        Yannick






---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Converting some files to OOo writer

Cor Nouws
Hi Yannick,

Yannick Patois wrote:

> Hi,
>
> I have some files in an old (proprietary) format.
[...]
> So, I would ask you, what solution do you belive is the most suitable
> for what I want to do?

Have you tried File|Wizard(Assistent)|File conversion?

Greetings,
Cor
--
--------------------------------------
|  you need it - je hebt het nodig  |
|                                   |
|          OpenOffice.org           |
|                                   |
| Cor Nouws, http://www.nouenoff.nl |
--------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Converting some files to OOo writer

CPHennessy
In reply to this post by Yannick Patois
On Fri December 2 2005 21:04, Yannick Patois wrote:

> Hi,
>
> I have some files in an old (proprietary) format.
> The format looks not too complex and the reverse seems to work fine for
> now (that's just some old electronic typewriter, there is not too much
> fanciness).
>
> So, now, I want to to convert them to some good open and usable format,
> and I thought to OOo.
>
> I dont know much about OOo internal format, and I'm still pondering how
> to generate it.
>
>
> - My first thought was simply to create a simple OOo file with no text,
> unzip the .sxw generated, find the content.xml and insert the converted
> document text with the tags for formating, only a few tens of option
> this typewritter supported.
I think that this is actually a reasonable way to approach your problem.
ODT files are reasonably easy to generate, and the simplest way to start is
obviously to start with no text formatting which is simply to make all of the
text a set of paragraphs. Then start on the formating.

> Advantage: self consistant, looks simple.
> Inconveniant: Didnt tried yet, might be unexpected pitfalls (I may
> generate inconsistant index or I dont know what), maybee not too elegent.
You should have no index problems as all you need to do is to zip all of the
files together again after you complete the contents.xml file.

> - Looking for a more elegent solution, found pyuno (I'm programming the
> prototype in python, but could switch to C++ if useful). I just read a
> bit of it's documentation, didnt undestand much yet: looks like I have
> to actually *run* an instance of OOo to make use of pyuno. Seems a bit
> overkill to me. Linking against some OOo API and run "typewriter2oo
> *.tpw" in a directory is one thing; having to launch Ooo somewhere just
> to run a cli script doesnt appeal to me very much. But maybe I'm
> misleaded and there's a way to have a self-consistant script?
You are correct, you need to run OOo to use pyuno.

> - To the point I'm now, why not just creating an import filter for OOo?
> That would give users a very easy way to open and convert the files
> interactively, and likely generate a hook tha could be called from a
> pyuno cli script, if wanted.
> But... Can filter be wrote and distributed independently of OOo itself,
> or would I have to recompile the whole software including my hack? Is it
> difficult to create and insert a new filter in OOo?
It should not be too difficult once you know some XML technologies i.e. XSLT
and XPATH. Have a look at http://xml.openoffice.org/filters.html for more
info on XML based filters.

> So, I would ask you, what solution do you belive is the most suitable
> for what I want to do?
Start with the generation of content.xml files as it will allow you to easily
get to grips with the various tags, and to know the mapping of your
attributes into OOo attributes. Once this is done then writing a filter
should be a bit easier.

--
CPH : openoffice.org contributor

Maybe your question has been answered already?
                                http://user-faq.openoffice.org/#FAQ

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Converting some files to OOo writer

Yannick Patois
Hi,

Thanks you very much for your very precise answer.

CPHennessy a ?crit :
> On Fri December 2 2005 21:04, Yannick Patois wrote:
>>I have some files in an old (proprietary) format.
>>The format looks not too complex and the reverse seems to work fine for
>>now (that's just some old electronic typewriter, there is not too much
>>fanciness).

>>- My first thought was simply to create a simple OOo file with no text,
>>unzip the .sxw generated, find the content.xml and insert the converted
>>document text with the tags for formating, only a few tens of option
>>this typewritter supported.
> I think that this is actually a reasonable way to approach your problem.
> ODT files are reasonably easy to generate, and the simplest way to start is
> obviously to start with no text formatting which is simply to make all of the
> text a set of paragraphs. Then start on the formating.

Good, I'll continue this way, then.


>>- To the point I'm now, why not just creating an import filter for OOo?
> It should not be too difficult once you know some XML technologies i.e. XSLT
> and XPATH. Have a look at http://xml.openoffice.org/filters.html for more
> info on XML based filters.

Thanks for the inf, I have some knowledge of XSLT, I'll have a look.

>>So, I would ask you, what solution do you belive is the most suitable
>>for what I want to do?
> Start with the generation of content.xml files as it will allow you to easily
> get to grips with the various tags, and to know the mapping of your
> attributes into OOo attributes. Once this is done then writing a filter
> should be a bit easier.

I'll follow your recommandations.

Thanks you again for your very informative answer.

        Yannick



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Converting some files to OOo writer

Claus Agerskov-2
In reply to this post by Yannick Patois
On Fri, 2 Dec 2005, Yannick Patois wrote:

> - My first thought was simply to create a simple OOo file with no text,
> unzip the .sxw generated, find the content.xml and insert the converted
> document text with the tags for formating, only a few tens of option
> this typewritter supported.

Don't use the old OpenOffice.org 1.0 Format (.sx?). Use the new open
standard OpenDocument (.od?) which is also the default file format for
OpenOffice.org 2.0 and newer.

The most enjoyable greetings
--
Claus Agerskov     ###= Analyze                      OpenOffice.org
Co-lead/owner          #=== Requirements         Project Management Tool
[hidden email]          ==== Design/model           Subproject    
http://ooo.chbs.dk/            ==== Implement   http://oopm.openoffice.org/


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Converting some files to OOo writer

Yannick Patois
Claus Agerskov a ?crit :
> On Fri, 2 Dec 2005, Yannick Patois wrote:
>>- My first thought was simply to create a simple OOo file with no text,
>>unzip the .sxw generated, find the content.xml and insert the converted
>>document text with the tags for formating, only a few tens of option
>>this typewritter supported.
> Don't use the old OpenOffice.org 1.0 Format (.sx?). Use the new open
> standard OpenDocument (.od?) which is also the default file format for
> OpenOffice.org 2.0 and newer.

Hum, I believe 00o2 can open OOo1 format, and I guess that quite a lot
of people (including me) doesnt yet have OOo2 (it's not yet in debian
testing for example).

I expect the formats not to be very differents and upgrade to OOo2 in a
few months.

        Yannick


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Converting some files to OOo writer

Mathias Bauer
In reply to this post by Yannick Patois
Yannick Patois wrote:

> - To the point I'm now, why not just creating an import filter for OOo?
> That would give users a very easy way to open and convert the files
> interactively, and likely generate a hook tha could be called from a
> pyuno cli script, if wanted.
> But... Can filter be wrote and distributed independently of OOo itself,
> or would I have to recompile the whole software including my hack? Is it
> difficult to create and insert a new filter in OOo?
> I really dont know.

Filter development does not force you to compile any OOo source code at
all. I don't know what you want to import (only text, some attributes or
even more complex structures and elements), but in general a UNO based
filter using the Writer API is a good option. Of course you must learn
something about this API but AFAIK the SDK contains a simple example for
a "pure text" import filter for Writer written in Java so you have at
least a starting point how you can import the pure text, adding the
formatting or other things can be done later.

If the example isn't part of the SDK I'm sure it can be found somewhere
else. :-)

Best regards,
Mathias

--
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [hidden email] is a spam sink.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]