On Tue, May 31, 2005 at 12:36:51PM +0200, Herv? Piedvache wrote: } On Tuesday 31 May 2005 12:08, Lee Braiden wrote: } > On Tuesday 31 May 2005 11:06, [EMAIL PROTECTED] wrote: } > > No I want the operators to not be able to modify the original document } > > ... And to have only a main administrator of the documents ... } > > It's a kind of contact center, where people manage phone calls and for } > > each call they will attribute to the customer a status ... and this } > > status will produce a postal mail ... to be generated immediatly or by } > > batch at the end of the day ... all the mail will be printed and put in } > > wrap to be posted ! } > > } > > It's clearer ? ;o) } > } > The usual way to do this sort of thing would be with a webserver running on } > your intranet, which is linked to a database, and keeps a list of your } > customers. Staff can then pull up a webpage, click a button, and have the } > server generate reports. } } Yes ... marvelous ... but with what kind of tool do you manage the production } of the mail ? } Yes It'll be a web application .. no problem for this ... but I want to manage } about 100 mail style sheet ... and be able to do the redaction of thoses mail } easily ... and then have a system to produce them in file and print them ... } } So how to do that ?
An OOo file is a zip file containing XML files. I don't have deep insight into the XML schema used, but it is well-documented and with a little examination of a sample file I find that it is pretty simple. Importantly, simple (same-styled) spans of text in a document show up as actual text strings in the XML. It is therefore possible to put in something like XXXXX_1_XXXXX in the running text and decompress/find/replace/recompress to produce a new file. Note that it is content.xml that you want to modify. The following script works for at least a simple case, though I recommend rewriting this for performance reasons (note that in this implementation replacements should be listed one per line in the replacements file, in order, and must not contain the # character): #!/bin/sh if test $# -ne 3 then echo "Usage: $0 <input SXW file> <output SXW file> <replacements file>" exit 1 fi PROCDIR=/tmp/$$ EDFILE=$PROCDIR/edscr export PROCDIR mkdir $PROCDIR awk '{ printf("1,$s#XXXXX_%d_XXXXX#%s#g\n", NR, $0) }' "$3" > $EDFILE echo w >> $EDFILE echo q >> $EDFILE cp "$1" $PROCDIR/file.sxw ( cd $PROCDIR unzip file.sxw content.xml ed -s content.xml < edscr zip -r file.sxw content.xml ) cp $PROCDIR/file.sxw "$2" rm -rf $PROCDIR } regards, } Herv? Piedvache --Greg -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]