Re: wv and .doc exports?

Subject: Re: wv and .doc exports?
From: Justin Bradford (
Date: Sat Dec 04 1999 - 20:03:44 CST

> I was wondering if someone more familiar with the wv codebase might
> comment on future possibilities of Word export functionality? Is there a
> fairly straightforward way for this to happen, and it's waiting on
> programmer time, or is this a complicated design problem in it's own
> right. If someone wanted to start thinking about this, and poking around,
> where would you recommend they begin?

Yes, export is planned, and the limiting factor is programmer time.

One would need to consult with Caolan about his specific plans, but here
is a rough outline of implementation details:

1. Replace laola OLE code in wv with libole2 from gnumeric.
   Most of the reads are already wrapped by some utility functions, which
could just be replaced. However, getc is also used many times, which ought
to be replaced with a wrapper function similar to the 2 and 4 bit read
functions. Some seek functions might also need replacement.
   The OLE loader would need to be replaced, and the stream FILE handles
would be replaced with libole2 stream handles.

2. The various "chunks" of a word file have specific formats which, in
the importer, are read from the file, and used to build in memory
structures for use. These functions need complementary write versions,
which takes the structs and writes out the data to the OLE stream.

3. Export API should be the reverse of the import API. Simply, function to
change character, paragraph, section properties, write a block of
characters, insert a "special" character (which includes images, OLE
objects, etc).

 a. Propably also need a function to set a style (just pass character and
paragraph properties for it)

 b. Functions to set various other properties of the word file (password,
encryption, name, etc)

4. A function to write all of the little pieces we collect out the in
right place and order.

If you want to explore this more, I'd start with the wv source and some
documentation on the Word file format. The latter can be found on Just a warning, though, it is not a pleasant format.

As for actually programming stuff, perhaps Caolan could give details on
what he is planning. I imagine one could start on the write functions, as
they are fairly self-contained.


This archive was generated by hypermail 2b25 : Sat Dec 04 1999 - 20:03:52 CST