Office API samples
The following examples will show you how to use ONLYOFFICE Office API to create and edit different types of documents.
Text document editor
Adding text watermark
Create a document with a "Confidential" text watermark for marking document confidentiality level. The watermark appears in the background as semi-transparent text and is applied to reports, contracts, and internal memos:
Adding image watermark
Create a document with an image watermark with custom settings:
Creating event invitation
Create a custom-sized event invitation document with specific page dimensions and content:
Creating formal document
Create a document following the structure of a formal paper:
Creating landscape document
Create a document with landscape page orientation for displaying wide tables, charts, or content that requires more horizontal space:
Creating report document
Create reports on all the comments added to the document and on every change which was made to the document in the review mode:
Creating table document
Create a document with a styled table filled with array-based values:
Creating two-column text document
Create a document with text arranged in two columns. This layout is commonly used in instructions, brochures, articles, and official publications to present text compactly on one page, improving readability and visual balance.
Inserting text into a document
Create a document with formatted text using different methods:
Spreadsheet editor
Commenting spreadsheet errors
This script checks all used cells for formula errors like "#DIV/0!" and comments each error:
Creating spreadsheet chart
Creates a custom chart filled with array-based values in the spreadsheet:
Filling spreadsheet
Fill an empty spreadsheet with the data stored in arrays:
Presentation editor
Creating chart presentation
Create a chart presentation:
Creating presentation
Create a presentation on a specific topic:
PDF editor
Creating advanced form
Create an advanced form with a table structure:
Creating basic form
Create a basic form with the image and text inputs:
Filling form
Fill a form with the data stored in the object: