How to Generate Mass Invoices in LibreOffice Writer

Generating mass invoices in LibreOffice Writer is accomplished by integrating external database records into a standardized invoice template using Mail Merge and database field insertion techniques. By connecting a data source—such as a LibreOffice Calc spreadsheet, CSV file, or SQL database—users can map dynamic fields like customer details, invoice numbers, line items, and totals directly into a Writer document. This guide explains the core database field insertion methods required to automate bulk invoice creation, batch printing, and individual PDF generation in LibreOffice.

1. Connecting the Data Source

Before inserting fields, LibreOffice Writer must be connected to your data source:

  1. Open LibreOffice Writer and press F4 (or go to View > Data Sources) to display the Data Source Explorer.
  2. If your database or spreadsheet is not listed, register it by navigating to Tools > Options > LibreOffice Base > Databases.
  3. Click New…, browse to select your file (e.g., .ods, .csv, .db), assign a registered name, and click OK.

Your database tables and queries will now appear in the Data Source pane above the document workspace.

2. Drag-and-Drop Field Insertion

The fastest method for placing database fields into your invoice layout is direct drag-and-drop:

  1. In the Data Source Explorer (F4), expand your registered database and select the specific table or query containing your invoice data.
  2. Click and hold the column header of the desired field (e.g., Customer_Name, Billing_Address, Invoice_Total).
  3. Drag the header directly into the target position or table cell inside your invoice template.
  4. Release the mouse button. The field will appear enclosed in angle brackets, such as <Customer_Name>.

3. Inserting Fields via the Fields Dialog

For greater control over formatting and field types:

  1. Place your cursor where the data should appear.
  2. Navigate to Insert > Field > More Fields… (or press Ctrl + F2).
  3. Select the Database tab.
  4. In the Type column, select Mail merge fields.
  5. In the Database selection pane, expand your database, choose the table, and select the field to insert.
  6. Click Insert and close the dialog.

4. Handling Multi-Line Invoices and Record Navigation

Standard Mail Merge creates one document page per database row. For invoices with multiple line items per customer, two techniques are used:

5. Outputting the Mass Invoices

Once the template fields are arranged:

  1. Go to File > Print.
  2. A prompt will appear stating: “Your document contains address database fields. Do you want to print a form letter?” Click Yes.
  3. In the Mail Merge dialog, select the records you wish to process (all or a specific range).
  4. Choose your output format:
    • Printer: Sends all generated invoices directly to a physical or virtual printer.
    • File: Generates the batch output. You can save all invoices as a single combined document or select Save as individual documents and assign a dynamic file path using an invoice number field (e.g., Invoice_<ID>.pdf).