Skip to main content

Document Properties

These properties define the document being edited and are typically set by the SetDocument* methods.
DocumentUrl
string
The absolute URL from which OnlyOffice Document Server can download the document. This URL must be accessible from the Document Server.Storage: ViewState
Access: Get/Set
MyEditor.DocumentUrl = "https://app.example.com/handler.ashx?action=download&fileId=abc123";
Automatically set by SetDocumentFromBytes, SetDocumentFromFile, and SetDocumentFromUpload methods.
DocumentName
string
Display name of the document shown in the editor interface. Used to determine file type extension.Storage: ViewState
Access: Get/Set
MyEditor.DocumentName = "Annual Report 2024.docx";
DocumentKey
string
Unique identifier for the document revision. OnlyOffice uses this to determine if a document has changed. Must be updated when document content changes.Storage: ViewState
Access: Get/Set
MyEditor.DocumentKey = "abc123def456_2024";
If the document content changes but the key remains the same, users may see stale cached versions.
CallbackUrl
string
URL where OnlyOffice Document Server sends editing status updates and saves the modified document. Must be accessible from the Document Server.Storage: ViewState
Access: Get/Set
MyEditor.CallbackUrl = "https://app.example.com/handler.ashx?action=callback&fileId=abc123";
The callback handler receives POST requests with JSON payload containing document status and download URL.

Configuration Properties

OnlyOfficeApiUrl
string
URL to the OnlyOffice Document Server API JavaScript file. This is the main entry point for the editor.Access: Get/Set
MyEditor.OnlyOfficeApiUrl = "https://docserver.example.com/web-apps/apps/api/documents/api.js";
This URL must be accessible from the client browser, not just from your server.
JwtSecret
string
default:"\"JGbxwFgrXgMcMrknjdxI\""
Secret key for signing JWT tokens used to secure communication between your application and OnlyOffice Document Server.Access: Get/Set
MyEditor.JwtSecret = ConfigurationManager.AppSettings["OnlyOfficeSecret"];
This must match the secret value in your Document Server configuration. Store securely in web.config or environment variables.
PublicBaseUrl
string
default:"\"https://192.168.10.34:44311\""
The public base URL of your application used to construct absolute URLs for DocumentUrl and CallbackUrl. Required when running behind a reverse proxy or load balancer.Access: Get/Set
MyEditor.PublicBaseUrl = "https://myapp.example.com";
If not set, URLs are constructed using Page.Request.Url, which may not work correctly behind proxies.

Editor Behavior Properties

Mode
string
default:"\"edit\""
Editor mode: "edit" for full editing capabilities or "view" for read-only mode.Access: Get/Set
MyEditor.Mode = HasPermission ? "edit" : "view";
Valid values:
  • "edit" - Full editing features
  • "view" - Read-only, no editing allowed
Lang
string
default:"\"es\""
Editor interface language code (ISO 639-1).Access: Get/Set
MyEditor.Lang = "en"; // English
MyEditor.Lang = "es"; // Spanish
MyEditor.Lang = "fr"; // French
Common values: "en", "es", "fr", "de", "it", "pt", "ru", "zh", etc.
EditorHeight
string
default:"\"520px\""
CSS height value for the editor container.Access: Get/Set
MyEditor.EditorHeight = "600px";
MyEditor.EditorHeight = "80vh";
Supports any valid CSS height value (px, %, vh, etc.)

User Properties

UserId
string
default:"\"1\""
Unique identifier for the current user editing the document. Used for collaboration features and tracking.Access: Get/Set
MyEditor.UserId = CurrentUser.Id.ToString();
UserDisplayName
string
default:"\"Usuario\""
Display name shown in the editor interface for the current user. Used in comments and collaboration features.Access: Get/Set
MyEditor.UserDisplayName = CurrentUser.FullName;

Client Integration Properties

CaptureTriggerId
string
default:"null"
Comma-separated list of button/control IDs that should trigger document capture. When clicked, the editor content is captured to the hidden field.Access: Get/Set
MyEditor.CaptureTriggerId = "btnSave";
MyEditor.CaptureTriggerId = "btnSave,btnSaveAndClose,btnExport";
The control automatically injects JavaScript to handle the capture and trigger postback.
EditorContainerId
string
Client-side ID of the HTML element that contains the OnlyOffice editor iframe. Generated as {ClientID}_editor.Access: Get only
string containerId = MyEditor.EditorContainerId;
// Result: "MyEditor_editor"
HiddenFieldClientId
string
Client-side ID of the hidden field that stores the captured document as Base64. Used for client-side integration.Access: Get only
string hiddenId = MyEditor.HiddenFieldClientId;
// Use in JavaScript: document.getElementById(hiddenId).value

State Properties

ConfigJson
string
JSON configuration string passed to the OnlyOffice editor JavaScript API. Generated automatically in PreRender phase.Access: Get only (set internally)Returns "null" if no document is loaded, otherwise returns JSON with token, document, documentType, and editorConfig.
{
  "token": "eyJhbGc...",
  "document": {
    "fileType": "docx",
    "key": "abc123_2024",
    "title": "Report.docx",
    "url": "https://..."
  },
  "documentType": "word",
  "editorConfig": {
    "callbackUrl": "https://...",
    "mode": "edit",
    "lang": "es",
    "user": {
      "id": "123",
      "name": "John Doe"
    }
  }
}
HasDocument
bool
Indicates whether a document has been loaded into the editor. Returns true if DocumentUrl, DocumentName, and DocumentKey are all set.Access: Get only
if (MyEditor.HasDocument)
{
    // Editor has a document loaded
    byte[] pdf = MyEditor.ConvertCurrentDocumentToPdfBytes();
}
HasEditedDocument
bool
Indicates whether the user has captured edited content from the editor. Returns true if the hidden field contains Base64 data.Access: Get only
protected void btnSave_Click(object sender, EventArgs e)
{
    if (MyEditor.HasEditedDocument)
    {
        byte[] edited = MyEditor.GetEditedDocumentBytes();
        SaveToDatabase(edited);
        MyEditor.ClearEditedDocument();
    }
}
This property only reflects client-side captured content, not real-time editor state. Content must be captured via CaptureTriggerId mechanism or JavaScript API.

Property Summary Table

PropertyTypeAccessDefaultDescription
DocumentUrlstringGet/SetnullDocument download URL
DocumentNamestringGet/SetnullDisplay name
DocumentKeystringGet/SetnullUnique revision key
CallbackUrlstringGet/SetnullCallback handler URL
OnlyOfficeApiUrlstringGet/Set(see above)Document Server API URL
JwtSecretstringGet/Set(see above)JWT signing secret
PublicBaseUrlstringGet/Set(see above)Public base URL
ModestringGet/Set”edit”Editor mode
LangstringGet/Set”es”Interface language
EditorHeightstringGet/Set”520px”Container height
UserIdstringGet/Set”1”Current user ID
UserDisplayNamestringGet/Set”Usuario”Current user name
CaptureTriggerIdstringGet/SetnullCapture button IDs
EditorContainerIdstringGet-Editor container ID
ConfigJsonstringGet-Editor configuration JSON
HasDocumentboolGet-Has document loaded
HiddenFieldClientIdstringGet-Hidden field client ID
HasEditedDocumentboolGet-Has captured edits

Build docs developers (and LLMs) love