Nextcloud Office (Collabora)

repository·main·Indexed 19 days ago

https://github.com/nextcloud/richdocuments

An integration app that brings Collabora Online (CODE) into Nextcloud for real-time collaborative editing of document formats including DOCX, PPTX, XLSX, and ODF. Features include AI-powered document generation, template management via API, federated editing for global scale, and WOPI support for external apps.

Tokens
14.4K
Snippets
44
Records
74
Agent score
66%

What's inside richdocuments

  1. Overview of Collabora Online in Nextcloud

    main

    Collabora Online provides real-time, high-fidelity document editing within Nextcloud. It features WYSIWYG rendering that preserves document layout and formatting.

    Key capabilities include:

    • Real-time Collaboration: Multiple users can edit documents simultaneously.
    • Commenting: Users can insert and reply to comments.
    • Anonymous Editing: Users without a Nextcloud account can edit files via public link shared folders.
    • Broad Format Support: Supports DOC, DOCX, PPT, PPTX, XLS, XLSX, ODF, Visio, Publisher, and more.

    For developers and home users, Collabora Online Development Edition (CODE) is available via a Docker image. Enterprise users requiring higher stability and scalability should use the Collabora Online Enterprise version.

  2. How Office text document generation works

    main

    When using the "Generate Office text document" task type in the Assistant, the system follows a multi-step conversion pipeline to create .docx, .odt, or .pdf files from a user prompt:

    1. Markdown Generation: The prompt is used to generate Markdown content via a TextToText provider.
    2. HTML Conversion: The generated Markdown is converted into HTML.
    3. Collabora Conversion: The HTML is sent to Collabora Online, which converts it into the final document format.
  3. Manage system-wide templates in Nextcloud Office

    main
    System-wide templates are configured by an administrator via the admin settings. These templates are stored within the Nextcloud AppData. To display these templates to users, the richdocuments app acts as a preview provider and must utilize the preview API to generate appropriate previews for the template files.
  4. Implement the RichDocumentsMobileInterface for mobile clients

    main

    To allow the Collabora editor to communicate with a mobile client (e.g., a native app), the client must register a JavaScript handler named RichDocumentsMobileInterface in the webview. The editor expects the following methods to be implemented by the client:

    • close(): Closes the webview.
    • share(): Opens the share sidebar or dialog for the current file.
    • documentLoaded(): Called once Collabora has loaded; the client can use this to hide the loading screen.
    • paste(): Triggered to allow integrating applications to pass clipboard content to the editor.
    • fileRename(): Notifies the client that the current file has been renamed.
    • downloadAs(): Hands over a download link to the client application.
  5. Restrict Nextcloud Office usage and editing to specific groups

    main

    You can control access to the Nextcloud Office (Collabora) app using group restrictions:

    • Restrict usage: When active, only members of specified groups can use Nextcloud Office.
    • Restrict edit: When active, only members of specified groups can edit documents; all other users are restricted to view-only mode.
  6. How Spreadsheet document generation works

    main

    When using the "Generate Office spreadsheet document" task type in the Assistant, the system follows this pipeline to create .xlsx or .ods files from a user prompt:

    1. CSV Generation: The prompt is used to generate CSV content via a TextToText provider.
    2. Collabora Conversion: The CSV content is sent to Collabora Online, which converts it into the final spreadsheet format.
  7. Allow remote embedding in Collabora Online

    main

    By default, Collabora Online restricts embedding to the same remote that loaded the initial frame. To allow embedding from trusted remotes (such as different Global Scale nodes), you must update the Content Security Policy (CSP) using the coolconfig tool. This allows the document to be framed by the specified domains.

    coolconfig set net.content_security_policy "frame-ancestors *.example.com:*;"
  8. Configure Federated Editing for Global Scale

    main

    To enable collaborative editing of federated documents, ensure the following requirements are met:

    1. Version Requirement: All involved servers must be running richdocuments version 3.4 or higher.
    2. Trusted Servers: The remote server must be added as a trusted server in the Nextcloud configuration.
    3. Frame Embedding: You must allow any domain to embed Collabora Online in a frame by setting the following in your coolwsd.xml configuration: <frame_ancestors>https://*</frame_ancestors>

    Note: Due to content security policies, opening a document on a remote instance requires a page reload to allow Nextcloud to embed the remote Collabora Online instance in a frame.

  9. Enable Nextcloud trusted domains for federated editing

    main

    By default, the trusted hosts defined in Nextcloud's core configuration are not permitted for federated editing. To allow federated editing to use these trusted domains, you must enable the federation_use_trusted_domains setting in the richdocuments app configuration via the occ command.

    occ config:app:set richdocuments federation_use_trusted_domains --value="yes"
  10. Configure background job workers for AI document generation

    main
    AI document generation requires multiple background job workers. This is because each generation task schedules an additional worker to execute the TextToText provider for content generation. Without sufficient background workers, document generation tasks may fail or experience significant delays. Refer to the Nextcloud admin documentation to set up and scale your background job workers to improve AI task pickup speed.