Overview
TheOnlyOfficeEditor control exposes several configuration properties that control how the editor connects to OnlyOffice Document Server, handles authentication, and customizes the user experience.
Server Configuration
The URL to the OnlyOffice Document Server API JavaScript file.
This URL must point to the
api.js file on your OnlyOffice Document Server installation. The control uses this to load the editor’s JavaScript API.The public base URL of your ASP.NET application that OnlyOffice Document Server can reach.
Authentication Configuration
The secret key used for JWT token generation and validation.See JWT Authentication for more details on how JWT tokens are used.
Editor Behavior
The editing mode for the document.Supported values:
edit- Full editing capabilitiesview- Read-only mode
The height of the editor container.Accepts any valid CSS height value (px, %, vh, etc.).
The language code for the editor interface.See OnlyOffice documentation for supported language codes.
User Configuration
The unique identifier for the current user.
This ID is used to track which users are editing the document and for collaboration features.
The display name for the current user shown in the editor.
Advanced Configuration
Comma-separated list of button IDs that will trigger document capture.When these buttons are clicked, the control automatically captures the edited document content and stores it in a hidden field before postback.
How document capture works
How document capture works
- The control finds buttons with the specified IDs
- Attaches onclick handlers that call the JavaScript
captureToHiddenFieldmethod - Downloads the edited document from OnlyOffice
- Encodes it as Base64 and stores in a hidden field
- Triggers postback to the specified button
OnlyOfficeEditor.ascx.cs:473-477
Document Properties
The absolute URL where OnlyOffice can download the document.Typically set automatically when using
SetDocumentFromBytes() or SetDocumentFromFile().The display name of the document shown in the editor.
A unique key identifying this version of the document.
OnlyOffice uses this key for caching. If the key changes, OnlyOffice treats it as a new document version.
The URL where OnlyOffice will POST callback notifications about document status changes.See Callback Handling for details on implementing the callback endpoint.
Example: Complete Configuration
Code-behind
Best Practices
Performance Tips:
- Cache configuration values from AppSettings/Web.config
- Set
EditorHeightappropriately for your layout to avoid scrolling issues - Use meaningful
DocumentKeyvalues that change when document content changes