List Info

Thread: Registering an XMailMergeListener - possible at all?




Re: Registering an XMailMergeListener - possible at all?
user name
2007-02-19 11:32:12
Am Montag, den 19.02.2007, 15:43 +0100 schrieb Christian
Lohmaier:
> Hi Noëlson, Marc, *,

N'Abend,

> On Fri, Feb 16, 2007 at 04:54:13PM -0300, Noelson
Duarte wrote:
> > > 
> > > Does anybody have the solution or even a
working sample at hand?
> > > I'd really appreciate it.
> > 
> > You'll find a sample (OOoBasic) here:
> >  
http://www.oooforum.org/forum/viewtopic.phtml?t=8393
> 
> oProps must be Variant, not object here, but apart form
that this macro
> shows that it is possible to use a mailmergelistener.
> 
> > Perhaps it helps you.
> 
> That snippet, along with Marcs answer
"helped" somewhat:
> I know that the mailmerge listener is not suitable for
my case.
> 
> If I cannot use the builtin wizard, but have to ask the
user for the
> desired Database, etc myself and have to start the
mailmerge from within
> my extension, then this would be far too much effort
and thus pretty
> useless to me.

You could search the archives of this list for:

 From Tomas.OconnorSun.COM Mon Sep 27 14:43:34 2004
 Subject: Re: [api-dev] mailmerge api usage
 Message-id: <415803E2.7010406sun.com>

There you can find a complete working example of doing
MailMerge written
in Java. If it is not on the list please tell me, I'll
forward it to
you.

>From having a quick look at the code at least the setup
of a database
connection is shown, too. The solution for the problem of
touching each
document is made by using fields in a doc template, I think
you can
adopt this for inserting barcode pics instead of text
snippets. From the
surrounding explanations:

<--->
This command will:

- Open up a new Writer document
- Create a new Data Source with the name provided
- Configure the data source to load tables from the Data
Source directory
- Configure the data source to use "," as the
value separator
- Insert each of the headings in the first row of the table
specified as
   fields in the Writer document
- Save the Writer document as a OpenOffice.org Writer
template with the
   name provided

...

% java MailMerger -merge <URL of template file>
<Data Source name> <Table name>

This will perform a MailMerge using the template file, data
source and
table names provided. These should be the same names that
you used in
the -create command

</--->

So it shows much more than doing MailMerge ...

> If there would be a way to still use the wizard
however, then this could
> work...
> Mut the mailmerge-object requires a documentURL and
other properties
> before it can be executed. (and the documentURL would
require the user
> to save the document first, etc...), so I doubt that
this is possible
> :-(
> 
> So thank you very much for the pointer & answers.

You're welcome-

Marc


------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Registering an XMailMergeListener - possible at all?
user name
2007-03-02 09:09:06
Hi Marc, *,

On Mon, Feb 19, 2007 at 06:32:12PM +0100, Marc Santhoff
wrote:
> Am Montag, den 19.02.2007, 15:43 +0100 schrieb
Christian Lohmaier:
> > [mailmerge-listener]
> > If I cannot use the builtin wizard, but have to
ask the user for the
> > desired Database, etc myself and have to start the
mailmerge from within
> > my extension, then this would be far too much
effort and thus pretty
> > useless to me.
> 
> You could search the archives of this list for:
> 
>  From Tomas.OconnorSun.COM Mon Sep 27 14:43:34
2004
>  Subject: Re: [api-dev] mailmerge api usage
>  Message-id: <415803E2.7010406sun.com>
> 
> There you can find a complete working example of doing
MailMerge written
> in Java. If it is not on the list please tell me, I'll
forward it to
> you.

I think I found the mail you're refering to, but
unforutnately it
doesn't use the wizard-functionality, but instead requests
the
database/table to use in the merge as arguments.
http://api.openoffice.org/servlets/ReadMs
g?listName=dev&msgNo=11328

> From having a quick look at the code at least the setup
of a database
> connection is shown, too.

Yes, but this still would require me to write code to ask
the user for
the requested database and to duplicate all the stuff the
current
mail-merge wizard has builtin. (I personally don't like the
wizard at 
all, but I don't want to write one myself either)

> [...]<--->
> 
> % java MailMerger -merge <URL of template file>
<Data Source name> <Table name>

I don't want to deal with selecting the datasource/table at
all. I only
want to replace either a field or a bookmark/placeholder in
the
merge-document before it is printed/saved.

> </--->
> 
> So it shows much more than doing MailMerge ...

Yes, it shows how one could do this, but I want to avoid all
this...

I think I'll just tell the user to use the "modify
document" button and
then run the macro.

Not perfect, but still far easier than setting up a
mail-merge from
scratch.

ciao
Christian
-- 
NP: The Smashing Pumpkins - Porcelina Of The Vast Oceans

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Registering an XMailMergeListener - possible at all?
user name
2007-03-02 22:29:12
Moin Christian,

Am Freitag, den 02.03.2007, 16:09 +0100 schrieb Christian
Lohmaier:
> Hi Marc, *,
> 
> On Mon, Feb 19, 2007 at 06:32:12PM +0100, Marc Santhoff
wrote:
> > Am Montag, den 19.02.2007, 15:43 +0100 schrieb
Christian Lohmaier:
> > > [mailmerge-listener]
> > > If I cannot use the builtin wizard, but have
to ask the user for the
> > > desired Database, etc myself and have to
start the mailmerge from within
> > > my extension, then this would be far too much
effort and thus pretty
> > > useless to me.
> > 
> > You could search the archives of this list for:
> > 
> >  From Tomas.OconnorSun.COM Mon Sep 27 14:43:34
2004
> >  Subject: Re: [api-dev] mailmerge api usage
> >  Message-id: <415803E2.7010406sun.com>
> > 
> > There you can find a complete working example of
doing MailMerge written
> > in Java. If it is not on the list please tell me,
I'll forward it to
> > you.
> 
> I think I found the mail you're refering to, but
unforutnately it
> doesn't use the wizard-functionality, but instead
requests the
> database/table to use in the merge as arguments.
> http://api.openoffice.org/servlets/ReadMs
g?listName=dev&msgNo=11328

But at least it showshow this stuff is expected to work.

> > From having a quick look at the code at least the
setup of a database
> > connection is shown, too.
> 
> Yes, but this still would require me to write code to
ask the user for
> the requested database and to duplicate all the stuff
the current
> mail-merge wizard has builtin. (I personally don't like
the wizard at 
> all, but I don't want to write one myself either)

Okay, thinking about it two ideas come to my mind:

1. Hacking up^w Improving the wizard

The sources should be somewhere near the database wizard.
That is found
here:

http://installation.openoffice.org/source/b
rowse/installation/wizards

It could be a nice feature to have ... although I don't know
if there is
something similar in other countries or if this would be
"german only".

2. Trying to use one of the event hooks at the document in
process

There is an event "Serienbriefe drucken", or maybe
"Dokument drucken"
will fit your needs. I think you could hook to one of them
and trigger
your macro there.

The only question left then is, whether the hook is called
only once at
the start of mail merging or for each document with the
actual data
merged in already.

HTH,
Marc


------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


[1-10] [11-13]

about | contact  Other archives ( Real Estate discussion Medical topics )