Print Format as a Word

Good day everyone!
How can I make sure the created Print Format form can be saved not only as a PDF but also as a Word document?

You would need to build a custom app and use a library like LibreOffice, OnlyOffice, or similar.

1 Like

Or GitHub - python-openxml/python-docx: Create and modify Word documents with Python for Word Document.

Me: is there any way i can print from erpnext directly into ms word?

ChatGPT: Not directly — ERPNext does not have a built-in feature to print/export straight into Microsoft Word (.docx).

Here are the practical options:

1. Export as PDF → Open in Word

  • ERPNext’s “Print Format” generates PDFs.
  • You can open a PDF in Word (Word converts it to editable text).
  • Not perfect formatting, but quick.

2. Custom Jinja Print Format → HTML/RTF

  • You can make a custom Print Format in ERPNext that outputs HTML or RTF (Rich Text Format).
  • RTF is directly openable in Word with formatting preserved.
  • Requires a little customization of the print template.

3. Direct DOCX generation with Python app

  • Since ERPNext runs on Frappe (Python), you can write a server script or custom app that uses a library like python-docx to generate .docx files.

  • For example:

    from docx import Document
    
    def make_docx(docname):
        document = Document()
        document.add_heading('ERPNext Document', 0)
        document.add_paragraph(f'Document: {docname}')
        # add fields here...
        filename = f"/tmp/{docname}.docx"
        document.save(filename)
        return filename
    
  • Then add a Custom Button in ERPNext to call this function and return the .docx file for download.

4. Third-party integrations

  • You can connect ERPNext with Microsoft Office Online or SharePoint using APIs.
  • But that’s more complex and usually for enterprises.

:high_voltage: Easiest for you (no coding): PDF → Word
:high_voltage: Best long-term (if you want proper editable templates): custom Python docx exporter

Do you want me to sketch out how to add a “Download as Word” button in ERPNext v15?