Cannot mail merge from a dbf file

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
g-loc
Posts: 4
Joined: Thu Feb 13, 2014 1:19 pm

Cannot mail merge from a dbf file

Post by g-loc »

Hi,
I added a created dataSource in OpenOffice Base with db files created from an external program using the dbase driver, and I can open the tables and browse the data.
I need this table to do a mailmerge inside a document, and I'm using a C# program: I set the datasource name, tried with several combination of the commandtype and command to open a table, but when I execute the mailmerge, I receive an error that there is no active tables.
I tried to switch to the default bibliography datasource and I don't receive any error.
After the creation of the datasouce I have to do something else before to be used my MailMerge?

thanks,
Luca
OpenOffice 4.0.1 on Windows Xp
g-loc
Posts: 4
Joined: Thu Feb 13, 2014 1:19 pm

Re: Cannot mail merge from a dbf file

Post by g-loc »

I created a csv file, added as new datasource and it works fine. AT this point I think is problems of the dbase driver.
Now I have another question: how can create a template to print more copies in a single page and save the merge of multiple records in a single file?

thanks,
Luca
OpenOffice 4.0.1 on Windows Xp
User avatar
Villeroy
Volunteer
Posts: 31288
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cannot mail merge from a dbf file

Post by Villeroy »

This is what virtually nobody understands: You can not do any mail merge from dbf, csv, xls, etc.

Mail merge records are always pulled from a so called "database document" (*.odb). In most cases such a "database document" is a configuration file, e.g. it does not contain any data but it provides the abstraction layer for all data access regardless of file types and such. It can be connected to anything you have a driver for, including dbf, csv, xls etc.

1) Connect a Base document to a directory of *.dbf files (case sensitive, *.DBF does not work here). dBase has always been a database in a directory.
File>New>Database...
[X] Connect to existing database
Type: <dBase>
[X] Register the database
Store the database.
Later you may want to add to the "database document" (configuration) are meaningful queries. Parameter queries are supported.
Later you may want to connect it to something else or some other dBase directory: Edit>Database>Properties...
Close and forget the "database document".
---------------------------------------------------------------
2) Load/Create your letter template in Writer.
Hit F4 to call the data source window.
In the left pane you see your registered databases, their tables (representing *.dbf files in this case) and queries (if any).
Later you may want to Right-click a source to open the underlying "database document" or edit the list of registered databases.
Pick one table or query.
When your data are loaded in the right pane, grab column headers and drag them down into your template.
Your template is ready for use.
----------------------------------------------------------------
This is for the aleged end user:
3) Write a new letter from your template and print.
Confirm that you are going to print a mail merge.
In the following dialog you can filter, sort and pick the records to use. And you can choose if you want to print to a printer, to one document or many documents.

4) You may need some script or program to share the same data across work stations. The configuration is plain XML so you may do that using your favourite XML parsing library. Look up "RegisteredNames" in <user profile folder>/registrymodifications.xcu
For a dozend machines I prefer to do that manually.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
g-loc
Posts: 4
Joined: Thu Feb 13, 2014 1:19 pm

Re: Cannot mail merge from a dbf file

Post by g-loc »

Thanks for the long reply: I was just asking why the same procedure works with csv files and not with dbf.
With both datasources I can create the template using Writer, seeing tables, fields and grad them in the document, but when running the mailmerge with the dbf file I receive the error message
OpenOffice 4.0.1 on Windows Xp
User avatar
Villeroy
Volunteer
Posts: 31288
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cannot mail merge from a dbf file

Post by Villeroy »

g-loc wrote:Thanks for the long reply: I was just asking why the same procedure works with csv files and not with dbf.
With both datasources I can create the template using Writer, seeing tables, fields and grad them in the document, but when running the mailmerge with the dbf file I receive the error message
It should work with regular dbf files (dbf version 3 or 4) and with csv it is the same:

1) Connect a Base document to a directory of *.csv files.
File>New>Database...
[X] Connect to existing database
Type: <Text>
Then you've got to specify the gory details of your text tables, including the file name suffix.

Once you see your data represented as database tables all the rest remains exactly the same.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply