Re: Formatting Documents


Subject: Re: Formatting Documents
From: Dom Lachowicz (dominicl@seas.upenn.edu)
Date: Sun Jul 29 2001 - 21:28:57 CDT


Quoting William Lachance <wlach@interlog.com>:

> Ok, I give up.
>
> I can't for the life of me see how to add styles (bold, underline, etc.)
>
> correctly when loading a file. I've looked through just about every
> importer
> and none of them seem to point me in the right direction.
>
> It's pretty obvious how you add a hint to start the usage of style
> within a
> document (by using pd_Document->appendFmt), but I don't see how you end
> it. Many of the importers (ie: the abiword importer) don't seem to do it
> at
> all! (although of course that can't be true).
>
> What WordPerfect does is define a sequence of 3 bytes that both begins
> and
> ends a style property's occurance of arbitrary length (byte 241 begins
> one,
> 242 ends one).
>
> Any help would be much appreciate..

Hey William,

Well, I'm sure that you've taken a grand-tour of the existing importers by now,
and Martin has replied to this mail too, but here's some help anyway.

appendFmt is cumulative. You need to pass it an XML_Char ** array, usuaully
this:

XML_Char * props[3];
props[0] = "props";
props[1] = "text-decoration: underline";
props[2] = 0;
appendFmt (props);

But remember that unless you explicity override the old value, the formatting
will be cululative, much like final exams:

http://www.abisource.com/lxr/source/abi/src/wp/impexp/xp/ie_imp_MsWord_97.cpp#12
81

However, if you want to be really picky and not take lots of chances, I suggest
using the vector-based approach and push/pop format states, used by our XML
importers:

http://www.abisource.com/lxr/source/abi/src/wp/impexp/xp/ie_imp_AbiWord_1.cpp#30
4

Dom



This archive was generated by hypermail 2b25 : Sun Jul 29 2001 - 21:28:59 CDT