### Install Dependencies and Start Server with Make (Local Machine) Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/samples/language-specific-examples/python-example.md Navigate to the example directory and use 'make prod' to install dependencies, followed by 'make server-prod' to start the server for local development. ```bash cd "Python Example" make prod make server-prod ``` -------------------------------- ### Install Dependencies and Start Server for Local PHP Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/samples/language-specific-examples/php-example.md Install PHP dependencies using 'make prod' and start the server with 'make server-prod' for a local machine setup of the PHP integration example. ```bash cd "PHP Example" make prod make server-prod ``` -------------------------------- ### Install Dependencies and Start Ruby Example Server Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/samples/language-specific-examples/ruby-example.md Navigate to the example directory, install dependencies, and start the production server. ```sh cd "Ruby Example" make prod make server-prod ``` -------------------------------- ### TypeScript SDK - Get Started Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docspace/api-backend/get-started/sdks/typescript-get-started.md This example demonstrates how to initialize the SDK with your DocSpace configuration and make a call to the getRoomsFolder method. ```APIDOC ## TypeScript SDK - Get Started Example ### Description This example demonstrates how to initialize the SDK with your DocSpace configuration and make a call to the `getRoomsFolder` method. ### Method ```typescript import { Configuration, RoomsApi } from '@onlyoffice/docspace-api-sdk'; const config = new Configuration ({ basePath: "https://your-docspace.onlyoffice.com", accessToken: "YOUR ACCESS TOKEN", }); const roomsApi = new RoomsApi(config); try { const result = await roomsApi.getRoomsFolder({ type: [6,5]}); console.log('API called successfully. Returned data: ', result.data); } catch (error) { console.error(error); } ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **data** (object) - The response data containing room folder information. #### Response Example ```json { "data": { ... } } ``` ``` -------------------------------- ### Start Docker Containers for Ruby Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/samples/language-specific-examples/ruby-example.md Navigate to the example directory and start the Docker containers for the production environment. ```sh cd "Ruby Example" make compose-prod ``` -------------------------------- ### HTML Setup for Get Files Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docspace/javascript-sdk/samples/basic-samples/get-files.md This snippet provides the basic HTML structure, including the iframe for the SDK and a button to trigger the file retrieval. It also includes the necessary CSS for the button. ```html Get Files ``` -------------------------------- ### Start Docker Containers for PHP Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/samples/language-specific-examples/php-example.md Use the 'make compose-prod' command to start the necessary Docker containers for the PHP integration example. This command is used when setting up the example via Docker. ```bash cd "PHP Example" make compose-prod ``` -------------------------------- ### Example Usage of InstallPlugin Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/plugins/interacting-with-editors/document-api/Methods/InstallPlugin.md Demonstrates how to use the InstallPlugin method to install a plugin with a given configuration. The result of the installation is then posted back. ```javascript window.Asc.plugin.executeMethod ("InstallPlugin", [config], function (result) { postMessage (JSON.stringify (result)); }); ``` -------------------------------- ### Start Development Server Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docspace/javascript-sdk/samples/advanced-samples/create-tabbed-docspace-manager.md Run this command to start the development server for your application. Ensure you have npm installed. ```bash npm start ``` -------------------------------- ### Example Plugin Configuration Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/desktop-editors/usage-api/adding-plugins.md This JSON snippet shows an example of a config.json file for a plugin, highlighting the 'guid' parameter which is used as the folder name for manual plugin installation. ```json { "name": "Extended comments", "guid": "asc.{91EAC419-EF8B-440C-A960-B451C7DF3A37}" } ``` -------------------------------- ### Download Go Example Archive Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/samples/language-specific-examples/go-example.md Download the Go example archive using curl and unzip it to start the integration process. ```sh curl --output Go.Example.zip --location https://github.com/ONLYOFFICE/document-server-integration/releases/latest/download/Go.Example.zip unzip Go.Example.zip ``` -------------------------------- ### Download and Unzip PHP Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/samples/language-specific-examples/php-example.md Download the PHP example archive and extract its contents. This is a common first step for both Docker and local machine installations. ```bash curl --output PHP.Example.zip --location https://github.com/ONLYOFFICE/document-server-integration/releases/latest/download/PHP.Example.zip unzip PHP.Example.zip ``` -------------------------------- ### Full Example: HTML Setup and SDK Logic for Room Creation Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docspace/javascript-sdk/samples/advanced-samples/room-creation-with-folder-structure.md This comprehensive HTML and JavaScript example shows the complete setup for initializing the DocSpace SDK, handling user input for client names, and programmatically creating a room with a nested folder structure (Instructions, Price List, Contracts, Invoices) and populating specific folders with template files. It includes error handling for API calls and enables a button only after the SDK is ready. ```html Client Manager
``` -------------------------------- ### Get Arc Start Angle in Presentation Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/office-api/usage-api/presentation-api/ApiPathCommand/Methods/GetStartAngle.md Retrieves the starting angle of an arc shape within a presentation. This example demonstrates creating an arc shape with custom geometry and then extracting its start angle. ```javascript let presentation = Api.GetPresentation(); let slide = presentation.GetSlideByIndex(0); let customGeometry = Api.CreateCustomGeometry(); let path = customGeometry.AddPath(); path.SetWidth(100 * 36000); path.SetHeight(100 * 36000); path.MoveTo(0, 50 * 36000); path.CubicBezTo(0, 0, 50 * 36000, 0, 50 * 36000, 50 * 36000); path.QuadBezTo(100 * 36000, 50 * 36000, 100 * 36000, 100 * 36000); path.ArcTo(50 * 36000, 50 * 36000, 0, 10800000); path.Close(); let cmd = path.GetCommand(3); // arc command let fill = Api.CreateSolidFill(Api.RGB(100, 150, 200)); let stroke = Api.CreateStroke(36000, Api.CreateSolidFill(Api.RGB(50, 75, 100))); let shape = Api.CreateShape("star5", 100 * 36000, 100 * 36000, fill, stroke); shape.SetGeometry(customGeometry); let paragraph = shape.GetDocContent().GetElement(0); paragraph.AddText("Arc WR: " + cmd.GetWR() + ", HR: " + cmd.GetHR()); paragraph.AddText(", Start: " + cmd.GetStartAngle() + ", Sweep: " + cmd.GetSweepAngle()); shape.SetPosition(1500000, 1500000); shape.SetVerticalTextAlign("bottom"); slide.AddObject(shape); ``` -------------------------------- ### Get Polyline Start Style Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/office-api/usage-api/pdf-api/ApiPolyLineAnnotation/Methods/GetStartStyle.md Retrieves the line start style of a polyline annotation in a PDF document. This example demonstrates how to create a polyline, add it to a document, and then log its default start style. ```javascript let doc = Api.GetDocument(); let vertices = [{x: 100, y: 10}, {x: 150, y: 100}, {x: 50, y: 100}]; let polylineAnnot = Api.CreatePolyLineAnnot([40, 5, 160, 110], vertices); polylineAnnot.SetBorderColor(Api.RGB(255, 0, 0)); let page = doc.GetPage(0); page.AddObject(polylineAnnot); console.log(`Default line start style is: ${polylineAnnot.GetStartStyle()}`); ``` -------------------------------- ### Start Production Containers with Make (Docker) Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/samples/language-specific-examples/python-example.md Navigate to the example directory and use the 'make compose-prod' command to start the necessary containers for the production environment when using Docker. ```bash cd "Python Example" make compose-prod ``` -------------------------------- ### Get Arc Start Angle in Document Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/office-api/usage-api/document-api/ApiPathCommand/Methods/GetStartAngle.md Retrieves the starting angle of an arc segment within a custom shape in a document. This example demonstrates creating a custom shape with an arc and then extracting its start angle. ```javascript let doc = Api.GetDocument(); let paragraph = doc.GetElement(0); let customGeometry = Api.CreateCustomGeometry(); let path = customGeometry.AddPath(); path.SetWidth(100 * 36000); path.SetHeight(100 * 36000); path.MoveTo(0, 50 * 36000); path.CubicBezTo(0, 0, 50 * 36000, 0, 50 * 36000, 50 * 36000); path.QuadBezTo(100 * 36000, 50 * 36000, 100 * 36000, 100 * 36000); path.ArcTo(50 * 36000, 50 * 36000, 0, 10800000); path.Close(); let cmd = path.GetCommand(3); // arc command paragraph.AddText("Arc: WR=" + cmd.GetWR() + ", HR=" + cmd.GetHR()); paragraph.AddText(", Start=" + cmd.GetStartAngle() + ", Sweep=" + cmd.GetSweepAngle()); let fill = Api.CreateSolidFill(Api.RGB(255, 200, 100)); let stroke = Api.CreateStroke(36000, Api.CreateSolidFill(Api.RGB(200, 100, 0))); let shape = Api.CreateShape("rect", 80 * 36000, 80 * 36000, fill, stroke); shape.SetGeometry(customGeometry); paragraph.AddDrawing(shape); ``` -------------------------------- ### Install Python SDK using setuptools Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docspace/api-backend/get-started/sdks/python-get-started.md Install the Python SDK using setuptools. For all users, use sudo. ```bash python setup.py install --user ``` ```bash sudo python setup.py install ``` -------------------------------- ### Build and Start Docker Compose Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/samples/language-specific-examples/php-laravel-example.md Build the Docker images and start the project containers in detached mode. This command is part of the Docker-based setup for the PHP Laravel example. ```sh docker compose build && docker compose up -d ``` -------------------------------- ### Get the start page of a text range Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/office-api/usage-api/document-api/ApiRange/Methods/GetStartPage.md Determines the page number on which a selected text range begins. This example demonstrates how to find the starting page for both the first and second paragraphs in a document, illustrating the method's utility in layout analysis. ```javascript // How do I determine which page a text selection starts on in a document? // Locate the opening page of a highlighted span to understand its layout position in a document. const doc = Api.GetDocument(); const firstParagraph = doc.GetElement(0); firstParagraph.AddText('This text is on the first page.'); doc.MoveCursorToEnd(); doc.InsertBlankPage(); const secondParagraph = Api.CreateParagraph(); secondParagraph.AddText('This text is on the second page.'); doc.Push(secondParagraph); const firstRange = firstParagraph.GetRange(); const secondRange = secondParagraph.GetRange(); const resultParagraph = Api.CreateParagraph(); resultParagraph.AddText('First paragraph range starts on page: ' + firstRange.GetStartPage()); resultParagraph.AddLineBreak(); resultParagraph.AddText('Second paragraph range starts on page: ' + secondRange.GetStartPage()); doc.Push(resultParagraph); ``` -------------------------------- ### Java SDK Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docspace/api-backend/get-started/sdks/java-get-started.md This example demonstrates how to initialize the Java SDK, configure authentication, and perform basic operations like getting the user's root folder and creating a new folder. ```APIDOC ## Java SDK Usage Example This example demonstrates how to initialize the Java SDK, configure authentication, and perform basic operations like getting the user's root folder and creating a new folder. ### Description This code snippet shows how to use the `FoldersApi` from the ONLYOFFICE Java SDK to interact with folder-related functionalities. It covers setting up the API client, authenticating with an API key, retrieving the current user's root folder, and creating a new subfolder within it. ### Method This is a Java code example demonstrating SDK usage, not a direct HTTP method call. ### Endpoint This example interacts with endpoints related to folder management, such as retrieving folder content and creating folders. ### Parameters - **`defaultClient`**: The `ApiClient` instance used for all API calls. - **`setBasePath`**: Sets the base URL for the DocSpace API. - **`asc_auth_key`**: An `ApiKeyAuth` object for configuring API key authentication. - **`setApiKey`**: Sets the API key for authentication. - **`foldersApi`**: An instance of the `FoldersApi` class, which provides methods for folder operations. - **`getMyFolder`**: Retrieves the content of the current user's root folder. Parameters include `fields`, `filter`, `sort`, `limit`, `offset`, `folderId`, `includeDeleted`, and `includeFiles`. - **`myFolderId`**: The ID of the user's root folder. - **`createDto`**: A `CreateFolder` object containing the properties for the new folder, such as its title. - **`createFolder`**: Creates a new folder. Requires the parent folder ID and the `CreateFolder` DTO. ### Request Example ```java // Configuration and API client setup ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("https://your-docspace.onlyoffice.com"); // Configure API key authorization ApiKeyAuth asc_auth_key = (ApiKeyAuth) defaultClient.getAuthentication("asc_auth_key"); asc_auth_key.setApiKey("YOUR API KEY"); // Instantiate the FoldersApi FoldersApi foldersApi = new FoldersApi(defaultClient); // Get the root folder and its ID FolderContentIntegerWrapper myFolder = foldersApi.getMyFolder(null, null, null, 100, 0, null, null, null); Integer myFolderId = myFolder.getResponse().getCurrent().getId(); // Prepare data for creating a new folder CreateFolder createDto = new CreateFolder(); createDto.setTitle("TestTitle"); // Create the folder try { FolderIntegerWrapper result = foldersApi.createFolder(myFolderId, createDto); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling FoldersApi#createFolder"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } ``` ### Response #### Success Response (200) - **`FolderIntegerWrapper`**: An object containing information about the newly created folder, typically including its ID and other properties. #### Response Example ```json { "response": { "current": { "id": 123, "title": "TestTitle", "type": "folder", "size": 0, "createdAt": "2023-10-27T10:00:00Z", "updatedAt": "2023-10-27T10:00:00Z", "ownerId": 1, "ownerName": "John Doe", "versionId": null, "version": null, "isFavorite": false, "isShared": false, "isDeleted": false, "isReadOnly": false, "isOwner": true, "isSharedWithMe": false, "isCanEdit": true, "isCanDelete": true, "isCanRename": true, "isCanCopy": true, "isCanMove": true, "isCanDownload": true, "isCanUpload": true, "isCanCreateFolder": true, "isCanCreateFile": true, "isCanShare": true, "isCanUnshare": true, "isCanComment": true, "isCanView": true, "isCanEditContent": true, "isCanDeleteContent": true, "isCanRenameContent": true, "isCanCopyContent": true, "isCanMoveContent": true, "isCanDownloadContent": true, "isCanUploadContent": true, "isCanCreateFolderContent": true, "isCanCreateFileContent": true, "isCanShareContent": true, "isCanUnshareContent": true, "isCanCommentContent": true, "isCanViewContent": true, "isCanEditContent": true, "isCanDeleteContent": true, "isCanRenameContent": true, "isCanCopyContent": true, "isCanMoveContent": true, "isCanDownloadContent": true, "isCanUploadContent": true, "isCanCreateFolderContent": true, "isCanCreateFileContent": true, "isCanShareContent": true, "isCanUnshareContent": true, "isCanCommentContent": true, "isCanViewContent": true } } } ``` ### Error Handling The example includes a `try-catch` block to handle potential `ApiException` errors during the `createFolder` operation. It prints the status code, response body, and response headers of the error. ``` -------------------------------- ### Navigate to Project Directory Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/samples/language-specific-examples/go-example.md Change the current directory to the unpacked Go example project. ```sh cd "Go Example" ``` -------------------------------- ### Get Input Message for Cell Validation Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/office-api/usage-api/spreadsheet-api/ApiValidation/Methods/GetInputMessage.md Retrieves the tooltip message displayed to guide users entering data into a restricted cell in a spreadsheet. This example demonstrates how to add a validation rule and then retrieve its input message. ```javascript let worksheet = Api.GetActiveSheet(); let range = worksheet.GetRange("A1"); let validation = range.GetValidation(); validation.Add("xlValidateWholeNumber", "xlValidAlertStop", "xlGreater", 10); validation.SetInputMessage("Enter a number greater than 10"); let inputMessage = validation.GetInputMessage(); worksheet.GetRange("B1").SetValue("Input message: " + inputMessage); ``` -------------------------------- ### Build and Run Hello World on Windows Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/document-builder/samples/c-samples-guide.md Instructions for building and running the 'Hello World' C++ sample on Windows using the MSVC compiler. Ensure the 'builder' subfolder is in your PATH. ```bash # Add 'builder' subfolder to PATH (relative path) $env:PATH = "$(Get-Location)\builder;$env:PATH" # run .\hello-world.exe ``` -------------------------------- ### Minimal Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/usage-api/doceditor.md A basic example demonstrating how to initialize the DocEditor with essential configuration. ```APIDOC ## Minimal example ```ts const config = { document: { fileType: "docx", key: "Khirz6zTPdfd7", title: "Example Document Title.docx", url: "https://example.com/url-to-example-document.docx", }, documentType: "word", editorConfig: { callbackUrl: "https://example.com/url-to-callback", }, }; const docEditor = new DocsAPI.DocEditor("placeholder", config); ``` Replace `example.com` with the host of your **document storage service**. The [`callbackUrl`](./config/editor/editor.md#callbackurl) is the endpoint on your server where ONLYOFFICE Docs sends document status updates and saved files. See the [How it works](../get-started/how-it-works/how-it-works.md) section to find out more on ONLYOFFICE Docs service client-server interactions. For the complete configuration structure with all available sections and parameters, see [Configuration overview](./advanced-parameters.md). ``` -------------------------------- ### HTML Structure for Get Selection Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docspace/javascript-sdk/samples/basic-samples/get-selection.md This HTML structure sets up the basic elements for the DocSpace Embed SDK integration, including an iframe for the SDK and a button to trigger actions. Ensure the API JavaScript file path is correctly configured for your DocSpace installation. ```html Get Selection ``` -------------------------------- ### Get Checkout Setup URL Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docspace/api-backend/usage-api/get-checkout-setup-url.api.mdx Retrieves the URL to the checkout setup page. This is useful for initiating payment setup flows. ```APIDOC ## GET /api/2.0/portal/payment/chechoutsetupurl ### Description Returns the URL to the checkout setup page. ### Method GET ### Endpoint /api/2.0/portal/payment/chechoutsetupurl ### Parameters #### Query Parameters - **BackUrl** (string) - Required - The URL where the user will be redirected after completing the setup. ### Response #### Success Response (200) - **response** (string) - The URL to the checkout setup page. - **count** (integer) - The number of items returned. - **links** (array) - Links related to the response. - **href** (string) - The URL of the link. - **action** (string) - The action associated with the link. - **status** (integer) - The HTTP status code. - **statusCode** (integer) - The status code of the operation. #### Error Response - **401** - Unauthorized - **403** - No permissions to perform this action ``` -------------------------------- ### Python SDK Basic Usage Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docspace/api-backend/get-started/sdks/python-get-started.md Demonstrates how to configure the SDK, authenticate using a Bearer token, and create a folder within DocSpace. Ensure the BEARER_TOKEN environment variable is set. ```python import docspace_api_sdk from docspace_api_sdk import Configuration, ApiClient, FoldersApi from docspace_api_sdk.models.create_folder import CreateFolder from docspace_api_sdk.rest import ApiException from pprint import pprint import os # Configure Bearer authorization (JWT): Bearer configuration = docspace_api_sdk.Configuration( host = "https://your-docspace.onlyoffice.com", access_token = os.environ["BEARER_TOKEN"] ) # Enter a context with an instance of the API client with docspace_api_sdk.ApiClient(configuration) as api_client: # Create an instance of the API class folder_instance = FoldersApi(api_client) get_folder_my = folder_instance.get_my_folder() folder_my_id = get_folder_my.response.current.id folder_data = CreateFolder(title="ExampleTitle") try: # Create a folder create_folder = folder_instance.create_folder(folder_id=folder_my_id, create_folder=folder_data) print("The response of FoldersApi->create_folder:\n") pprint(create_folder) except ApiException as e: print("Exception when calling FoldersApi->create_folder: %s\n" % e) ``` -------------------------------- ### Full Example: Initialize DocSpace Manager Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docspace/javascript-sdk/samples/basic-samples/init-manager.md This complete HTML example demonstrates the setup and initialization of the DocSpace manager using the Embed SDK. It includes both the HTML structure and the JavaScript logic for configuration and event handling. ```html Init Manager ``` -------------------------------- ### Get Property using Get() Method (.NET) Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/document-builder/builder-framework/CDocBuilderValue/GetProperty.md Provides an example in .NET for getting a document property with the Get() method. Ensure the Document Builder is initialized and destroyed. ```csharp string workDirectory = "C:/Program Files/ONLYOFFICE/documentBuilder"; CDocBuilder.Initialize(workDirectory); CDocBuilder oBuilder = new CDocBuilder(); CContext oContext = oBuilder.GetContext(); CValue oGlobal = oContext.GetGlobal(); CValue oApi = oGlobal["Api"]; CValue oDocument = oApi.Call("GetDocument"); CValue oDocPr = oDocument.Get("color"); CDocBuilder.Destroy(); ``` -------------------------------- ### Get Installed Plugins Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/plugins/interacting-with-editors/document-api/Methods/GetInstalledPlugins.md Retrieves all installed plugins from the editor. The result is passed to a callback function for further processing. ```javascript window.Asc.plugin.executeMethod ("GetInstalledPlugins", null, function (result) { postMessage (JSON.stringify ({type: 'InstalledPlugins', data: result })); }); ``` -------------------------------- ### Example with Additional Arguments Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/document-builder/using-cli/command-line-arguments.md Demonstrates passing additional arguments like 'compatibility' via the command line for use within the script. ```sh docbuilder.exe "--argument={\"company\":\"ONLYOFFICE\",\"product\":\"Document Builder\",\"compatibility\":\"100%\"}" "sample_with_arguments.js" ``` ```sh documentbuilder "--argument={\"company\":\"ONLYOFFICE\",\"product\":\"Document Builder\",\"compatibility\":\"100%\"}" "sample_with_arguments.js" ``` ```sh documentbuilder "--argument={\"company\":\"ONLYOFFICE\",\"product\":\"Document Builder\",\"compatibility\":\"100%\"}" "sample_with_arguments.js" ``` -------------------------------- ### GetOutlineLvl Method Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/office-api/usage-api/pdf-api/ApiParagraph/Methods/GetOutlineLvl.md This example demonstrates how to get and set the outline level of a paragraph in a PDF document. ```APIDOC ## GetOutlineLvl ### Description Returns the outline level of the specified properties. This method is inherited from ApiParaPr.GetOutlineLvl. ### Method This documentation describes a method, not an HTTP endpoint. The method is called as part of an object-oriented API. ### Endpoint N/A (Object-oriented API method) ### Parameters This method does not take any direct parameters. It operates on an instance of a paragraph's properties (ParaPr). ### Request Example ```javascript // Get the nesting level used in document outline in a PDF. const doc = Api.GetDocument(); const page = doc.GetPage(0); const rgb = Api.CreateRGBColor(50, 100, 150); const fill = Api.CreateSolidFill(rgb); const stroke = Api.CreateStroke(0, Api.CreateNoFill()); const shape = Api.CreateShape('rect', 200 * 36000, 50 * 36000, fill, stroke); shape.SetPosition(10 * 36000, 10 * 36000); page.AddObject(shape); const content = shape.GetContent(); const paragraph = content.GetElement(0); const paraPr = paragraph.GetParaPr(); const levelBefore = paraPr.GetOutlineLvl(); paraPr.SetOutlineLvl(8); const levelAfter = paraPr.GetOutlineLvl(); let text = 'Outline level (index) for this paragraph is currently set to ' + levelAfter; text += ', '; text += 'but originally was set to ' + levelBefore; paragraph.AddText(text); ``` ### Response #### Success Response The method returns an integer representing the outline level of the paragraph. #### Response Example ```json { "outlineLevel": 8 } ``` ``` -------------------------------- ### Build and Run Hello World on Linux Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/document-builder/samples/c-samples-guide.md Instructions for building and running the 'Hello World' C++ sample on Linux using g++. This includes setting the rpath for dynamic library loading. ```bash g++ hello-world.cpp \ -Ibuilder/opt/onlyoffice/documentbuilder/include \ -Lbuilder/opt/onlyoffice/documentbuilder \ -lDocxRenderer \ -ldoctrenderer \ -lstdc++ -lpthread -lm -lc \ -Wl,-rpath=builder/opt/onlyoffice/documentbuilder \ -o hello-world ./hello-world ``` -------------------------------- ### GetIndRight Method Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/office-api/usage-api/spreadsheet-api/ApiParagraph/Methods/GetIndRight.md This example demonstrates how to get the right-side indentation of a paragraph in a spreadsheet using the GetIndRight method. ```APIDOC ## GetIndRight ### Description Returns the paragraph right side indentation. ### Method This is a method of the `ApiParaPr` object. ### Endpoint N/A (SDK Method) ### Parameters This method does not take any parameters. ### Response #### Success Response - **indRight** (number) - The right-side indentation value of the paragraph. ### Request Example ```javascript // How do I check how far a paragraph is pushed in from the right margin in a spreadsheet? // Inspect the right margin offset of a paragraph to verify its horizontal boundary in a spreadsheet. let worksheet = Api.GetActiveSheet(); let fill = Api.CreateSolidFill(Api.RGB(255, 111, 61)); let stroke = Api.CreateStroke(0, Api.CreateNoFill()); let shape = worksheet.AddShape("flowChartOnlineStorage", 120 * 36000, 70 * 36000, fill, stroke, 0, 2 * 36000, 0, 3 * 36000); let content = shape.GetContent(); let paragraph = content.GetElement(0); let paraPr = paragraph.GetParaPr(); paraPr.SetIndRight(2880); paraPr.SetJc("right"); paragraph.AddText("This is the first paragraph with the right offset of 2 inches set to it. "); paragraph.AddText("This indent is set by the paragraph style. No paragraph inline style is applied. "); let indRight = paraPr.GetIndRight(); paragraph = Api.CreateParagraph(); paragraph.AddText("Right indent: " + indRight); content.Push(paragraph); ``` ### Response Example ```json { "indRight": 2880 } ``` ``` -------------------------------- ### Configure C++ (Qt) Sample Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/document-builder/get-started/installing.md Generate Qt project files for C++ samples. ```shell python3 configure/configure.py --qt --test cpp ``` -------------------------------- ### GetStartPageNumber Example - Document API Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/office-api/usage-api/document-api/ApiSection/Methods/GetStartPageNumber.md This example demonstrates how to find out which page number a section starts on in a document using the Document API. It also shows how to set the start page number and add page numbers to headers and footers. ```javascript // How do I find out which page number a section begins on in a document? // Check where a section's page numbering starts within a document. let doc = Api.GetDocument(); let paragraph = doc.GetElement(0); let section = paragraph.GetSection(); section.SetStartPageNumber(5); let startPageNumber = section.GetStartPageNumber(); paragraph.AddText("The start page number for this section is: " + startPageNumber); let header = section.GetHeader("default", true); paragraph = header.GetElement(0); paragraph.AddText("Page #"); paragraph.AddPageNumber(); let footer = section.GetFooter("default", true); paragraph = footer.GetElement(0); paragraph.AddText("Page #"); paragraph.AddPageNumber(); ``` -------------------------------- ### Example: Enable a tool from unspecified toolset Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docspace/mcp-server/reference/tools-resolution.md Demonstrates enabling a specific tool ('create_folder') while keeping the 'files' toolset active. The result shows the 'files' toolset with its original tools and the 'folders' toolset with only the enabled 'create_folder' tool. ```text Configuration: | Key | Value | | ------------- | --------------- | | Toolsets | `files` | | Enabled Tools | `create_folder` | Result: | Toolset | Tools | | --------- | ---------------------------------------- | | `files` | `create_file`, `get_file`, `delete_file` | | `folders` | `create_folder` | ``` -------------------------------- ### GetScopeType Method Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/office-api/usage-api/spreadsheet-api/ApiAboveAverage/Methods/GetScopeType.md This example demonstrates how to get the scope type of a conditional formatting rule applied to a range of cells. ```APIDOC ## GetScopeType ### Description Returns the scope type of the conditional formatting rule. This method is inherited from `ApiFormatCondition.GetScopeType`. ### Method This is a method call within the API. ### Endpoint N/A (SDK Method) ### Parameters This method does not take any parameters. ### Request Example ```javascript // How do I find out whether a formatting rule targets cells, a table, or a pivot table in a spreadsheet? // Determine the coverage area defined for a conditional formatting rule in a spreadsheet. let worksheet = Api.GetActiveSheet(); worksheet.GetRange("A1").SetValue("Sales Data"); worksheet.GetRange("A2").SetValue(100); worksheet.GetRange("A3").SetValue(250); worksheet.GetRange("A4").SetValue(150); worksheet.GetRange("A5").SetValue(300); worksheet.GetRange("A6").SetValue(75); let dataRange = worksheet.GetRange("A2:A6"); let formatConditions = dataRange.GetFormatConditions(); let condition1 = formatConditions.Add("xlCellValue", "xlGreater", "200"); condition1.SetFillColor(Api.CreateColorFromRGB(255, 0, 0)); let scopeType = condition1.GetScopeType(); worksheet.GetRange("C1").SetValue("Scope type:"); worksheet.GetRange("C2").SetValue(scopeType); ``` ### Response #### Success Response The method returns the scope type of the conditional formatting rule. The exact return type and possible values depend on the API implementation (e.g., string representing 'cells', 'table', 'pivot table'). #### Response Example ```json { "scopeType": "cells" } ``` ``` -------------------------------- ### Run Document Builder with .NET Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/document-builder/builder-framework/CDocBuilder/Run.md This .NET example shows how to initialize the Document Builder, run a script, and then destroy the builder instance. Specify the correct work directory during initialization. ```cs string workDirectory = "C:/Program Files/ONLYOFFICE/documentBuilder"; CDocBuilder.Initialize(workDirectory); CDocBuilder oBuilder = new CDocBuilder(); oBuilder.Run("path-to-script.js"); CDocBuilder.Destroy(); ``` -------------------------------- ### GetWrapperShape Method Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/office-api/usage-api/document-api/ApiDateForm/Methods/GetWrapperShape.md This example demonstrates how to get the wrapper shape of a text form field and apply a custom outline to it. ```APIDOC ## GetWrapperShape ### Description Returns a shape in which the form is placed to control the position and size of the fixed size form frame. The null value will be returned for the inline forms. ### Method `GetWrapperShape()` ### Parameters None ### Returns - `ApiShape` - The wrapper shape of the form field, or null if it's an inline form. ### Example ```javascript // Access the container shape that holds a fixed-size form field to control its frame in a document. // Apply a custom outline to the wrapper shape of a form field to make it stand out visually in a document. let doc = Api.GetDocument(); let textForm = Api.CreateTextForm({"key": "Personal information", "tip": "Enter your first name", "required": true, "placeholder": "First name", "comb": true, "maxCharacters": 10, "cellWidth": 3, "multiLine": false, "autoFit": false}); let paragraph = doc.GetElement(0); paragraph.AddElement(textForm); textForm.ToFixed(10 * 240, 2 * 240); let shape = textForm.GetWrapperShape(); let stroke = Api.CreateStroke(36000, Api.CreateSolidFill(Api.RGB(255, 111, 61))); shape.SetOutLine(stroke); ``` ``` -------------------------------- ### CheckFileInfo Request Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/using-wopi/wopi-rest-api/checkfileinfo.md This is an example of a GET request to the CheckFileInfo endpoint. It includes the file ID and an access token for authorization. ```http GET /wopi/files/5d911024a033772100000001?access_token=1234567890abcdef HTTP/1.1 Host: X-WOPI-SessionContext: ``` -------------------------------- ### Access Example in Browser Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/samples/language-specific-examples/nodejs-example.md Open your web browser and navigate to the specified local address to view the running Node.js example. ```sh http://localhost:3000 ``` -------------------------------- ### Plugin Autostart Example Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/usage-api/config/editor/plugins.md Specify plugin identifiers to automatically start when the editor opens. Plugins run sequentially in the order listed. ```json ["asc.{7327FC95-16DA-41D9-9AF2-0E7F449F6800}"] ``` -------------------------------- ### Get Document Category in Spreadsheet Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/office-api/usage-api/spreadsheet-api/ApiCore/Methods/GetCategory.md Retrieves the category assigned to a workbook in a spreadsheet. This example demonstrates how to set and then get the category. ```javascript const worksheet = Api.GetActiveSheet(); const core = Api.GetCore(); core.SetCategory("Examples"); const category = core.GetCategory(); let fill = Api.CreateSolidFill(Api.RGB(100, 50, 200)); let stroke = Api.CreateStroke(0, Api.CreateNoFill()); const shape = worksheet.AddShape( "rect", 100 * 36000, 100 * 36000, fill, stroke, 0, 0, 3, 0 ); let paragraph = shape.GetContent().GetElement(0); paragraph.AddText("Category: " + category); ``` -------------------------------- ### Example Plugin Name and Localization Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/plugins/configuration/configuration.md Demonstrates how to define a plugin's name and its localized versions. ```json { "variations": [ { "name": "plugin name", "nameLocale": { "fr": "french plugin name", "es": "spanish plugin name" } } ] } ``` -------------------------------- ### Incorrect GUID Format Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/plugins/development-workflow/publishing/preparing-for-release.md Demonstrates an incorrect format for the plugin's GUID, which must start with 'asc.' followed by a UUID. ```json { "guid": "my-plugin-guid" } ``` -------------------------------- ### Full Example: Initialize Room Selector Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docspace/javascript-sdk/samples/basic-samples/init-room-selector.md This is a complete HTML example demonstrating how to embed the room selection interface. It includes the necessary HTML structure and the JavaScript logic for initializing the SDK and handling events. ```html Init Room Selector ``` -------------------------------- ### Get Arc Start Angle in PDF Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/office-api/usage-api/pdf-api/ApiPathCommand/Methods/GetStartAngle.md This snippet demonstrates how to create an arc shape in a PDF and then retrieve its starting angle using the GetStartAngle method. It also shows how to get other arc properties like WR, HR, and Sweep Angle. ```javascript const doc = Api.GetDocument(); const page = doc.GetPage(0); let customGeometry = Api.CreateCustomGeometry(); let path = customGeometry.AddPath(); path.SetWidth(100 * 36000); path.SetHeight(100 * 36000); path.MoveTo(0, 50 * 36000); path.CubicBezTo(0, 0, 50 * 36000, 0, 50 * 36000, 50 * 36000); path.QuadBezTo(100 * 36000, 50 * 36000, 100 * 36000, 100 * 36000); path.ArcTo(50 * 36000, 50 * 36000, 0, 10800000); path.Close(); let cmd = path.GetCommand(3); // arc command let fill = Api.CreateSolidFill(Api.RGB(100, 150, 200)); let stroke = Api.CreateStroke(36000, Api.CreateSolidFill(Api.RGB(50, 75, 100))); let shape = Api.CreateShape("star5", 100 * 36000, 100 * 36000, fill, stroke); shape.SetGeometry(customGeometry); let paragraph = shape.GetContent().GetElement(0); paragraph.AddText("Arc WR: " + cmd.GetWR() + ", HR: " + cmd.GetHR()); paragraph.AddText(", Start: " + cmd.GetStartAngle() + ", Sweep: " + cmd.GetSweepAngle()); shape.SetPosition(1500000, 1500000); shape.SetVerticalTextAlign("bottom"); page.AddObject(shape); ``` -------------------------------- ### Start Development Server Source: https://github.com/onlyoffice/api.onlyoffice.com/blob/master/site/docs/docs-api/get-started/frontend-frameworks/react.md Run the React application using the npm start command to view the editor. ```sh npm run start ```