Re: [api-dev] MailMergeType.FILE vs MailMergeType.PRINT

2007-11-15 Thread Marc Santhoff
Am Donnerstag, den 15.11.2007, 09:00 +0100 schrieb Willem Voogd:
 Hey Marc,

Hi Willem,

 Yeah, well, that's exactly what I do. And the code passes, and runs 
 fine, except that the resulting file doesn't have the fields merged. And 
 then when I change MailMergeType.FILE to MailMergeType.PRINT I do get 
 the merged document printed out...
 
 Did you by any chance run this code on a OOo2.3 version?

No, it was lingering around in my archive since 1.x ... maybe I find the
time to try next weekend.

  If anything fails I can pack up the complete bunch of files and send
  them to you in private.

 Well I think I have roughly the same code as you have, since I too 
 picked it up somewhere in the archives (even the comments match),

So you do create your print job(s) from a template? That should be it.

  but 
 just to be sure it might be a good idea,
 so yes please :)

I'll do and send to your private mail address. May take a little time,
though. ;)

Marc


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] MailMergeType.FILE vs MailMergeType.PRINT

2007-11-15 Thread Willem Voogd

Hey Marc,

Marc Santhoff schreef:

The merging sequence looks like this:

snip
public void doMerge() {

 Object mmservice = null;

 try {
 // Create an instance of the MailMerge service
 mmservice = mxMCF.createInstanceWithContext(
 com.sun.star.text.MailMerge, mxComponentContext);
 }
 catch (Exception e) {
 System.err.println(Error getting MailMerge service:  + e);
 return;
 }

 // Get the XPropertySet interface of the mmservice object
 XPropertySet oObjProps = (XPropertySet)
 UnoRuntime.queryInterface(XPropertySet.class, mmservice);

 try {

 // Set up the properties for the MailMerge command
 oObjProps.setPropertyValue(DataSourceName, mDataSourceName);

 oObjProps.setPropertyValue(Command, mTableName);

 oObjProps.setPropertyValue(CommandType,
 new Integer(com.sun.star.sdb.CommandType.TABLE));

 oObjProps.setPropertyValue(OutputType,
 new Short(com.sun.star.text.MailMergeType.FILE));

 oObjProps.setPropertyValue(DocumentURL, mFileURL);

 } catch 
/snip
  
Yeah, well, that's exactly what I do. And the code passes, and runs 
fine, except that the resulting file doesn't have the fields merged. And 
then when I change MailMergeType.FILE to MailMergeType.PRINT I do get 
the merged document printed out...


Did you by any chance run this code on a OOo2.3 version?

If anything fails I can pack up the complete bunch of files and send
them to you in private.
  
Well I think I have roughly the same code as you have, since I too 
picked it up somewhere in the archives (even the comments match), but 
just to be sure it might be a good idea,

so yes please :)

HTH,
Marc
  

Cheers,

Willem


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] MailMergeType.FILE vs MailMergeType.PRINT

2007-11-15 Thread Willem Voogd

hey Marc,


Did you by any chance run this code on a OOo2.3 version?



No, it was lingering around in my archive since 1.x ... maybe I find the
time to try next weekend.
  
OK, I can wait ;) I ask because I'm beginning to feel that it might be a 
2.x or even 2.3 problem.
The more because the MergeType.PRINT option works fine. It looks as if 
the merge job saves first and then merges and then discards the merge or 
something...


The XJob is very black boxy :) I would like to add some eventlisteners 
to the document, to see in what sequence they are raised, but i can't do 
that since the document isn't there before the job starts.
Ah well... Today i went investigating and came to the conclusion there 
is a wide discrepancy between the OOo2.3 implementation and the dev 
guide... :) It wasn't a total loss though, did get some insights 
investigating the various XPropertySets...

So you do create your print job(s) from a template? That should be it.
  
Yeah the template gets loaden, fields are merged and the compiled 
document is sent to the printer OK, that's why i feel taht the 
MergeType.FILE not working must be a bug...

I'll do and send to your private mail address. May take a little time,
though. ;)
  

My email agent is patient.. :) Thanks for your time and input!

Marc
  

Willem

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] MailMergeType.FILE vs MailMergeType.PRINT

2007-11-15 Thread Marc Santhoff
Am Donnerstag, den 15.11.2007, 15:46 +0100 schrieb Willem Voogd:
  I'll do and send to your private mail address. May take a little
 time,
  though. ;)

 My email agent is patient.. :) Thanks for your time and input!

It's you I meant  to be patient until I put my hands on it. ;)

But it is on the way now.

Marc


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] MailMergeType.FILE vs MailMergeType.PRINT

2007-11-13 Thread Marc Santhoff
Am Dienstag, den 13.11.2007, 17:37 +0100 schrieb Willem Voogd:
 Hi,

Hi Willem,

 it's me again :)
 
 I'm still putting up a fight to get the mailmerge done programmatically.
 And again i find myself in the dark.
 
 When i set the OutputType property to MailMergeType.PRINT the file gets 
 properly merged and printed, however when i set it to MailMergeType.FILE 
 the file doesn't get merged before it gets saved.
 Is this a real bug or am i perhaps missing something that i have to do 
 extra when choosing for OutputType MailMergeType.FILE?

I don't know exactly what the problem may be at your side, but I got
some code long ago on this list that was working flawlessly.

The code was designed to do a mail merge to file(s) by creating a
datasource, storing a doc with fields as template and merging the data
to an instance of this template as new document.

The merging sequence looks like this:

snip
public void doMerge() {

 Object mmservice = null;

 try {
 // Create an instance of the MailMerge service
 mmservice = mxMCF.createInstanceWithContext(
 com.sun.star.text.MailMerge, mxComponentContext);
 }
 catch (Exception e) {
 System.err.println(Error getting MailMerge service:  + e);
 return;
 }

 // Get the XPropertySet interface of the mmservice object
 XPropertySet oObjProps = (XPropertySet)
 UnoRuntime.queryInterface(XPropertySet.class, mmservice);

 try {

 // Set up the properties for the MailMerge command
 oObjProps.setPropertyValue(DataSourceName, mDataSourceName);

 oObjProps.setPropertyValue(Command, mTableName);

 oObjProps.setPropertyValue(CommandType,
 new Integer(com.sun.star.sdb.CommandType.TABLE));

 oObjProps.setPropertyValue(OutputType,
 new Short(com.sun.star.text.MailMergeType.FILE));

 oObjProps.setPropertyValue(DocumentURL, mFileURL);

 } catch 
/snip

If anything fails I can pack up the complete bunch of files and send
them to you in private.

HTH,
Marc


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]