APEX Office Edit (AOE) Documentation

website·Indexed 31 days ago

https://www.apexofficeedit.com/docs/

Commercial software for securely creating and editing documents within Oracle APEX. Documentation covers the AOE Server architecture, Docker deployment, RESTful service handlers, and the APEX region plugin, including standard and custom attributes, event binding via dynamic actions, and integration with database objects.

Tokens
29.7K
Snippets
124
Records
196
Agent score
55%

What's inside APEX Office Edit

  1. Overview of the AOP Menu in Apex Office Edit

    The AOP menu (available from version 23.2) allows users to dynamically create Apex Office Print (AOP) templates. It analyzes provided SQL or JSON data to generate a list of all possible tags, which can then be dragged and dropped directly into a document.
  2. Handle AOE Document Loaded event

    The ucaoedocumentloaded event is triggered every time a document is successfully loaded into APEX Office Edit. This event provides a this.data object containing metadata about the loaded document.
    // Example of accessing document metadata in the ucaoedocumentloaded event
    console.log('Filename:', this.data.document.filename);
    console.log('Version:', this.data.document.version);
    console.log('Size (bytes):', this.data.document.size);
    console.log('Last Update:', this.data.document.lastUpdate); // Format: YYYY-MM-DD HH24:MI:SS
    console.log('PK Columns:', this.data.document.pksColumns);
    console.log('PK Values:', this.data.document.pksValues);
  3. Choose between APEX Office Edit Cloud and On-Premises licenses

    APEX Office Edit (AOE) provides two deployment options for integrating document editing (Word, Excel, PowerPoint, OpenDocument, Text) into Oracle APEX applications:

    1. Cloud Version: Requests are sent to an APEX Office Edit server hosted in the cloud.
    2. On-Premises Version: Includes a server component delivered as a Docker image that you run on your own infrastructure. In this configuration, the APEX plug-in is configured to reference your local server, ensuring no data is sent to the AOE cloud.
  4. Implement custom document retrieval with g_doc_getfileinfo

    To fetch information about a requested document using custom PL/SQL code, assign the name of a custom procedure to the AOE_PLUGIN.g_doc_getfileinfo variable. This procedure must be declared in the package specified in the Custom PL/SQL Package Name attribute and must follow the defined signature to return document details via OUT parameters.
    -- Example assignment
    AOE_PLUGIN.g_doc_getfileinfo := 'aoe_custom_getfileinfo';
    
    -- Procedure specification
    procedure aoe_custom_getfileinfo(
      p_application_id          in number,
      p_page_id                 in number,
      p_session_id              in number,
      p_user_id                 in varchar2,
      p_file_id                 in varchar2,
      p_out_content             out blob,
      p_out_filename            out varchar2,
      p_out_mime_type           out varchar2,
      p_out_last_update_date    out timestamp,
      p_out_version             out varchar2,
      p_out_blob_owner          out varchar2
    );
  5. Implement custom document information retrieval with g_doc_getfileinfo

    When the AOE source is set to 'Custom PL/SQL Code', you can specify a procedure name in the g_doc_getfileinfo attribute to fetch information about the requested document. This procedure must be declared in the package specified in the 'Custom PL/SQL Package Name' attribute and must return the document's content, filename, MIME type, and other metadata via OUT parameters.
    procedure aoe_custom_getfileinfo(
      p_application_id          in number,
      p_page_id                 in number,
      p_session_id              in number,
      p_user_id                 in varchar2,
      p_file_id                 in  varchar2,
      p_out_content             out blob,
      p_out_filename            out varchar2,
      p_out_mime_type           out varchar2,
      p_out_last_update_date    out timestamp,
      p_out_version             out varchar2,
      p_out_blob_owner          out varchar2
    );
  6. Debug AOE RESTful service requests

    All errors raised during the processing of RESTful service requests are stored in the AOE_REST_LOGS table. Each error contains an AOE REST debug id (view identifier), which can be used to filter logs and find specific incident details. It is recommended to copy the 'AOE RESTful Service Logs' page from the sample application to your own application to provide a developer-friendly UI for viewing these logs.
  7. Generate a starter template from data

    The 'Generate Starter Template' button creates a basic document structure based on the provided data. If the data contains cursors that can be looped, the tool automatically generates tables with headers for those cursors.
  8. Handle composite primary keys in AOE custom PL/SQL functions

    When AOE is configured to use a custom table with multiple primary keys, the p_file_id parameter contains a comma-separated list of the primary key values. Similarly, if a function needs to return new values for multiple primary keys, it should return a comma-separated string (e.g., 'X,Y').
    function example_function(
      p_session_id       in number,
      p_application_id   in number,
      p_page_id          in number,
      p_user_id          in varchar2,
      p_pks_column_names in varchar2,
      p_pks_item_values  in varchar2
    ) return varchar2
    is
      v_result varchar2(4000);
    begin
      -- Return comma-separated values for multiple primary keys (e.g., ID and ID2)
      v_result := 'X,Y';
      return v_result;
    end;
  9. Understand the new document creation flow in APEX Office Edit

    When creating a new document with the Default Table source:

    1. The user selects a document type tile.
    2. The widget calls the Create a new document REST service handler.
    3. The handler validates the access token, ensures the filename is unique (appending numbers like '(1)' if necessary), and inserts blank contents into AOE_DEFAULT_FILES.
    4. If g_default_versioning is true, an initial version is inserted into AOE_DEFAULT_VERSIONS.
    5. Any defined PL/SQL insert callbacks are executed.
    6. The plug-in updates the Item Containing Primary Key(s) Value(s) page item with the new document ID and refreshes the region.
  10. Handle multiple primary keys in AOE custom tables

    When APEX Office Edit (AOE) is configured to use a custom table with multiple primary keys, the p_file_id parameter is passed as a comma-separated list of primary key values. Conversely, if a function needs to return new values for multiple primary keys, it should return a comma-separated string (e.g., 'X,Y').
    function example_function(
      p_session_id       in number,
      p_application_id   in number,
      p_page_id          in number,
      p_user_id          in varchar2,
      p_pks_column_names in varchar2,
      p_pks_item_values  in varchar2
    ) return varchar2
    is
      v_result varchar2(4000);
    begin
      -- Return comma-separated values for multiple PKs (e.g., ID and ID2)
      v_result := 'X,Y';
      return v_result;
    end;
  11. Provide a license file to the AOE container

    There are three ways to provide the aoe.license file to the server. Volume mounting is the recommended method for permanent setups to ensure the license persists after container recreation.
    # Option 1: Volume Mount (Recommended for permanence)
    docker run -p 8030:8080 \
      -v /path/on/your/host/aoe.license:/APEXOfficeEdit/aoe.license \
      --name aoe -d --restart always unitedcodes/apexofficeedit
    
    # Option 2: Copy into running container (Temporary)
    docker cp /path/on/your/host/aoe.license aoe:/APEXOfficeEdit/aoe.license
    
    # Option 3: Activate inside container
    # Connect to container and run:
    ./AOEInterfaceLinux64 -a --email your@email.com
  12. Manually install APEX Office Edit into an existing application

    To add APEX Office Edit to an existing application without using the sample app, follow these two steps:

    Step 1: Run the DDL Install Script

    1. In APEX Application Builder, go to SQL Workshop > SQL Scripts.
    2. Upload and run the file: ddl_unitedcodes_apex_office_edit.sql.
    3. Verify the installation summary shows no errors.

    Step 2: Import the Plug-in

    1. Open your target application in the Application Builder.
    2. Navigate to Shared Components > Plug-ins.
    3. Click Import and upload the file: region_type_plugin_unitedcodes_aoe.sql.
    4. Complete the import wizard by clicking Next and then Install Plug-in.