Hi,
does anybody now how the fields in a writer-doc have to be named when using the code todo an automatic mail-merge?
-----------------------8<-----------------------
Object dbContext = xMSF.createInstance("com.sun.star.sdb.DatabaseContext");
XNameAccess nameAccess =
(XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, dbContext);
Object dataSource = nameAccess.getByName("mailMerge");if( dataSource != null ) {
Object mService =
xMCF.createInstanceWithContext("com.sun.star.text.MailMerge",
xComponentContext);System.out.println("Before Query is registered!");registerQuery(dataSource);
System.out.println("Query is registered!");XPropertySet oObjProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, mService);
oObjProps.setPropertyValue("DataSourceName", "mailMerge");
oObjProps.setPropertyValue("Command", "SELECT a, b FROM bla" );
oObjProps.setPropertyValue("CommandType",new
Integer(com.sun.star.sdb.CommandType.COMMAND));
oObjProps.setPropertyValue("OutputType",new
Short(com.sun.star.text.MailMergeType.PRINTER));
oObjProps.setPropertyValue("DocumentURL", templateFile);XJob job = (XJob) UnoRuntime.queryInterface(XJob.class, mService);
System.out.println("Print job is getting started!");try {
job.execute(new NamedValue[0]);
System.out.println("Print job is started!");
}
catch (com.sun.star.lang.IllegalArgumentException iae) {
System.err.println("Caught IllegalArgumentException: " + iae);
}
catch (com.sun.star.uno.Exception e) {
System.err.println("Caught UNO Exception: " + e);
}
-----------------------8<-----------------------The main problem is that I don't want OO to pop-up and that's why I can register a query because it needs an opened OO-Window.
When using an registered Query the field holds myquery.a, myquery.b is there any default?
Tom
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
