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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to