Forum at OOoForum.orgThe Forum
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Mailmerge in sdk3

Post new topic   Reply to topic Forum Index -> Macros and API
View previous topic :: View next topic  
Author Message
General User
General User

Joined: 01 May 2004
Posts: 41

PostPosted: Mon Jul 30, 2012 3:40 am    Post subject: Mailmerge in sdk3 Reply with quote

Hi has anyone used the Mailmerge Service in either Java or C++ with SDK version 3, the code I posted here back in 2004 no longer works (I am getting blank spaces where my mailmerge fields should be) and I am finding it difficult finding any documentation outlining the new proceedure.
Any help much appreciated.

redrgreen wrote:
Following on from what we did here
we can use the query to do a mail merge here is the code

    Reference< XInterface > rMM; //our MailMerge Service
    Reference< XMultiServiceFactory > rRSM; //represents the remote service manager


rRSM = ooConnect();
        wxMessageBox("Connected to the office");
        rMM = Reference< XInterface >(rRSM->createInstance(

The MailMerge function

void MyFrame::runMerge()
    Reference< XPropertySet > rProps (rMM, UNO_QUERY);
    Any mProps[5];
    //set the properties for the mailmerge
    mProps[0] <<= OUString::createFromAscii("NewDataSourceName");
    mProps[1] <<= OUString::createFromAscii("file:///c:/mailmerge.sxw");
    mProps[2] <<= sal_Int32(1);  //comandtype = QUERY = 1
    mProps[3] <<= sal_Int16(1); //OutputType = PRINTER = 1
    mProps[4] <<= OUString::createFromAscii("Query1");
        OUString::createFromAscii("DataSourceName"), mProps[0]);
        OUString::createFromAscii("DocumentURL"), mProps[1]);
        OUString::createFromAscii("CommandType"), mProps[2]);
        OUString::createFromAscii("Command"), mProps[4]);
        OUString::createFromAscii("OutputType"), mProps[3]);
     //create an empty sequence of type NamedValue to pass to the execute function
    //we could use this to pass parameters to the mailmerge
    Sequence< NamedValue > mSeq;
    //need the XJob interface of MailMerge service which has one method ie execute()
   //to complete the merge
    Reference< XJob > rJob (rMM, UNO_QUERY);
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Forum Index -> Macros and API All times are GMT - 8 Hours
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group