Template Printing

Print TemplateProfessional Edition+

Introduction

The Template Printing plugin lets you design templates in Word, Excel, and PowerPoint (supporting .docx, .xlsx, .pptx), define placeholders and logical structures in the template, and dynamically generate pre-formatted outputs such as .docx, .xlsx, .pptx, and PDF. It is widely used to produce business documents like quotations, invoices, contracts, etc.

Key Features

  • Multi-format support: Compatible with Word, Excel, and PowerPoint templates to meet different document generation needs.
  • Dynamic data filling: Automatically populates and generates document content via placeholders and logical structures.
  • Flexible template management: Add, edit, delete, and categorize templates for easy maintenance and reuse.
  • Rich template syntax: Supports basic replacement, array access, loops, and conditional statements to handle complex document logic.
  • Formatter support: Provides conditional output, date formatting, number formatting, etc., to improve readability and professionalism.
  • Image field support: Supports rendering attachment images and handwritten signature images in templates.
  • Efficient output: Supports direct PDF generation for convenient sharing and printing.

Installation

Install Plugins

For detailed installation and upgrade instructions, please refer to: Commercial Plugin Activation Guide

Install LibreOffice (Optional)

Generating PDFs requires installing LibreOffice. Please download it from the official website. For the Docker version, you can create a script directly in the ./storage/scripts directory.

mkdir ./storage/scripts
cd ./storage/scripts
vim install-libreoffice.sh

The content of install-libreoffice.sh is as follows:

#!/bin/bash

# Define variables
INSTALL_DIR="/opt/libreoffice24.8"
DOWNLOAD_URL="https://downloadarchive.documentfoundation.org/libreoffice/old/24.8.5.2/deb/x86_64/LibreOffice_24.8.5.2_Linux_x86-64_deb.tar.gz"

# Check if LibreOffice is already installed
if [ -d "$INSTALL_DIR" ]; then
    echo "LibreOffice is already installed, skipping installation."
    exit 0
fi

# Update APT and install dependencies
apt-get update

apt-get install -y \
    libfreetype6 \
    fontconfig \
    libgssapi-krb5-2 \
    libxml2 \
    libnss3 \
    libdbus-1-3 \
    libcairo2 \
    libxslt1.1 \
    libglib2.0-0 \
    libcups2 \
    libx11-xcb1 \
    fonts-liberation \
    fonts-noto-cjk \
    wget

rm -rf /var/lib/apt/lists/*

cd /app/nocobase/storage/scripts

# Download and install LibreOffice if not already present
if [ ! -d "./libreoffice" ]; then
    rm -rf libreoffice.tar.gz
    wget --no-check-certificate -O libreoffice.tar.gz $DOWNLOAD_URL
    if [ $? -ne 0 ]; then
        echo "Failed to download LibreOffice."
        exit 1
    fi
    rm -rf libreoffice && mkdir libreoffice
    tar -zxvf libreoffice.tar.gz -C ./libreoffice --strip-components=1
    if [ $? -ne 0 ]; then
        echo "Failed to extract LibreOffice."
        exit 1
    fi
fi

# Install LibreOffice
dpkg -i libreoffice/DEBS/*.deb

ln -s /opt/libreoffice24.8/program/soffice.bin /usr/bin/libreoffice
libreoffice --version

if [ $? -ne 0 ]; then
    echo "Failed to install LibreOffice."
    exit 1
fi

echo "LibreOffice installation completed successfully."

Restart the app container:

docker compose restart app
# View logs
docker compose logs app

Verify the installation was successful:

$ docker compose exec app bash -c "libreoffice --version"

LibreOffice 24.8.4.2 bb3cfa12c7b1bf994ecc5649a80400d06cd71002