diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 475f76051..c9a975366 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -7,16 +7,20 @@ on: jobs: audit: - runs-on: ubuntu-latest + strategy: + matrix: + os: + - ubuntu-latest + # - windows-latest + + runs-on: ${{matrix.os}} + steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Setup mise uses: jdx/mise-action@v2 - env: - MISE_HTTP_TIMEOUT: 120s - MISE_VERBOSE: true - name: Install Dependencies run: pnpm install --frozen-lockfile diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7f16d7efe..15b9310d6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,9 +30,6 @@ jobs: - name: Setup mise uses: jdx/mise-action@v2 - env: - MISE_HTTP_TIMEOUT: 120s - MISE_VERBOSE: true - name: Install Dependencies run: pnpm install --frozen-lockfile diff --git a/CHANGELOG.md b/CHANGELOG.md index 90d98b6c5..7983806d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## 6.3.0 +- docspace oauth api: added a new section +- docspace api backend: v3.0 +- docspace api-system: auto creation +- docspace api-system: v3.0 +- docs api: restructured Conversion API +- docs api: added the mobileView actions to the WOPI discovery +- docs api: restructured the Get Started section +- docs api: the editorConfig.customization.mobileForceView parameter is deprecated, please use the editorConfig.customization.mobile parameter instead +- docbuilder: redesign sections +- docbuilder: updated builder framework samples + ## 6.2.0 - docspace js sdk: storybook link - docspace js sdk: added samples @@ -21,6 +33,7 @@ - method redesign - 404 page - legacy version link +- macros: added add comments and change cell colors in spreadsheet macro sample ## 6.1.0 - docspace js sdk: react component diff --git a/makefile.ts b/makefile.ts index 659781c48..bc7b50c8b 100644 --- a/makefile.ts +++ b/makefile.ts @@ -43,10 +43,70 @@ function main(): void { for (const n of p._) { // todo: this is a temporary solution to run only verified tests. if ( - n !== "signature" && - n !== "service-declaration" && - n !== "openapi-declaration" && - n !== "svg-preact" + n === "async-transform" || + n === "caller-position" || + n === "combobox-container-html-element" || + n === "command" || + n === "console" || + n === "document-builder-hast-element" || + n === "document-editor-code-sample" || + n === "document-editor-hast-element" || + n === "document-server-utils" || + n === "eleventy-clean" || + n === "eleventy-env" || + n === "eleventy-esbuild" || + n === "eleventy-html-minifier-terser" || + n === "eleventy-lightningcss" || + n === "eleventy-pagefind" || + n === "eleventy-starry-night" || + n === "eslint-config" || + n === "jq" || + n === "library-signature" || + n === "node-path" || + n === "preact-elements" || + n === "preact-slots" || + n === "preact-template" || + n === "rehype-clean" || + n === "remark-config" || + n === "remark-lint-eslint" || + n === "server-client" || + n === "service-resource" || + n === "site-article" || + n === "site-chapter" || + n === "site-config-fixtures" || + n === "site-config" || + n === "site-content" || + n === "site-document-editor-playground" || + n === "site-env" || + n === "site-footer" || + n === "site-glossary" || + n === "site-header" || + n === "site-home" || + n === "site-kit" || + n === "site-library" || + n === "site-logo" || + n === "site-menubar" || + n === "site-page" || + n === "site-part" || + n === "site-search" || + n === "site-service" || + n === "site-signature" || + n === "site-status" || + n === "site-toc" || + n === "strings" || + n === "stylelint-config" || + n === "svg-library" || + n === "ui-badge-group" || + n === "ui-badge" || + n === "ui-breadcrumb" || + n === "ui-button" || + n === "ui-content" || + n === "ui-form-control" || + n === "ui-kit" || + n === "ui-pictures" || + n === "ui-primitives" || + n === "ui-select" || + n === "ui-text-input" ) { continue } diff --git a/mise.lock b/mise.lock new file mode 100644 index 000000000..962c9ad4b --- /dev/null +++ b/mise.lock @@ -0,0 +1,3 @@ +[tools] +node = "21.7.3" +pnpm = "9.13.2" diff --git a/.mise.toml b/mise.toml similarity index 80% rename from .mise.toml rename to mise.toml index 992013053..19ae11374 100644 --- a/.mise.toml +++ b/mise.toml @@ -1,3 +1,7 @@ +[settings] +lockfile = true +experimental = true + [tools] node = "prefix:21" pnpm = "prefix:9" diff --git a/packages/docspace-resource/lib/main.ts b/packages/docspace-resource/lib/main.ts index 7e3e037f5..5c2ac86b3 100644 --- a/packages/docspace-resource/lib/main.ts +++ b/packages/docspace-resource/lib/main.ts @@ -7,13 +7,23 @@ import {type Config, build, download} from "@onlyoffice/openapi-resource" import pack from "../package.json" with {type: "json"} const config: Config[] = [ + { + name: "apisystem", + variant: "master", + source: { + owner: "onlyoffice", + repo: "docspace-declarations", + reference: "release/v3.0.0", + path: "asc.apisystem.swagger.json", + }, + }, { name: "data", variant: "master", source: { owner: "onlyoffice", repo: "docspace-declarations", - reference: "dist", + reference: "release/v3.0.0", path: "asc.data.backup.swagger.json", }, }, @@ -23,7 +33,7 @@ const config: Config[] = [ source: { owner: "onlyoffice", repo: "docspace-declarations", - reference: "dist", + reference: "release/v3.0.0", path: "asc.files.swagger.json", }, }, @@ -33,7 +43,7 @@ const config: Config[] = [ source: { owner: "onlyoffice", repo: "docspace-declarations", - reference: "dist", + reference: "release/v3.0.0", path: "asc.people.swagger.json", }, }, @@ -43,7 +53,7 @@ const config: Config[] = [ source: { owner: "onlyoffice", repo: "docspace-declarations", - reference: "dist", + reference: "release/v3.0.0", path: "asc.web.api.swagger.json", }, }, diff --git a/packages/document-builder-html-element/lib/element.ts b/packages/document-builder-html-element/lib/element.ts index 30d9b1dc1..41f4cd9f1 100644 --- a/packages/document-builder-html-element/lib/element.ts +++ b/packages/document-builder-html-element/lib/element.ts @@ -78,6 +78,11 @@ export class DocumentBuilder extends DocumentEditor { return this.#connector } + constructor() { + super() + this.eventList.add("documenteditordocumentready") + } + connectedCallback(): void { super.connectedCallback() this.#listen() diff --git a/packages/document-editor-html-element/lib/element.ts b/packages/document-editor-html-element/lib/element.ts index 704d27977..c6938ef11 100644 --- a/packages/document-editor-html-element/lib/element.ts +++ b/packages/document-editor-html-element/lib/element.ts @@ -1,9 +1,16 @@ /* eslint-disable @typescript-eslint/no-implied-eval, no-new-func */ /* eslint @stylistic/max-len: ["error", {code: 140}] */ +// todo: replace uniqueString with something else +// todo: rewrite this using the https://github.com/vanyauhalin/some-container-html-element-template/ +// todo: remove the on* listeners (from properties) on disconnect? (need to research) +// todo: complete the implementation of the DocumentEditorEventList class to fit the DOMTokenList interface +// todo: add the event attribute similar to the class attribute (continuation of the previous todo) + import { type DocEditor, type DocEditorConfig, + type DocEditorConfigEvents, type DocEditorConfigurableOptions, } from "@onlyoffice/document-server-types" import { @@ -237,6 +244,12 @@ export class DocumentEditor extends HTMLElement { this.#config = c } + #eventList = new DocumentEditorEventList() + + get eventList(): DocumentEditorEventList { + return this.#eventList + } + #editor: DocEditor | null = null get editor(): DocEditor | null { @@ -1079,145 +1092,250 @@ export class DocumentEditor extends HTMLElement { throw new Error("The attribute 'config' is required, but it is missing") } - return { + const c: DocEditorConfig = { ...structuredClone(this.#config), - events: { - onAppReady: () => { - const e = new DocumentEditorAppReadyEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onCollaborativeChanges: () => { - const e = new DocumentEditorCollaborativeChangesEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onDocumentReady: () => { - const e = new DocumentEditorDocumentReadyEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onDocumentStateChange: (ev) => { - const e = new DocumentEditorDocumentStateChangeEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onDownloadAs: (ev) => { - const e = new DocumentEditorDownloadAsEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onError: (ev) => { - const er = new Error(`${ev.data.errorDescription} (${ev.data.errorCode})`) - const e = new DocumentEditorErrorEvent({...ev, bubbles: true, error: er, message: er.message}) - this.dispatchEvent(e) - }, - onInfo: (ev) => { - const e = new DocumentEditorInfoEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onMakeActionLink: (ev) => { - const e = new DocumentEditorMakeActionLinkEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onMetaChange: (ev) => { - const e = new DocumentEditorMetaChangeEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onOutdatedVersion: () => { - const e = new DocumentEditorOutdatedVersionEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onPluginsReady: () => { - const e = new DocumentEditorPluginsReadyEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onReady: () => { - const e = new DocumentEditorReadyEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onRequestClose: () => { - const e = new DocumentEditorRequestCloseEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onRequestCompareFile: () => { - const e = new DocumentEditorRequestCompareFileEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onRequestCreateNew: () => { - const e = new DocumentEditorRequestCreateNewEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onRequestEditRights: () => { - const e = new DocumentEditorRequestEditRightsEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onRequestHistory: () => { - const e = new DocumentEditorRequestHistoryEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onRequestHistoryClose: () => { - const e = new DocumentEditorRequestHistoryCloseEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onRequestHistoryData: (ev) => { - const e = new DocumentEditorRequestHistoryDataEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onRequestInsertImage: (ev) => { - const e = new DocumentEditorRequestInsertImageEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onRequestMailMergeRecipients: () => { - const e = new DocumentEditorRequestMailMergeRecipientsEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onRequestOpen: (ev) => { - const e = new DocumentEditorRequestOpenEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onRequestReferenceData: (ev) => { - const e = new DocumentEditorRequestReferenceDataEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onRequestReferenceSource: (ev) => { - const e = new DocumentEditorRequestReferenceSourceEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onRequestRename: (ev) => { - const e = new DocumentEditorRequestRenameEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onRequestRestore: (ev) => { - const e = new DocumentEditorRequestRestoreEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onRequestSaveAs: (ev) => { - const e = new DocumentEditorRequestSaveAsEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onRequestSelectDocument: (ev) => { - const e = new DocumentEditorRequestSelectDocumentEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onRequestSelectSpreadsheet: (ev) => { - const e = new DocumentEditorRequestSelectSpreadsheetEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onRequestSendNotify: (ev) => { - const e = new DocumentEditorRequestSendNotifyEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onRequestSharingSettings: () => { - const e = new DocumentEditorRequestSharingSettingsEvent({bubbles: true}) - this.dispatchEvent(e) - }, - onRequestUsers: (ev) => { - const e = new DocumentEditorRequestUsersEvent({...ev, bubbles: true}) - this.dispatchEvent(e) - }, - onWarning: (ev) => { - const er = new Error(`${ev.data.warningDescription} (${ev.data.warningCode})`) - const e = new DocumentEditorWarningEvent({...ev, bubbles: true, error: er, message: er.message}) - this.dispatchEvent(e) - }, - }, } + + const e: DocEditorConfigEvents = {} + + if (this.#eventList.contains("documenteditorappready")) { + e.onAppReady = () => { + const e = new DocumentEditorAppReadyEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorcollaborativechanges")) { + e.onCollaborativeChanges = () => { + const e = new DocumentEditorCollaborativeChangesEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditordocumentready")) { + e.onDocumentReady = () => { + const e = new DocumentEditorDocumentReadyEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditordocumentstatechange")) { + e.onDocumentStateChange = (ev) => { + const e = new DocumentEditorDocumentStateChangeEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditordownloadas")) { + e.onDownloadAs = (ev) => { + const e = new DocumentEditorDownloadAsEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorerror")) { + e.onError = (ev) => { + const er = new Error(`${ev.data.errorDescription} (${ev.data.errorCode})`) + const e = new DocumentEditorErrorEvent({...ev, bubbles: true, error: er, message: er.message}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorinfo")) { + e.onInfo = (ev) => { + const e = new DocumentEditorInfoEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditormakeactionlink")) { + e.onMakeActionLink = (ev) => { + const e = new DocumentEditorMakeActionLinkEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditormetachange")) { + e.onMetaChange = (ev) => { + const e = new DocumentEditorMetaChangeEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditoroutdatedversion")) { + e.onOutdatedVersion = () => { + const e = new DocumentEditorOutdatedVersionEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorpluginsready")) { + e.onPluginsReady = () => { + const e = new DocumentEditorPluginsReadyEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorready")) { + e.onReady = () => { + const e = new DocumentEditorReadyEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestclose")) { + e.onRequestClose = () => { + const e = new DocumentEditorRequestCloseEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestcomparefile")) { + e.onRequestCompareFile = () => { + const e = new DocumentEditorRequestCompareFileEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestcreatenew")) { + e.onRequestCreateNew = () => { + const e = new DocumentEditorRequestCreateNewEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequesteditrights")) { + e.onRequestEditRights = () => { + const e = new DocumentEditorRequestEditRightsEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequesthistory")) { + e.onRequestHistory = () => { + const e = new DocumentEditorRequestHistoryEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequesthistoryclose")) { + e.onRequestHistoryClose = () => { + const e = new DocumentEditorRequestHistoryCloseEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequesthistorydata")) { + e.onRequestHistoryData = (ev) => { + const e = new DocumentEditorRequestHistoryDataEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestinsertimage")) { + e.onRequestInsertImage = (ev) => { + const e = new DocumentEditorRequestInsertImageEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestmailmergerecipients")) { + e.onRequestMailMergeRecipients = () => { + const e = new DocumentEditorRequestMailMergeRecipientsEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestopen")) { + e.onRequestOpen = (ev) => { + const e = new DocumentEditorRequestOpenEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestreferencedata")) { + e.onRequestReferenceData = (ev) => { + const e = new DocumentEditorRequestReferenceDataEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestreferencesource")) { + e.onRequestReferenceSource = (ev) => { + const e = new DocumentEditorRequestReferenceSourceEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestrename")) { + e.onRequestRename = (ev) => { + const e = new DocumentEditorRequestRenameEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestrestore")) { + e.onRequestRestore = (ev) => { + const e = new DocumentEditorRequestRestoreEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestsaveas")) { + e.onRequestSaveAs = (ev) => { + const e = new DocumentEditorRequestSaveAsEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestselectdocument")) { + e.onRequestSelectDocument = (ev) => { + const e = new DocumentEditorRequestSelectDocumentEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestselectspreadsheet")) { + e.onRequestSelectSpreadsheet = (ev) => { + const e = new DocumentEditorRequestSelectSpreadsheetEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestsendnotify")) { + e.onRequestSendNotify = (ev) => { + const e = new DocumentEditorRequestSendNotifyEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestsharingsettings")) { + e.onRequestSharingSettings = () => { + const e = new DocumentEditorRequestSharingSettingsEvent({bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorrequestusers")) { + e.onRequestUsers = (ev) => { + const e = new DocumentEditorRequestUsersEvent({...ev, bubbles: true}) + this.dispatchEvent(e) + } + } + + if (this.#eventList.contains("documenteditorwarning")) { + e.onWarning = (ev) => { + const er = new Error(`${ev.data.warningDescription} (${ev.data.warningCode})`) + const e = new DocumentEditorWarningEvent({...ev, bubbles: true, error: er, message: er.message}) + this.dispatchEvent(e) + } + } + + if (Object.keys(e).length !== 0) { + c.events = e + } + + return c } #unmount(): void { @@ -1232,3 +1350,23 @@ export class DocumentEditor extends HTMLElement { this.#editor = window.DocsAPI.DocEditor(p.id, c) } } + +export class DocumentEditorEventList { + #s = new Set() + + add(...a: DocumentEditorEventType[]): void { + for (const e of a) { + this.#s.add(e) + } + } + + contains(e: DocumentEditorEventType): boolean { + return this.#s.has(e) + } + + remove(...a: DocumentEditorEventType[]): void { + for (const e of a) { + this.#s.delete(e) + } + } +} diff --git a/packages/document-server-utils/lib/main.ts b/packages/document-server-utils/lib/main.ts index 4213f25f4..f839f1a06 100644 --- a/packages/document-server-utils/lib/main.ts +++ b/packages/document-server-utils/lib/main.ts @@ -38,6 +38,14 @@ export function mergeConfig( c.document = b.document } + if (a.documentType && b.documentType) { + c.documentType = b.documentType + } else if (a.documentType) { + c.documentType = a.documentType + } else if (b.documentType) { + c.documentType = b.documentType + } + if (a.editorConfig && b.editorConfig) { c.editorConfig = mergeConfigEditorConfig(a.editorConfig, b.editorConfig) } else if (a.editorConfig) { diff --git a/packages/eslint-config/lib/main.ts b/packages/eslint-config/lib/main.ts index e88c25c32..84b338f7d 100644 --- a/packages/eslint-config/lib/main.ts +++ b/packages/eslint-config/lib/main.ts @@ -69,7 +69,6 @@ const c: Config = [ rules: { "array-callback-return": e, - "arrow-body-style": [e, "always"], "camelcase": e, "constructor-super": e, "curly": [e, "all"], @@ -616,19 +615,6 @@ const c: Config = [ }, }, - { - name: "jsx/exceptions", - - files: [ - "*.tsx", - "**/*.tsx", - ], - - rules: { - "arrow-body-style": [e, "as-needed"], - }, - }, - // @ts-ignore the source configs are not typed eslintOnlyoffice.configs["sort-package-json"], // @ts-ignore the source configs are not typed @@ -697,6 +683,20 @@ const c: Config = [ }, }, + { + name: "json5", + + files: [ + "*.json5", + "**/*.json5", + ], + + rules: { + "jsonc/comma-dangle": [e, "always-multiline"], + "jsonc/quote-props": [e, "consistent"], + }, + }, + { // Based on https://github.com/ota-meshi/eslint-plugin-yml/blob/v1.14.0/src/configs/base.ts name: "yaml", @@ -846,6 +846,23 @@ const c: Config = [ "unicorn/filename-case": "off", }, }, + + { + name: "markdown/jsonc", + + files: [ + "*.md/*.json", + "*.md/*.json5", + "*.md/*.jsonc", + "**/*.md/*.json", + "**/*.md/*.json5", + "**/*.md/*.jsonc", + ], + + rules: { + "jsonc/object-property-newline": "off", + }, + }, ] export class ESLint extends ES { diff --git a/packages/glossary-hastscript/lib/main.test.ts b/packages/glossary-hastscript/lib/main.test.ts new file mode 100644 index 000000000..b97c65a7c --- /dev/null +++ b/packages/glossary-hastscript/lib/main.test.ts @@ -0,0 +1,106 @@ +import {type Component, h, render} from "@onlyoffice/hastscript" +import {test} from "uvu" +import {equal as eq} from "uvu/assert" +import { + Glossary, + GlossaryDetails, + GlossaryName, + GlossaryTail, + GlossaryTerm, +} from "./main.ts" + +test("GlossaryDetails(): creates a glossary details", () => { + const a = h(GlossaryDetails) + const e = h("dd", {class: "glossary__details"}) + re(a, e) +}) + +test("GlossaryDetails(): creates a glossary details with properties", () => { + const a = h(GlossaryDetails, {id: "d", class: "c"}) + const e = h("dd", {class: "glossary__details c", id: "d"}) + re(a, e) +}) + +test("GlossaryDetails(): creates a glossary details with children", () => { + const a = h(GlossaryDetails, ["c"]) + const e = h("dd", {class: "glossary__details"}, ["c"]) + re(a, e) +}) + +test("GlossaryTail(): creates a glossary tail", () => { + const a = h(GlossaryTail) + const e = h("span", {class: "glossary__tail"}) + re(a, e) +}) + +test("GlossaryTail(): creates a glossary tail with properties", () => { + const a = h(GlossaryTail, {id: "d", class: "c"}) + const e = h("span", {class: "glossary__tail c", id: "d"}) + re(a, e) +}) + +test("GlossaryTail(): creates a glossary tail with children", () => { + const a = h(GlossaryTail, ["c"]) + const e = h("span", {class: "glossary__tail"}, ["c"]) + re(a, e) +}) + +test("GlossaryName(): creates a glossary name", () => { + const a = h(GlossaryName) + const e = h("span", {class: "glossary__name"}) + re(a, e) +}) + +test("GlossaryName(): creates a glossary name with properties", () => { + const a = h(GlossaryName, {id: "d", class: "c"}) + const e = h("span", {class: "glossary__name c", id: "d"}) + re(a, e) +}) + +test("GlossaryName(): creates a glossary name with children", () => { + const a = h(GlossaryName, ["c"]) + const e = h("span", {class: "glossary__name"}, ["c"]) + re(a, e) +}) + +test("GlossaryTerm(): creates a glossary term", () => { + const a = h(GlossaryTerm) + const e = h("dt", {class: "glossary__term"}) + re(a, e) +}) + +test("GlossaryTerm(): creates a glossary term with properties", () => { + const a = h(GlossaryTerm, {id: "d", class: "c"}) + const e = h("dt", {class: "glossary__term c", id: "d"}) + re(a, e) +}) + +test("GlossaryTerm(): creates a glossary term with children", () => { + const a = h(GlossaryTerm, ["c"]) + const e = h("dt", {class: "glossary__term"}, ["c"]) + re(a, e) +}) + +test("Glossary(): creates a glossary", () => { + const a = h(Glossary) + const e = h("dl", {class: "glossary"}) + re(a, e) +}) + +test("Glossary(): creates a glossary with properties", () => { + const a = h(Glossary, {id: "d", class: "c"}) + const e = h("dl", {class: "glossary c", id: "d"}) + re(a, e) +}) + +test("Glossary(): creates a glossary with children", () => { + const a = h(Glossary, ["c"]) + const e = h("dl", {class: "glossary"}, ["c"]) + re(a, e) +}) + +test.run() + +function re(a: Component, e: Component): void { + eq(render(a), render(e)) +} diff --git a/packages/glossary-hastscript/lib/main.ts b/packages/glossary-hastscript/lib/main.ts new file mode 100644 index 000000000..a403d9815 --- /dev/null +++ b/packages/glossary-hastscript/lib/main.ts @@ -0,0 +1,33 @@ +import {type Children, type Component, h} from "@onlyoffice/hastscript" +import type * as E from "@onlyoffice/hastscript/elements.ts" +import {clsx} from "clsx" + +export function Glossary(p: E.DlProperties, ch: Children): Component { + const {...o} = p + o.class = clsx("glossary", o.class) + return h("dl", o, ch) +} + +export function GlossaryTerm(p: E.DtProperties, ch: Children): Component { + const {...o} = p + o.class = clsx("glossary__term", o.class) + return h("dt", o, ch) +} + +export function GlossaryName(p: E.SpanProperties, ch: Children): Component { + const {...o} = p + o.class = clsx("glossary__name", o.class) + return h("span", o, ch) +} + +export function GlossaryTail(p: E.SpanProperties, ch: Children): Component { + const {...o} = p + o.class = clsx("glossary__tail", o.class) + return h("span", o, ch) +} + +export function GlossaryDetails(p: E.DdProperties, ch: Children): Component { + const {...o} = p + o.class = clsx("glossary__details", o.class) + return h("dd", o, ch) +} diff --git a/packages/glossary-hastscript/package.json b/packages/glossary-hastscript/package.json new file mode 100644 index 000000000..e468cc56d --- /dev/null +++ b/packages/glossary-hastscript/package.json @@ -0,0 +1,23 @@ +{ + "name": "@onlyoffice/glossary-hastscript", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@onlyoffice/hastscript": "workspace:^", + "clsx": "2.1.0", + "typescript": "5.4.5" + }, + "devDependencies": { + "c8": "9.1.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "uvu": "0.5.6" + } +} diff --git a/packages/keyed-json/tsconfig.json b/packages/glossary-hastscript/tsconfig.json similarity index 100% rename from packages/keyed-json/tsconfig.json rename to packages/glossary-hastscript/tsconfig.json diff --git a/packages/hast-util-is-element/lib/main.test.ts b/packages/hast-util-is-element/lib/main.test.ts new file mode 100644 index 000000000..3a0de4be2 --- /dev/null +++ b/packages/hast-util-is-element/lib/main.test.ts @@ -0,0 +1,68 @@ +import {type Component, h, render} from "@onlyoffice/hastscript" +import {test} from "uvu" +import {is} from "uvu/assert" +import { + isAElement, + isButtonElement, + isCodeElement, + isDdElement, + isDivElement, + isDlElement, + isDtElement, + isFooterElement, + isH2Element, + isHeaderElement, + isLiElement, + isNavElement, + isPElement, + isPreElement, + isSpanElement, + isTemplateElement, + isUlElement, +} from "./main.ts" + +interface Is { + (u: unknown): boolean +} + +const pairs: [Is, Component][] = [ + [isAElement, h("a")], + [isButtonElement, h("button")], + [isCodeElement, h("code")], + [isDdElement, h("dd")], + [isDivElement, h("div")], + [isDlElement, h("dl")], + [isDtElement, h("dt")], + [isFooterElement, h("footer")], + [isH2Element, h("h2")], + [isHeaderElement, h("header")], + [isLiElement, h("li")], + [isNavElement, h("nav")], + [isPElement, h("p")], + [isPreElement, h("pre")], + [isSpanElement, h("span")], + [isTemplateElement, h("template")], + [isUlElement, h("ul")], +] + +for (const [xi, xe] of pairs) { + test(`${xi.name}(): returns true for the '${xe.source}' source`, () => { + const r = render(xe) + const a = xi(r) + is(a, true) + }) + + for (const [yi, ye] of pairs) { + if (xi === yi) { + continue + } + + test(`${xi.name}(): returns false for the '${ye.source}' source`, () => { + const r = render(ye) + const a = xi(r) + is(a, false) + }) + } +} + +test.run() diff --git a/packages/hast-util-is-element/lib/main.ts b/packages/hast-util-is-element/lib/main.ts new file mode 100644 index 000000000..5d315a6ff --- /dev/null +++ b/packages/hast-util-is-element/lib/main.ts @@ -0,0 +1,85 @@ +// This package is a simplified version of the [hast-util-is-element] package. +// +// hast-util-is-element: https://github.com/syntax-tree/hast-util-is-element/ + +import type * as E from "@onlyoffice/hastscript/elements.ts" +import {type Element} from "hast" + +export function isAElement(u: unknown): u is E.AElement { + return isElement(u) && u.tagName === "a" +} + +export function isButtonElement(u: unknown): u is E.ButtonElement { + return isElement(u) && u.tagName === "button" +} + +export function isCodeElement(u: unknown): u is E.CodeElement { + return isElement(u) && u.tagName === "code" +} + +export function isDdElement(u: unknown): u is E.DdElement { + return isElement(u) && u.tagName === "dd" +} + +export function isDivElement(u: unknown): u is E.DivElement { + return isElement(u) && u.tagName === "div" +} + +export function isDlElement(u: unknown): u is E.DlElement { + return isElement(u) && u.tagName === "dl" +} + +export function isDtElement(u: unknown): u is E.DtElement { + return isElement(u) && u.tagName === "dt" +} + +export function isFooterElement(u: unknown): u is E.FooterElement { + return isElement(u) && u.tagName === "footer" +} + +export function isH2Element(u: unknown): u is E.H2Element { + return isElement(u) && u.tagName === "h2" +} + +export function isHeaderElement(u: unknown): u is E.HeaderElement { + return isElement(u) && u.tagName === "header" +} + +export function isLiElement(u: unknown): u is E.LiElement { + return isElement(u) && u.tagName === "li" +} + +export function isNavElement(u: unknown): u is E.NavElement { + return isElement(u) && u.tagName === "nav" +} + +export function isPElement(u: unknown): u is E.PElement { + return isElement(u) && u.tagName === "p" +} + +export function isPreElement(u: unknown): u is E.PreElement { + return isElement(u) && u.tagName === "pre" +} + +export function isSpanElement(u: unknown): u is E.SpanElement { + return isElement(u) && u.tagName === "span" +} + +export function isTemplateElement(u: unknown): u is E.TemplateElement { + return isElement(u) && u.tagName === "template" +} + +export function isUlElement(u: unknown): u is E.UlElement { + return isElement(u) && u.tagName === "ul" +} + +export function isElement(u: unknown): u is Element { + return Boolean( + u && + typeof u === "object" && + "type" in u && + u.type === "element" && + "tagName" in u && + typeof u.tagName === "string", + ) +} diff --git a/packages/hast-util-is-element/package.json b/packages/hast-util-is-element/package.json new file mode 100644 index 000000000..1cc7c9ec5 --- /dev/null +++ b/packages/hast-util-is-element/package.json @@ -0,0 +1,23 @@ +{ + "name": "@onlyoffice/hast-util-is-element", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@onlyoffice/hastscript": "workspace:^", + "@types/hast": "3.0.4", + "typescript": "5.4.5" + }, + "devDependencies": { + "c8": "9.1.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "uvu": "0.5.6" + } +} diff --git a/packages/markdown/tsconfig.json b/packages/hast-util-is-element/tsconfig.json similarity index 100% rename from packages/markdown/tsconfig.json rename to packages/hast-util-is-element/tsconfig.json diff --git a/packages/hast-util-is-text/lib/main.test.ts b/packages/hast-util-is-text/lib/main.test.ts new file mode 100644 index 000000000..552db69b9 --- /dev/null +++ b/packages/hast-util-is-text/lib/main.test.ts @@ -0,0 +1,32 @@ +import {type Text} from "hast" +import {test} from "uvu" +import {is} from "uvu/assert" +import {isNewlineText} from "./main.ts" + +interface Is { + (u: unknown): boolean +} + +const pairs: [Is, Text][] = [ + [isNewlineText, {type: "text", value: "\n"}], +] + +for (const [xi, xt] of pairs) { + test(`${xi.name}(): returns true for the '${xt.value}' value`, () => { + const a = xi(xt) + is(a, true) + }) + + for (const [yi, yt] of pairs) { + if (xi === yi) { + continue + } + + test(`${xi.name}(): returns false for the '${yt.value}' value`, () => { + const a = xi(xt) + is(a, false) + }) + } +} + +test.run() diff --git a/packages/hast-util-is-text/lib/main.ts b/packages/hast-util-is-text/lib/main.ts new file mode 100644 index 000000000..162459518 --- /dev/null +++ b/packages/hast-util-is-text/lib/main.ts @@ -0,0 +1,17 @@ +import type * as T from "@onlyoffice/hastscript/texts.ts" +import {type Text} from "hast" + +export function isNewlineText(u: unknown): u is T.NewlineText { + return isText(u) && u.value === "\n" +} + +export function isText(u: unknown): u is Text { + return Boolean( + u && + typeof u === "object" && + "type" in u && + u.type === "text" && + "value" in u && + typeof u.value === "string", + ) +} diff --git a/packages/hast-util-is-text/package.json b/packages/hast-util-is-text/package.json new file mode 100644 index 000000000..d553c961a --- /dev/null +++ b/packages/hast-util-is-text/package.json @@ -0,0 +1,23 @@ +{ + "name": "@onlyoffice/hast-util-is-text", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@onlyoffice/hastscript": "workspace:^", + "@types/hast": "3.0.4", + "typescript": "5.4.5" + }, + "devDependencies": { + "c8": "9.1.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "uvu": "0.5.6" + } +} diff --git a/packages/hast-util-is-text/tsconfig.json b/packages/hast-util-is-text/tsconfig.json new file mode 100644 index 000000000..f0d8cf437 --- /dev/null +++ b/packages/hast-util-is-text/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib"] +} diff --git a/packages/hastscript/lib/builder.test.ts b/packages/hastscript/lib/builder.test.ts new file mode 100644 index 000000000..5b2109b4c --- /dev/null +++ b/packages/hastscript/lib/builder.test.ts @@ -0,0 +1,7 @@ +import {test} from "uvu" +import {is} from "uvu/assert" +import * as _ from "./builder.ts" + +test("satisfies c8", () => { + is(typeof _, "object") +}) diff --git a/packages/hastscript/lib/builder.ts b/packages/hastscript/lib/builder.ts new file mode 100644 index 000000000..c0a96f9ee --- /dev/null +++ b/packages/hastscript/lib/builder.ts @@ -0,0 +1,15 @@ +export { + type Child, + type Children, + type Component, + type ComponentSource, + Fragment, + type FragmentSource, + type PrimitiveChild, + type PrimitiveSource, + type Source, + Spacer, + h, + isComponent, + render, +} from "./internal/builder.ts" diff --git a/packages/hastscript/lib/context.test.ts b/packages/hastscript/lib/context.test.ts new file mode 100644 index 000000000..4834d79e2 --- /dev/null +++ b/packages/hastscript/lib/context.test.ts @@ -0,0 +1,11 @@ +import {test} from "uvu" +import {is} from "uvu/assert" +import * as ctx from "./context.ts" + +test("satisfies c8", () => { + const c = ctx.createContext("") + const v = ctx.useContext(c) + is(typeof ctx, "object") + is(typeof c, "object") + is(typeof v, "string") +}) diff --git a/packages/hastscript/lib/context.ts b/packages/hastscript/lib/context.ts new file mode 100644 index 000000000..7bd8b72fe --- /dev/null +++ b/packages/hastscript/lib/context.ts @@ -0,0 +1,16 @@ +import {type Children, type Component} from "./builder.ts" +import * as internal from "./internal/context.ts" + +export {type ProviderProperties} from "./internal/context.ts" + +export interface Context { + Provider(this: void, p: internal.ProviderProperties, ch: Children): Component +} + +export function createContext(v: V): Context { + return internal.createContext(v) +} + +export function useContext(c: Context): V { + return internal.useContext(c as internal.Context) +} diff --git a/packages/hastscript/lib/elements.test.ts b/packages/hastscript/lib/elements.test.ts new file mode 100644 index 000000000..7fb021aa6 --- /dev/null +++ b/packages/hastscript/lib/elements.test.ts @@ -0,0 +1,7 @@ +import {test} from "uvu" +import {is} from "uvu/assert" +import * as _ from "./elements.ts" + +test("satisfies c8", () => { + is(typeof _, "object") +}) diff --git a/packages/hastscript/lib/elements.ts b/packages/hastscript/lib/elements.ts new file mode 100644 index 000000000..4bb7c85f4 --- /dev/null +++ b/packages/hastscript/lib/elements.ts @@ -0,0 +1,64 @@ +import {type Element as HastElement} from "hast" +import {type JSX} from "preact" + +export type AElement = Element<"a"> +export type AProperties = ElementProperties<"a"> + +export type ButtonElement = Element<"button"> +export type ButtonProperties = ElementProperties<"button"> + +export type CodeElement = Element<"code"> +export type CodeProperties = ElementProperties<"code"> + +export type DdElement = Element<"dd"> +export type DdProperties = ElementProperties<"dd"> + +export type DivElement = Element<"div"> +export type DivProperties = ElementProperties<"div"> + +export type DlElement = Element<"dl"> +export type DlProperties = ElementProperties<"dl"> + +export type DtElement = Element<"dt"> +export type DtProperties = ElementProperties<"dt"> + +export type FooterElement = Element<"footer"> +export type FooterProperties = ElementProperties<"footer"> + +export type H2Element = Element<"h2"> +export type H2Properties = ElementProperties<"h2"> + +export type HeaderElement = Element<"header"> +export type HeaderProperties = ElementProperties<"header"> + +export type LiElement = Element<"li"> +export type LiProperties = ElementProperties<"li"> + +export type NavElement = Element<"nav"> +export type NavProperties = ElementProperties<"nav"> + +export type PElement = Element<"p"> +export type PProperties = ElementProperties<"p"> + +export type PreElement = Element<"pre"> +export type PreProperties = ElementProperties<"pre"> + +export type SpanElement = Element<"span"> +export type SpanProperties = ElementProperties<"span"> + +export type TemplateElement = Element<"template"> +export type TemplateProperties = ElementProperties<"template"> + +export type UlElement = Element<"ul"> +export type UlProperties = ElementProperties<"ul"> + +export type ElementProperties + = Omit & ElementAdditionalProperties + +export interface ElementAdditionalProperties { + // asChild?: boolean +} + +export interface Element extends HastElement { + tagName: E +} diff --git a/packages/hastscript/lib/internal/builder.test.ts b/packages/hastscript/lib/internal/builder.test.ts new file mode 100644 index 000000000..0fd8b1efa --- /dev/null +++ b/packages/hastscript/lib/internal/builder.test.ts @@ -0,0 +1,440 @@ +import {h} from "hastscript" +import {test} from "uvu" +import {equal as eq} from "uvu/assert" +import { + type Children, + type Component, + Fragment as F, + Spacer as S, + c, + isComponent, + h as j, + render, +} from "./builder.ts" + +test("isComponent(): returns true for a component with a primitive source", () => { + const d = c("div", {}, []) + const a = isComponent(d) + eq(a, true) +}) + +test("isComponent(): returns true for a component with a component source", () => { + const d = c(D, {}, []) + const a = isComponent(d) + eq(a, true) +}) + +test("Fragment(): creates a root unist node", () => { + // eslint-disable-next-line new-cap + const a = F({}, []) + const e = c("root", {}, []) + eq(a, e) +}) + +test("Fragment(): ignores properties", () => { + // eslint-disable-next-line new-cap + const a = F({id: "f"}, []) + const e = c("root", {}, []) + eq(a, e) +}) + +test("Fragment(): creates a root node with children", () => { + // eslint-disable-next-line new-cap + const a = F({}, [j("div")]) + const e = c("root", {}, [c("div", {}, [])]) + eq(a, e) +}) + +test("h(): creates a div component by default", () => { + // @ts-ignore the error is valid, the signature is not + const a = j() + const e = c("div", {}, []) + eq(a, e) +}) + +test("h(): creates a component with a primitive source", () => { + const a = j("div") + const e = c("div", {}, []) + eq(a, e) +}) + +test("h(): creates a component with a primitive source and empty properties", () => { + const a = j("div", {}) + const e = c("div", {}, []) + eq(a, e) +}) + +test("h(): creates a component with a primitive source and empty children", () => { + const a = j("div", []) + const e = c("div", {}, []) + eq(a, e) +}) + +test("h(): creates a component with a primitive source, empty properties, and empty children", () => { + const a = j("div", {}, []) + const e = c("div", {}, []) + eq(a, e) +}) + +test("h(): creates a component with a primitive source and non-empty properties", () => { + const a = j("div", {id: "d"}) + const e = c("div", {id: "d"}, []) + eq(a, e) +}) + +test("h(): creates a component with a primitive source, non-empty properties, and empty children", () => { + const a = j("div", {id: "d"}, []) + const e = c("div", {id: "d"}, []) + eq(a, e) +}) + +test("h(): creates a component with a primitive source and non-empty children", () => { + const a = j("div", [j("span")]) + const e = c("div", {}, [c("span", {}, [])]) + eq(a, e) +}) + +test("h(): creates a component with a primitive source, empty properties, and non-empty children", () => { + const a = j("div", {}, [j("span")]) + const e = c("div", {}, [c("span", {}, [])]) + eq(a, e) +}) + +test("h(): creates a component with a primitive source, non-empty properties, and non-empty children", () => { + const a = j("div", {id: "d"}, [j("span")]) + const e = c("div", {id: "d"}, [c("span", {}, [])]) + eq(a, e) +}) + +test("h(): creates a component with a component source", () => { + const a = j(D) + const e = c(D, {}, []) + eq(a, e) +}) + +test("h(): creates a component with a component source and empty properties", () => { + const a = j(D, {}) + const e = c(D, {}, []) + eq(a, e) +}) + +test("h(): creates a component with a component source and empty children", () => { + const a = j(D, []) + const e = c(D, {}, []) + eq(a, e) +}) + +test("h(): creates a component with a component source, empty properties, and empty children", () => { + const a = j(D, {}, []) + const e = c(D, {}, []) + eq(a, e) +}) + +test("h(): creates a component with a component source and non-empty properties", () => { + const a = j(D, {id: "d"}) + const e = c(D, {id: "d"}, []) + eq(a, e) +}) + +test("h(): creates a component with a component source, non-empty properties, and empty children", () => { + const a = j(D, {id: "d"}, []) + const e = c(D, {id: "d"}, []) + eq(a, e) +}) + +test("h(): creates a component with a component source and non-empty children", () => { + const a = j(D, [j("span")]) + const e = c(D, {}, [c("span", {}, [])]) + eq(a, e) +}) + +test("h(): creates a component with a component source, empty properties, and non-empty children", () => { + const a = j(D, {}, [j("span")]) + const e = c(D, {}, [c("span", {}, [])]) + eq(a, e) +}) + +test("h(): creates a component with a component source, non-empty properties, and non-empty children", () => { + const a = j(D, {id: "d"}, [j("span")]) + const e = c(D, {id: "d"}, [c("span", {}, [])]) + eq(a, e) +}) + +test("h(): creates a component with a primitive child", () => { + const a = j("div", ["s"]) + const e = c("div", {}, ["s"]) + eq(a, e) +}) + +test("h(): creates a component with a component child", () => { + const a = j("div", [j("span")]) + const e = c("div", {}, [c("span", {}, [])]) + eq(a, e) +}) + +test("h(): creates a component with an element child", () => { + const a = j("div", [h("span")]) + const e = c("div", {}, [h("span")]) + eq(a, e) +}) + +test("h(): passes empty properties to the component source by default", () => { + const a = j(D) + const e = c(D, {}, []) + eq(a, e) + + function D(p: object): Component { + eq(p, {}) + return c("div", p, []) + } +}) + +test("h(): passes empty children to the component source by default", () => { + const a = j(D) + const e = c(D, {}, []) + eq(a, e) + + function D(_: object, ch: Children): Component { + eq(ch, []) + return c("div", {}, ch) + } +}) + +test("h(): passes the properties to the component source", () => { + const a = j(D, {id: "d"}) + const e = c(D, {id: "d"}, []) + eq(a, e) + + function D(p: object): Component { + eq(p, {id: "d"}) + return c("div", p, []) + } +}) + +test("h(): passes the children to the component source", () => { + const a = j(D, [j("span")]) + const e = c(D, {}, [c("span", {}, [])]) + eq(a, e) + + function D(_: object, ch: Children): Component { + eq(ch, [c("span", {}, [])]) + return c("div", {}, ch) + } +}) + +test("h(): passes the properties and children to the component source", () => { + const a = j(D, {id: "d"}, [j("span")]) + const e = c(D, {id: "d"}, [c("span", {}, [])]) + eq(a, e) + + function D(p: object, ch: Children): Component { + eq(p, {id: "d"}) + eq(ch, [c("span", {}, [])]) + return c("div", p, ch) + } +}) + +test("Spacer(): creates a spacer component", () => { + // eslint-disable-next-line new-cap + const a = S({}, []) + const e = c(F, {}, ["\n", "\n"]) + eq(a, e) +}) + +test("Spacer(): ignores properties", () => { + // eslint-disable-next-line new-cap + const a = S({id: "s"}, []) + const e = c(F, {}, ["\n", "\n"]) + eq(a, e) +}) + +test("Spacer(): ignores children", () => { + // eslint-disable-next-line new-cap + const a = S({}, [j("div")]) + const e = c(F, {}, ["\n", c("div", {}, []), "\n"]) + eq(a, e) +}) + +test("render(): renders a component with a primitive source", () => { + const a = j("div") + const e = h("div") + re(a, e) +}) + +test("render(): renders a component with a primitive source and empty properties", () => { + const a = j("div", {}) + const e = h("div") + re(a, e) +}) + +test("render(): renders a component with a primitive source and empty children", () => { + const a = j("div", []) + const e = h("div") + re(a, e) +}) + +test("render(): renders a component with a primitive source, empty properties, and empty children", () => { + const a = j("div", {}, []) + const e = h("div") + re(a, e) +}) + +test("render(): renders a component with a primitive source and non-empty properties", () => { + const a = j("div", {id: "d"}) + const e = h("div", {id: "d"}) + re(a, e) +}) + +test("render(): renders a component with a primitive source, non-empty properties, and empty children", () => { + const a = j("div", {id: "d"}, []) + const e = h("div", {id: "d"}) + re(a, e) +}) + +test("render(): renders a component with a primitive source and non-empty children", () => { + const a = j("div", [j("span")]) + const e = h("div", {}, [h("span")]) + re(a, e) +}) + +test("render(): renders a component with a primitive source, empty properties, and non-empty children", () => { + const a = j("div", {}, [j("span")]) + const e = h("div", {}, [h("span")]) + re(a, e) +}) + +test("render(): renders a component with a primitive source, non-empty properties, and non-empty children", () => { + const a = j("div", {id: "d"}, [j("span")]) + const e = h("div", {id: "d"}, [h("span")]) + re(a, e) +}) + +test("render(): renders a component with a component source", () => { + const a = j(D) + const e = h("div") + re(a, e) +}) + +test("render(): renders a component with a component source and empty properties", () => { + const a = j(D, {}) + const e = h("div") + re(a, e) +}) + +test("render(): renders a component with a component source and empty children", () => { + const a = j(D, []) + const e = h("div") + re(a, e) +}) + +test("render(): renders a component with a component source, empty properties, and empty children", () => { + const a = j(D, {}, []) + const e = h("div") + re(a, e) +}) + +test("render(): renders a component with a component source and non-empty properties", () => { + const a = j(D, {id: "d"}) + const e = h("div", {id: "d"}) + re(a, e) +}) + +test("render(): renders a component with a component source, non-empty properties, and empty children", () => { + const a = j(D, {id: "d"}, []) + const e = h("div", {id: "d"}) + re(a, e) +}) + +test("render(): renders a component with a component source and non-empty children", () => { + const a = j(D, [j("span")]) + const e = h("div", {}, [h("span")]) + re(a, e) +}) + +test("render(): renders a component with a component source, empty properties, and non-empty children", () => { + const a = j(D, {}, [j("span")]) + const e = h("div", {}, [h("span")]) + re(a, e) +}) + +test("render(): renders a component with a component source, non-empty properties, and non-empty children", () => { + const a = j(D, {id: "d"}, [j("span")]) + const e = h("div", {id: "d"}, [h("span")]) + re(a, e) +}) + +test("render(): omits an undefined child", () => { + const a = j("div", [undefined]) + const e = h("div") + re(a, e) +}) + +test("render(): omits a null child", () => { + const a = j("div", [null]) + const e = h("div") + re(a, e) +}) + +test("render(): omits a true child", () => { + const a = j("div", [true]) + const e = h("div") + re(a, e) +}) + +test("render(): omits a false child", () => { + const a = j("div", [false]) + const e = h("div") + re(a, e) +}) + +test("render(): renders a component with a number child", () => { + const a = j("div", [1]) + const e = h("div", ["1"]) + re(a, e) +}) + +test("render(): renders a component with a string child", () => { + const a = j("div", ["s"]) + const e = h("div", ["s"]) + re(a, e) +}) + +test("render(): renders a component with a component child", () => { + const a = j("div", [j("span")]) + const e = h("div", [h("span")]) + re(a, e) +}) + +test("render(): renders a component with an element child", () => { + const a = j("div", [h("span")]) + const e = h("div", [h("span")]) + re(a, e) +}) + +test("render(): omits fragments but preserves their children", () => { + const a = j("div", [j(F, [j("span"), j(F, [j("span", [j(F)]), j(F)])])]) + const e = h("div", [h("span"), h("span")]) + re(a, e) +}) + +test("render(): omits fragments and selects a child if there is only one", () => { + const a = j(F, [j(F), j(F, [j("div")]), j(F)]) + const e = h("div") + re(a, e) +}) + +test("render(): preserves a root unist node if there is more than one child", () => { + const a = j(F, [j(F), j(F, [j("div"), j("div")]), j(F)]) + const e = {type: "root", children: [h("div"), h("div")]} + re(a, e) +}) + +test.run() + +function D(p: object, ch: Children): Component { + return c("div", p, ch) +} + +function re(a: Component, e: unknown): void { + eq(render(a), e) +} diff --git a/packages/hastscript/lib/internal/builder.ts b/packages/hastscript/lib/internal/builder.ts new file mode 100644 index 000000000..4affd2f58 --- /dev/null +++ b/packages/hastscript/lib/internal/builder.ts @@ -0,0 +1,211 @@ +// todo: This package works well but requires a few improvements: +// +// 1. Remove the any type in the h function parameters. +// 2. Allow calling the h function without parameters (?). +// 3. Disallow calling the h function with a non-array children parameter. +// 4. Pass properties and children to the component source as a single object, +// with children having their own property. + +import {type ElementContent, type Text} from "hast" +import {type Properties, h as html} from "hastscript" +import {type JSX} from "preact" +import {type Node as UnistNode} from "unist" +import {u} from "unist-builder" +import {type ElementProperties} from "../elements.ts" + +export function render(c: Component): ElementContent { + const f = u("root", []) + addComponent(f.children, c) + + if (f.children.length === 1) { + return f.children[0] + } + + // This is not correct in terms of typing. However, hast ignores the root + // unist node while processing the tree. Therefore, it should be safe enough. + // @ts-ignore above + return f +} + +function addComponent(a: ElementContent[], c: Component): void { + if (typeof c.source === "string") { + const e = html(c.source, c.properties as Properties, []) + for (const d of c.children) { + addChild(e.children, d) + } + a.push(e) + return + } + + if (typeof c.source === "function" && c.source === Fragment) { + for (const d of c.children) { + addChild(a, d) + } + return + } + + if (typeof c.source === "function") { + const t = c.source(c.properties, c.children) + addComponent(a, t) + } +} + +function addChild(a: ElementContent[], c: Child): void { + // Use the hastscript behavior for adding a child. + // https://github.com/syntax-tree/hastscript/blob/8.0.0/lib/create-h.js/#L253 + + if (c === undefined || c === null) { + return + } + + // Hastscript does not work with boolean values, however, it is beneficial to + // handle them in order to support the following syntax: + // + // h("div", [ + // false && h("div"), + // ]) + + if (typeof c === "boolean") { + return + } + + if (typeof c === "number") { + const t: Text = {type: "text", value: String(c)} + a.push(t) + return + } + + if (typeof c === "string") { + const t: Text = {type: "text", value: c} + a.push(t) + return + } + + if (isComponent(c)) { + addComponent(a, c) + return + } + + a.push(c) +} + +export function Spacer(_: object, ch: Children): Component { + return h(Fragment, ["\n", ...ch, "\n"]) +} + +export function h< + // It is quite difficult to remove the any. + /* eslint-disable @typescript-eslint/no-explicit-any */ + E extends PrimitiveSource | ComponentSource, + C = E extends ComponentSource> + ? Children + : Children, + P = E extends PrimitiveSource + ? ElementProperties | C + : E extends ComponentSource + ? Parameters[0] | C + : never, +>( + e: E, + pOrCh?: P, + ch?: C, + /* eslint-enable @typescript-eslint/no-explicit-any */ +): Component { + // h(tag, properties, children) + if (typeof e === "string" && isObject(pOrCh) && Array.isArray(ch)) { + return c(e, pOrCh, ch) + } + + // h(tag, properties) + if (typeof e === "string" && isObject(pOrCh)) { + return c(e, pOrCh, []) + } + + // h(tag, children) + if (typeof e === "string" && Array.isArray(pOrCh)) { + return c(e, {}, pOrCh) + } + + // h(tag) + if (typeof e === "string") { + return c(e, {}, []) + } + + // h(component, properties, children) + if (typeof e === "function" && isObject(pOrCh) && Array.isArray(ch)) { + return c(e, pOrCh, ch) + } + + // h(component, properties) + if (typeof e === "function" && isObject(pOrCh)) { + return c(e, pOrCh, []) + } + + // h(component, children) + if (typeof e === "function" && Array.isArray(pOrCh)) { + return c(e, {}, pOrCh) + } + + // h(component) + if (typeof e === "function") { + return c(e, {}, []) + } + + // Use a div element by default to match the hastscript behavior. + // https://github.com/syntax-tree/hastscript/blob/8.0.0/lib/index.js/#L32 + return c("div", {}, []) +} + +export function Fragment(_: object, ch: Children): Component { + return c("root", {}, ch) +} + +export function isComponent(u: unknown): u is Component { + return Boolean( + isObject(u) && + "type" in u && + u.type === "component" && + "source" in u && + (typeof u.source === "string" || typeof u.source === "function") && + "properties" in u && + isObject(u.properties) && + "children" in u && + Array.isArray(u.children), + ) +} + +export interface Component extends UnistNode { + type: "component" + source: Source + properties: object + children: Children +} + +export type Source = FragmentSource | PrimitiveSource | ComponentSource + +export type FragmentSource = "root" + +export type PrimitiveSource = keyof JSX.IntrinsicElements + +export interface ComponentSource

{ + (this: void, p: P, ch: C): Component +} + +export type Children = C[] + +export type Child = PrimitiveChild | Component | ElementContent + +export type PrimitiveChild = boolean | null | number | string | undefined + +export function c(s: Source, p: object, ch: Children): Component { + return { + type: "component", + source: s, + properties: p, + children: ch, + } +} + +function isObject(u: unknown): u is object { + return typeof u === "object" && u !== null && !Array.isArray(u) +} diff --git a/packages/hastscript/lib/internal/context.test.ts b/packages/hastscript/lib/internal/context.test.ts new file mode 100644 index 000000000..d0c45c051 --- /dev/null +++ b/packages/hastscript/lib/internal/context.test.ts @@ -0,0 +1,77 @@ +import {h} from "hastscript" +import {test} from "uvu" +import {equal as eq, is} from "uvu/assert" +import {type Component, h as j, render} from "./builder.ts" +import {createContext, useContext} from "./context.ts" + +test("createContext(): creates a new context", () => { + const c = createContext("") + is(typeof c.id, "string") + is(c.dv, "") + is(typeof c.Provider, "function") + is(typeof c.Destroyer, "function") +}) + +test("createContext(): creates a new context with unique id", () => { + const a = createContext("") + const b = createContext("") + is(a.id !== b.id, true) +}) + +test("Provider(): renders children", () => { + const c = createContext("") + const a = j(c.Provider, {value: "a"}, [j("div")]) + const e = h("div") + re(a, e) +}) + +test("Provider(): includes a destroyer", () => { + const c = createContext("") + // eslint-disable-next-line new-cap + const t = c.Provider({value: ""}, []) + const [a] = t.children + const e = j(c.Destroyer) + eq(a, e) +}) + +test("Destroyer(): destroys the context", () => { + const c = createContext("") + const t = j(c.Provider, {value: "a"}, [j(c.Destroyer), j(C)]) + render(t) + + function C(): Component { + const v = useContext(c) + is(v, "") + return j("div") + } +}) + +test("useContext(): uses a context with a default value", () => { + const c = createContext("a") + const t = j(c.Provider, [j(C)]) + render(t) + + function C(): Component { + const v = useContext(c) + is(v, "a") + return j("div") + } +}) + +test("useContext(): uses a context with a custom value", () => { + const c = createContext("a") + const t = j(c.Provider, {value: "b"}, [j(C)]) + render(t) + + function C(): Component { + const v = useContext(c) + is(v, "b") + return j("div") + } +}) + +test.run() + +function re(a: Component, e: unknown): void { + eq(render(a), e) +} diff --git a/packages/hastscript/lib/internal/context.ts b/packages/hastscript/lib/internal/context.ts new file mode 100644 index 000000000..84d8100ce --- /dev/null +++ b/packages/hastscript/lib/internal/context.ts @@ -0,0 +1,53 @@ +import {type Children, type Component, Fragment as F, h} from "../builder.ts" + +class State { + static shared = new State() + r: Record = {} + i = 0 +} + +export interface ProviderProperties { + value: V +} + +export interface Context { + id: string + dv: V + Provider(this: void, p: ProviderProperties, ch: Children): Component + Destroyer(this: void): Component +} + +export function useContext(c: Context): V { + const m = State.shared + const v = m.r[c.id] + if (v === undefined && !(c.id in m.r)) { + return c.dv + } + return v as V +} + +export function createContext(v: V): Context { + const m = State.shared + m.i += 1 + + const c: Context = { + id: `__cC${m.i}`, + dv: v, + Provider(this: void, p: ProviderProperties, ch: Children): Component { + const m = State.shared + if (!(c.id in m.r) && p.value !== undefined) { + m.r[c.id] = p.value + } + return h(F, [...ch, h(c.Destroyer)]) + }, + Destroyer(this: void): Component { + const m = State.shared + if (c.id in m.r) { + delete m.r[c.id] + } + return h(F) + }, + } + + return c +} diff --git a/packages/hastscript/lib/main.test.ts b/packages/hastscript/lib/main.test.ts new file mode 100644 index 000000000..13bbb0ef6 --- /dev/null +++ b/packages/hastscript/lib/main.test.ts @@ -0,0 +1,7 @@ +import {test} from "uvu" +import {is} from "uvu/assert" +import * as _ from "./main.ts" + +test("satisfies c8", () => { + is(typeof _, "object") +}) diff --git a/packages/hastscript/lib/main.ts b/packages/hastscript/lib/main.ts new file mode 100644 index 000000000..987a6c83f --- /dev/null +++ b/packages/hastscript/lib/main.ts @@ -0,0 +1,4 @@ +export * from "./builder.ts" +export * from "./context.ts" +export * from "./elements.ts" +export * from "./texts.ts" diff --git a/packages/hastscript/lib/texts.test.ts b/packages/hastscript/lib/texts.test.ts new file mode 100644 index 000000000..f089200c1 --- /dev/null +++ b/packages/hastscript/lib/texts.test.ts @@ -0,0 +1,7 @@ +import {test} from "uvu" +import {is} from "uvu/assert" +import * as _ from "./texts.ts" + +test("satisfies c8", () => { + is(typeof _, "object") +}) diff --git a/packages/hastscript/lib/texts.ts b/packages/hastscript/lib/texts.ts new file mode 100644 index 000000000..80997ddb8 --- /dev/null +++ b/packages/hastscript/lib/texts.ts @@ -0,0 +1,11 @@ +import {type Text as HastText} from "hast" + +export interface TextParis { + "\n": "newline" +} + +export type NewlineText = Text<"\n"> + +export interface Text extends HastText { + value: V +} diff --git a/packages/hastscript/package.json b/packages/hastscript/package.json new file mode 100644 index 000000000..14cc9f9a8 --- /dev/null +++ b/packages/hastscript/package.json @@ -0,0 +1,33 @@ +{ + "name": "@onlyoffice/hastscript", + "type": "module", + "private": true, + "exports": { + ".": "./lib/main.ts", + "./builder.ts": "./lib/builder.ts", + "./context.ts": "./lib/context.ts", + "./elements.ts": "./lib/elements.ts", + "./texts.ts": "./lib/texts.ts" + }, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@types/hast": "3.0.4", + "@types/unist": "3.0.3", + "hastscript": "8.0.0", + "preact": "10.22.0", + "typescript": "5.4.5", + "unist-builder": "4.0.0" + }, + "devDependencies": { + "c8": "9.1.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "uvu": "0.5.6" + } +} diff --git a/packages/hastscript/tsconfig.json b/packages/hastscript/tsconfig.json new file mode 100644 index 000000000..f0d8cf437 --- /dev/null +++ b/packages/hastscript/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib"] +} diff --git a/packages/jsdoc-declaration/lib/main.ts b/packages/jsdoc-declaration/lib/main.ts index 78705f4a9..22f50b78f 100644 --- a/packages/jsdoc-declaration/lib/main.ts +++ b/packages/jsdoc-declaration/lib/main.ts @@ -14,7 +14,8 @@ import type * as Library from "@onlyoffice/library-declaration" // eslint-disable-next-line no-duplicate-imports import * as library from "@onlyoffice/library-declaration" import * as signature from "@onlyoffice/library-signature" -import {firstParagraph, firstSentence, selectSection} from "@onlyoffice/markdown" +import {extractSection} from "@onlyoffice/mdast-util-extract-section" +import {firstSentence} from "@onlyoffice/mdast-util-first-sentence" import * as Signature from "@onlyoffice/signature" import {isStringLiteral} from "@onlyoffice/strings" import languagedetection from "@vscode/vscode-languagedetection" @@ -627,12 +628,12 @@ async function declarationNode(dc: Doclet): Promise<[Library.DeclarationNode, .. // todo: it is a temporary solution. if (d.description) { - // todo: my bad, capitalize the title in the document builder declarations too. - const s = selectSection("Try it", d.description) - if (s !== "") { - // do not do it, create a new utility function. - d.description = d.description.replace("## Try it", "").replace(s, "") - d.tryIt = s + const a = fromMarkdown(d.description) + const r = extractSection("Try It", a) + const b = toMarkdown(r) + if (b) { + d.description = toMarkdown(a) + d.tryIt = b } } @@ -878,9 +879,10 @@ function resolveAbstract(dc: Doclet): [string, string] { } if (dc.description) { - let s = firstParagraph(dc.description) - s = firstSentence(s) - return [s, dc.description] + const a = fromMarkdown(dc.description) + const r = firstSentence(a) + const b = toMarkdown(r) + return [b, dc.description] } return ["", ""] diff --git a/packages/jsdoc-declaration/package.json b/packages/jsdoc-declaration/package.json index 231707819..b4d706439 100644 --- a/packages/jsdoc-declaration/package.json +++ b/packages/jsdoc-declaration/package.json @@ -16,7 +16,8 @@ "@onlyoffice/jsdoc": "workspace:^", "@onlyoffice/library-declaration": "workspace:^", "@onlyoffice/library-signature": "workspace:^", - "@onlyoffice/markdown": "workspace:^", + "@onlyoffice/mdast-util-extract-section": "workspace:^", + "@onlyoffice/mdast-util-first-sentence": "workspace:^", "@onlyoffice/signature": "workspace:^", "@onlyoffice/strings": "workspace:^", "@types/mdast": "4.0.3", diff --git a/packages/jsdoc-resource-fixtures/fixtures/resource.js b/packages/jsdoc-resource-fixtures/fixtures/resource.js index 2a38b1a0c..5ef8e99c0 100644 --- a/packages/jsdoc-resource-fixtures/fixtures/resource.js +++ b/packages/jsdoc-resource-fixtures/fixtures/resource.js @@ -9,6 +9,11 @@ class Cart { /** * Adds an item to the cart. + * + * ## Try It + * + * var item = addItem(0, 10); + * * @summary Puts a certain amount of an item in the cart. * @param {string} itemId - The ID of the item to add. * @param {number} quantity - How many of the item to add. @@ -54,6 +59,11 @@ class Account { /** * Adds money to the account. + * + * ## Try It + * + * var result = deposit("0000-0000-0000-0000", 100); + * * @summary Deposits an amount into the account. * @param {string} accountId - The ID of the account to deposit to. * @param {number} depositAmount - How much to deposit. diff --git a/packages/keyed-json/lib/main.test.ts b/packages/keyed-json/lib/main.test.ts deleted file mode 100644 index ed700259c..000000000 --- a/packages/keyed-json/lib/main.test.ts +++ /dev/null @@ -1,74 +0,0 @@ -import {test} from "uvu" -import {equal as eq, unreachable as un} from "uvu/assert" -import {fromKeys} from "./main.ts" - -test("", () => { - const o = fromKeys("") - eq(o, {}) -}) - -test("", () => { - const o = fromKeys("k") - eq(o, {}) -}) - -test("", () => { - const o = fromKeys("k j") - eq(o, {}) -}) - -test("", () => { - const o = fromKeys("k=") - eq(o, {}) -}) - -test("", () => { - const o = fromKeys("k=0") - eq(o, {}) -}) - -test("", () => { - const o = fromKeys("k=v") - eq(o, {}) -}) - -test("", () => { - const o = fromKeys("k={}") - eq(o, {k: {}}) -}) - -test("", () => { - try { - const o = fromKeys("k={a}") - un(`Expected an error, but got ${JSON.stringify(o)}`) - } catch (e) { - eq(e instanceof Error && e.message, "Expected property name or '}' in JSON at position 1 (line 1 column 2)") - } -}) - -test("", () => { - const o = fromKeys('k={"a": 0}') - eq(o, {k: {a: 0}}) -}) - -test("", () => { - const o = fromKeys('k={"a": 0, "b": 1}') - eq(o, {k: {a: 0, b: 1}}) -}) - -test("", () => { - const o = fromKeys('k={"a": {"b": 0}}') - eq(o, {k: {a: {b: 0}}}) -}) - -test("", () => { - const o = fromKeys('k={"a": 0} j={"b": 1}') - eq(o, {k: {a: 0}, j: {b: 1}}) -}) - -test("", () => { - const o = fromKeys("k=[]") - eq(o, {}) -}) - -test.run() diff --git a/packages/keyed-json/lib/main.ts b/packages/keyed-json/lib/main.ts deleted file mode 100644 index 600f83c6f..000000000 --- a/packages/keyed-json/lib/main.ts +++ /dev/null @@ -1,40 +0,0 @@ -export function fromKeys(s: string): Record { - const r: Record = {} - let i = 0 - - while (i < s.length) { - while (i < s.length && s[i] === " ") { - i += 1 - } - - const a = i - while (i < s.length && s[i] !== "=") { - i += 1 - } - - const k = s.slice(a, i) - - i += 1 - - if (s[i] === "{") { - const a = i - let n = 1 - - i += 1 - - while (n > 0 && i < s.length) { - if (s[i] === "{") { - n += 1 - } else if (s[i] === "}") { - n -= 1 - } - i += 1 - } - - const c = s.slice(a, i) - r[k] = JSON.parse(c) - } - } - - return r -} diff --git a/packages/markdown/lib/main.test.ts b/packages/markdown/lib/main.test.ts deleted file mode 100644 index e8699ef22..000000000 --- a/packages/markdown/lib/main.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -import {test} from "uvu" -import {is} from "uvu/assert" -import {firstParagraph, firstSentence, selectSection} from "./main.ts" - -test("firstParagraph() returns an empty string for an empty content", () => { - const e = firstParagraph("") - is(e, "") -}) - -test("firstParagraph() returns a first paragraph for a content with a single paragraph", () => { - const e = firstParagraph("a") - is(e, "a") -}) - -test("firstParagraph() returns a first paragraph for a content with multiple paragraphs", () => { - const e = firstParagraph("a\n\nb") - is(e, "a") -}) - -test("firstParagraph() returns a first paragraph for a content with a heading", () => { - const e = firstParagraph("# h\n\na\n\nb") - is(e, "a") -}) - -test("selectSection() returns an empty string for an empty title", () => { - const e = selectSection("", "c") - is(e, "") -}) - -test("selectSection() returns an empty string for an empty content", () => { - const e = selectSection("t", "") - is(e, "") -}) - -test("selectSection() returns an empty string for a title not found in the content", () => { - const e = selectSection("t", "c") - is(e, "") -}) - -test("selectSection() returns a section for a title found in the content", () => { - const e = selectSection("t", "## t\n\nc") - is(e, "c") -}) - -test("selectSection() returns a section for a title found in the content with multiple sections", () => { - const e = selectSection("t", "## t\n\nc\n\n## g\n\nd") - is(e, "c") -}) - -test("selectSection() returns the first section for a title found multiple times in the content", () => { - const e = selectSection("t", "## t\n\nc\n\n## t\n\nd") - is(e, "c") -}) - -test("firstSentence() returns an empty string for an empty content", () => { - const e = firstSentence("") - is(e, "") -}) - -test("firstSentence() returns a first sentence for a content with a single sentence", () => { - const e = firstSentence("a.") - is(e, "a.") -}) - -test("firstSentence() returns a first sentence for a content with multiple sentences", () => { - const e = firstSentence("a. b.") - is(e, "a.") -}) - -test.run() diff --git a/packages/markdown/lib/main.ts b/packages/markdown/lib/main.ts deleted file mode 100644 index e621c6776..000000000 --- a/packages/markdown/lib/main.ts +++ /dev/null @@ -1,60 +0,0 @@ -// todo: split into markdown and strings packages. - -import {type Paragraph} from "mdast" -import {fromMarkdown} from "mdast-util-from-markdown" -import {toMarkdown} from "mdast-util-to-markdown" -import {toString} from "mdast-util-to-string" -import {split} from "sentence-splitter" -import {English} from "sentence-splitter/lang" -import {remove} from "unist-util-remove" -import {select} from "unist-util-select" - -export function firstParagraph(s: string): string { - const t = fromMarkdown(s) - const n = select("paragraph", t) as Paragraph | undefined - if (n) { - s = toMarkdown({type: "root", children: [n]}) - if (s.endsWith("\n")) { - s = s.slice(0, -1) - } - } - return s -} - -export function selectSection(t: string, c: string): string { - const r = fromMarkdown(c) - - let i = -1 - remove(r, (node, index) => { - if (node.type === "root") { - return false - } - if (node.type === "heading" && "depth" in node && node.depth === 2) { - const s = toString(node) - if (s === t && index !== undefined && i === -1) { - i = index - return true - } - i = -1 - } - if (i === -1) { - return true - } - return false - }) - - c = toMarkdown(r) - if (c.endsWith("\n")) { - c = c.slice(0, -1) - } - - return c -} - -export function firstSentence(s: string): string { - const r = split(s, {AbbrMarker: {language: English}}) - if (r.length !== 0) { - s = r[0].raw - } - return s -} diff --git a/packages/mdast-util-extract-section/lib/main.test.ts b/packages/mdast-util-extract-section/lib/main.test.ts new file mode 100644 index 000000000..7fede1010 --- /dev/null +++ b/packages/mdast-util-extract-section/lib/main.test.ts @@ -0,0 +1,60 @@ +import {fromMarkdown} from "mdast-util-from-markdown" +import {toMarkdown} from "mdast-util-to-markdown" +import {test} from "uvu" +import {is} from "uvu/assert" +import {extractSection} from "./main.ts" + +const sc: [string, string, string][] = [ + ["", "", ""], + ["", "h", ""], + ["h", "h", ""], + ["## h", "h", ""], + [j("## h", "a"), "h", "a"], + [j("## H", "a"), "h", "a"], + [j("## h", "a"), " h ", "a"], + [j("## h", "a", "b"), "h", j("a", "b")], + [j("## h", "a", "## h", "b"), "h", "a"], + [j("# h", "a", "## h", "b"), "h", "b"], +] + +for (const [a, h, e] of sc) { + test(`extractSection(): selects section '${h}' from '${a}'`, () => { + const x = fromMarkdown(a) + const y = extractSection(h, x) + + let z = toMarkdown(y) + if (z.endsWith("\n")) { + z = z.slice(0, -1) + } + + is(z, e) + }) +} + +const rs: [string, string, string][] = [ + ["## h", "h", ""], + [j("## h", "a", "## D", "d"), "h", j("## D", "d")], + [j("## D", "d", "## h", "a"), "h", j("## D", "d")], + [j("## D", "d", "## h", "a", "## E", "e"), "h", j("## D", "d", "## E", "e")], +] + +for (const [a, h, e] of rs) { + test(`extractSection(): removes section '${h}' from '${a}'`, () => { + const x = fromMarkdown(a) + + extractSection(h, x) + + let z = toMarkdown(x) + if (z.endsWith("\n")) { + z = z.slice(0, -1) + } + + is(z, e) + }) +} + +test.run() + +function j(...a: string[]): string { + return a.join("\n\n") +} diff --git a/packages/mdast-util-extract-section/lib/main.ts b/packages/mdast-util-extract-section/lib/main.ts new file mode 100644 index 000000000..9e409917b --- /dev/null +++ b/packages/mdast-util-extract-section/lib/main.ts @@ -0,0 +1,43 @@ +import {isHeadingNode, isParentNode} from "@onlyoffice/mdast-util-is-node" +import {type Node, type Root, type RootContent} from "mdast" +import {toString} from "mdast-util-to-string" + +export function extractSection(h: string, n: Node): Root { + const r: Root = {type: "root", children: []} + + if (!h || !isParentNode(n)) { + return r + } + + h = h.trim().toLocaleLowerCase() + + const a: RootContent[] = [] + + let f: -1 | 0 | 1 = -1 + + for (const c of n.children) { + if (isHeadingNode(c) && c.depth === 2 && f === 0) { + f = 1 + } + + if (isHeadingNode(c) && c.depth === 2 && f === -1) { + const s = toString(c).toLocaleLowerCase() + + if (s === h) { + f = 0 + continue + } + } + + if (f === 0) { + r.children.push(c) + continue + } + + a.push(c) + } + + n.children = a + + return r +} diff --git a/packages/mdast-util-extract-section/package.json b/packages/mdast-util-extract-section/package.json new file mode 100644 index 000000000..bbc1f907f --- /dev/null +++ b/packages/mdast-util-extract-section/package.json @@ -0,0 +1,26 @@ +{ + "name": "@onlyoffice/mdast-util-extract-section", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@onlyoffice/mdast-util-is-node": "workspace:^", + "@types/mdast": "4.0.3", + "mdast-util-to-string": "4.0.0", + "typescript": "5.4.5" + }, + "devDependencies": { + "c8": "9.1.0", + "mdast-util-from-markdown": "2.0.0", + "mdast-util-to-markdown": "2.1.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "uvu": "0.5.6" + } +} diff --git a/packages/mdast-util-extract-section/tsconfig.json b/packages/mdast-util-extract-section/tsconfig.json new file mode 100644 index 000000000..f0d8cf437 --- /dev/null +++ b/packages/mdast-util-extract-section/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib"] +} diff --git a/packages/mdast-util-first-sentence/lib/main.test.ts b/packages/mdast-util-first-sentence/lib/main.test.ts new file mode 100644 index 000000000..ab02ff22d --- /dev/null +++ b/packages/mdast-util-first-sentence/lib/main.test.ts @@ -0,0 +1,30 @@ +import {fromMarkdown} from "mdast-util-from-markdown" +import {toMarkdown} from "mdast-util-to-markdown" +import {test} from "uvu" +import {is} from "uvu/assert" +import {firstSentence} from "./main.ts" + +const cs: [string, string][] = [ + ["", ""], + ["# h\n\na", ""], + ["a", "a."], + ["a. b", "a."], + ["a\n\nb", "a."], + ["a. b\n\nc. d", "a."], + ["**a. b**", "**a.**"], + ["**a*b. c*d**", "**a*b.***"], +] + +for (const [a, e] of cs) { + test(`firstSentence(): from '${a}' to '${e}'`, () => { + const x = fromMarkdown(a) + const y = firstSentence(x) + let z = toMarkdown(y) + if (z.endsWith("\n")) { + z = z.slice(0, -1) + } + is(z, e) + }) +} + +test.run() diff --git a/packages/mdast-util-first-sentence/lib/main.ts b/packages/mdast-util-first-sentence/lib/main.ts new file mode 100644 index 000000000..6f933d280 --- /dev/null +++ b/packages/mdast-util-first-sentence/lib/main.ts @@ -0,0 +1,95 @@ +import { + isHtmlNode, + isLiteralNode, + isParagraphNode, + isParentNode, +} from "@onlyoffice/mdast-util-is-node" +import {type Node, type Parent, type Root, type RootContent} from "mdast" +import {toString} from "mdast-util-to-string" +import {split} from "sentence-splitter" +import {English} from "sentence-splitter/lang" + +export function firstSentence(n: Node): Root { + const r: Root = {type: "root", children: []} + if (!isParentNode(n) || n.children.length === 0) { + return r + } + + const [c] = n.children + if (!isParagraphNode(c) || c.children.length === 0) { + return r + } + + const t = toString(c, {includeHtml: false, includeImageAlt: false}) + if (!t) { + return r + } + + const e = split(t, {AbbrMarker: {language: English}}) + if (e.length === 0) { + return r + } + + append({s: e[0].raw}, r, c) + return r +} + +function append(c: {s: string}, r: Parent, n: unknown): void { + // This function implements the same logic as 'mdast-util-to-string'. + // Without type casting (as) it is problematic in here. + + if (isHtmlNode(n)) { + return + } + + if (isLiteralNode(n)) { + const t = clone(n) + + if (c.s.startsWith(t.value)) { + c.s = c.s.slice(t.value.length) + } else { + const i = t.value.indexOf(c.s) + if (i === -1) { + return + } + c.s = "" + t.value = t.value.slice(0, i + 1) + } + + if (!c.s && !t.value.endsWith(".")) { + t.value += "." + } + + r.children.push(t as RootContent) + return + } + + if (isParentNode(n)) { + const t = clone(n) + + for (const u of n.children) { + append(c, t, u) + if (!c.s) { + break + } + } + + if (t.children.length !== 0) { + r.children.push(t as RootContent) + } + } +} + +function clone(n: N): N { + if (!isParentNode(n)) { + const c = structuredClone(n) + delete c.position + return c + } + const a = n.children + n.children = [] + const c = structuredClone(n) + n.children = a + delete c.position + return c +} diff --git a/packages/markdown/package.json b/packages/mdast-util-first-sentence/package.json similarity index 82% rename from packages/markdown/package.json rename to packages/mdast-util-first-sentence/package.json index c413e6915..d56cbd674 100644 --- a/packages/markdown/package.json +++ b/packages/mdast-util-first-sentence/package.json @@ -1,5 +1,5 @@ { - "name": "@onlyoffice/markdown", + "name": "@onlyoffice/mdast-util-first-sentence", "type": "module", "private": true, "main": "lib/main.ts", @@ -10,17 +10,16 @@ "test": "pnpm test:types && pnpm test:unit" }, "dependencies": { + "@onlyoffice/mdast-util-is-node": "workspace:^", "@types/mdast": "4.0.3", - "mdast-util-from-markdown": "2.0.0", - "mdast-util-to-markdown": "2.1.0", "mdast-util-to-string": "4.0.0", "sentence-splitter": "5.0.0", - "typescript": "5.4.5", - "unist-util-remove": "4.0.0", - "unist-util-select": "5.1.0" + "typescript": "5.4.5" }, "devDependencies": { "c8": "9.1.0", + "mdast-util-from-markdown": "2.0.0", + "mdast-util-to-markdown": "2.1.0", "rimraf": "6.0.1", "tsx": "4.16.5", "uvu": "0.5.6" diff --git a/packages/mdast-util-first-sentence/tsconfig.json b/packages/mdast-util-first-sentence/tsconfig.json new file mode 100644 index 000000000..f0d8cf437 --- /dev/null +++ b/packages/mdast-util-first-sentence/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib"] +} diff --git a/packages/mdast-util-is-node/lib/main.test.ts b/packages/mdast-util-is-node/lib/main.test.ts new file mode 100644 index 000000000..802a54470 --- /dev/null +++ b/packages/mdast-util-is-node/lib/main.test.ts @@ -0,0 +1,60 @@ +import {test} from "uvu" +import {is} from "uvu/assert" +import { + isHeadingNode, + isHtmlNode, + isLiteralNode, + isNode, + isParagraphNode, + isParentNode, + isTextNode, +} from "./main.ts" + +interface Is { + (u: unknown): boolean +} + +const p0: [Is, unknown][] = [ + [isNode, {type: ""}], + [isLiteralNode, {type: "", value: ""}], + [isParentNode, {type: "", children: []}], +] + +for (const [xi, xn] of p0) { + test(`${xi.name}(): returns true for the '${JSON.stringify(xn)}'`, () => { + const a = xi(xn) + is(a, true) + }) + + test(`${xi.name}(): returns false for the '{}'`, () => { + const a = xi({}) + is(a, false) + }) +} + +const p1: [Is, unknown][] = [ + [isTextNode, {type: "text", value: ""}], + [isHtmlNode, {type: "html", value: ""}], + [isParagraphNode, {type: "paragraph", children: []}], + [isHeadingNode, {type: "heading", depth: 1, children: []}], +] + +for (const [xi, xn] of p1) { + test(`${xi.name}(): returns true for the '${JSON.stringify(xn)}'`, () => { + const a = xi(xn) + is(a, true) + }) + + for (const [yi, yn] of p1) { + if (xi === yi) { + continue + } + + test(`${xi.name}(): returns false for the '${JSON.stringify(yn)}'`, () => { + const a = xi(yn) + is(a, false) + }) + } +} + +test.run() diff --git a/packages/mdast-util-is-node/lib/main.ts b/packages/mdast-util-is-node/lib/main.ts new file mode 100644 index 000000000..6551f0661 --- /dev/null +++ b/packages/mdast-util-is-node/lib/main.ts @@ -0,0 +1,45 @@ +import { + type Heading, + type Html, + type Literal, + type Node, + type Paragraph, + type Parent, + type Text, +} from "mdast" + +export function isHeadingNode(u: unknown): u is Heading { + return isParentNode(u) && + u.type === "heading" && + "depth" in u && + typeof u.depth === "number" +} + +export function isParagraphNode(u: unknown): u is Paragraph { + return isParentNode(u) && u.type === "paragraph" +} + +export function isParentNode(u: unknown): u is Parent { + return isNode(u) && "children" in u && Array.isArray(u.children) +} + +export function isHtmlNode(u: unknown): u is Html { + return isLiteralNode(u) && u.type === "html" +} + +export function isTextNode(u: unknown): u is Text { + return isLiteralNode(u) && u.type === "text" +} + +export function isLiteralNode(u: unknown): u is Literal { + return isNode(u) && "value" in u && typeof u.value === "string" +} + +export function isNode(u: unknown): u is Node { + return Boolean( + u && + typeof u === "object" && + "type" in u && + typeof u.type === "string", + ) +} diff --git a/packages/keyed-json/package.json b/packages/mdast-util-is-node/package.json similarity index 86% rename from packages/keyed-json/package.json rename to packages/mdast-util-is-node/package.json index 1ab4a1ac8..9bd9695fd 100644 --- a/packages/keyed-json/package.json +++ b/packages/mdast-util-is-node/package.json @@ -1,5 +1,5 @@ { - "name": "@onlyoffice/keyed-json", + "name": "@onlyoffice/mdast-util-is-node", "type": "module", "private": true, "main": "lib/main.ts", @@ -10,6 +10,7 @@ "test": "pnpm test:types && pnpm test:unit" }, "dependencies": { + "@types/mdast": "4.0.3", "typescript": "5.4.5" }, "devDependencies": { diff --git a/packages/mdast-util-is-node/tsconfig.json b/packages/mdast-util-is-node/tsconfig.json new file mode 100644 index 000000000..f0d8cf437 --- /dev/null +++ b/packages/mdast-util-is-node/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib"] +} diff --git a/packages/rehype-clean/index.d.ts b/packages/rehype-clean/index.d.ts index abdf01aef..baf1f9da3 100644 --- a/packages/rehype-clean/index.d.ts +++ b/packages/rehype-clean/index.d.ts @@ -1 +1,2 @@ +/// /// diff --git a/packages/rehype-clean/lib/main.ts b/packages/rehype-clean/lib/main.ts index 5b5866672..e87382a1f 100644 --- a/packages/rehype-clean/lib/main.ts +++ b/packages/rehype-clean/lib/main.ts @@ -32,6 +32,10 @@ export function rehypeClean(): RehypeCleanTransform { if (p.metastring) { delete p.metastring } + + if (p.metaobject) { + delete p.metaobject + } }) } } diff --git a/packages/rehype-clean/package.json b/packages/rehype-clean/package.json index fcb42bc55..5b7ccd278 100644 --- a/packages/rehype-clean/package.json +++ b/packages/rehype-clean/package.json @@ -14,6 +14,7 @@ "unist-util-visit": "5.0.0" }, "devDependencies": { + "@onlyoffice/rehype-metaobject": "workspace:^", "@onlyoffice/rehype-metastring": "workspace:^", "rimraf": "6.0.1" } diff --git a/packages/rehype-description-list/fixtures/000.txt b/packages/rehype-description-list/fixtures/000.txt new file mode 100644 index 000000000..e7f633559 --- /dev/null +++ b/packages/rehype-description-list/fixtures/000.txt @@ -0,0 +1,9 @@ +does nothing for an empty content + +--- + + +--- + + +--- diff --git a/packages/rehype-description-list/fixtures/001.txt b/packages/rehype-description-list/fixtures/001.txt new file mode 100644 index 000000000..8ec0fe946 --- /dev/null +++ b/packages/rehype-description-list/fixtures/001.txt @@ -0,0 +1,11 @@ +does not modify an unordered list without items + +--- + +

    + +--- + +
      + +--- diff --git a/packages/rehype-description-list/fixtures/002.txt b/packages/rehype-description-list/fixtures/002.txt new file mode 100644 index 000000000..48efca4fc --- /dev/null +++ b/packages/rehype-description-list/fixtures/002.txt @@ -0,0 +1,15 @@ +does not modify an unordered tight list with a single item + +--- + +
        +
      • term
      • +
      + +--- + +
        +
      • term
      • +
      + +--- diff --git a/packages/rehype-description-list/fixtures/003.txt b/packages/rehype-description-list/fixtures/003.txt new file mode 100644 index 000000000..84ea9b315 --- /dev/null +++ b/packages/rehype-description-list/fixtures/003.txt @@ -0,0 +1,19 @@ +does not modify an unordered loose list with a single item + +--- + +
        +
      • +

        term

        +
      • +
      + +--- + +
        +
      • +

        term

        +
      • +
      + +--- diff --git a/packages/rehype-description-list/fixtures/004.txt b/packages/rehype-description-list/fixtures/004.txt new file mode 100644 index 000000000..7bbc05583 --- /dev/null +++ b/packages/rehype-description-list/fixtures/004.txt @@ -0,0 +1,17 @@ +does not modify an unordered tight list with multiple items + +--- + +
        +
      • term0
      • +
      • term1
      • +
      + +--- + +
        +
      • term0
      • +
      • term1
      • +
      + +--- diff --git a/packages/rehype-description-list/fixtures/005.txt b/packages/rehype-description-list/fixtures/005.txt new file mode 100644 index 000000000..24ada521d --- /dev/null +++ b/packages/rehype-description-list/fixtures/005.txt @@ -0,0 +1,25 @@ +does not modify an unordered loose list with multiple items + +--- + +
        +
      • +

        term0

        +
      • +
      • +

        term1

        +
      • +
      + +--- + +
        +
      • +

        term0

        +
      • +
      • +

        term1

        +
      • +
      + +--- diff --git a/packages/rehype-description-list/fixtures/006.txt b/packages/rehype-description-list/fixtures/006.txt new file mode 100644 index 000000000..c13439d40 --- /dev/null +++ b/packages/rehype-description-list/fixtures/006.txt @@ -0,0 +1,23 @@ +does not modify an unordered list without a term + +--- + +
        +
      • +
          +
        • : details
        • +
        +
      • +
      + +--- + +
        +
      • +
          +
        • : details
        • +
        +
      • +
      + +--- diff --git a/packages/rehype-description-list/fixtures/007.txt b/packages/rehype-description-list/fixtures/007.txt new file mode 100644 index 000000000..7d237b50b --- /dev/null +++ b/packages/rehype-description-list/fixtures/007.txt @@ -0,0 +1,19 @@ +does not modify an unordered list without a details + +--- + +
        +
      • term +
          +
        • +
        + +--- + +
          +
        • term +
            +
          • +
          + +--- diff --git a/packages/rehype-description-list/fixtures/008.txt b/packages/rehype-description-list/fixtures/008.txt new file mode 100644 index 000000000..4ffbfb4e5 --- /dev/null +++ b/packages/rehype-description-list/fixtures/008.txt @@ -0,0 +1,20 @@ +modifies an unordered tight list with a single pair + +--- + +
            +
          • term +
              +
            • : details
            • +
            +
          • +
          + +--- + +
          +
          term
          +
          details
          +
          + +--- diff --git a/packages/rehype-description-list/fixtures/009.txt b/packages/rehype-description-list/fixtures/009.txt new file mode 100644 index 000000000..e8879258b --- /dev/null +++ b/packages/rehype-description-list/fixtures/009.txt @@ -0,0 +1,27 @@ +modifies an unordered tight list with multiple pairs + +--- + +
            +
          • term0 +
              +
            • : details0
            • +
            +
          • +
          • term1 +
              +
            • : details1
            • +
            +
          • +
          + +--- + +
          +
          term0
          +
          details0
          +
          term1
          +
          details1
          +
          + +--- diff --git a/packages/rehype-description-list/fixtures/010.txt b/packages/rehype-description-list/fixtures/010.txt new file mode 100644 index 000000000..e8fccc0c6 --- /dev/null +++ b/packages/rehype-description-list/fixtures/010.txt @@ -0,0 +1,27 @@ +modifies an unordered loose list with a single pair + +--- + +
            +
          • +

            term

            +
              +
            • +

              : details

              +
            • +
            +
          • +
          + +--- + +
          +
          +

          term

          +
          +
          +

          details

          +
          +
          + +--- diff --git a/packages/rehype-description-list/fixtures/011.txt b/packages/rehype-description-list/fixtures/011.txt new file mode 100644 index 000000000..72cfb6545 --- /dev/null +++ b/packages/rehype-description-list/fixtures/011.txt @@ -0,0 +1,41 @@ +modifies an unordered loose list with multiple pairs + +--- + +
            +
          • +

            term0

            +
              +
            • +

              : details0

              +
            • +
            +
          • +
          • +

            term1

            +
              +
            • +

              : details1

              +
            • +
            +
          • +
          + +--- + +
          +
          +

          term0

          +
          +
          +

          details0

          +
          +
          +

          term1

          +
          +
          +

          details1

          +
          +
          + +--- diff --git a/packages/rehype-description-list/fixtures/012.txt b/packages/rehype-description-list/fixtures/012.txt new file mode 100644 index 000000000..5ead17905 --- /dev/null +++ b/packages/rehype-description-list/fixtures/012.txt @@ -0,0 +1,26 @@ +modifies an unordered list with a content in the details + +--- + +
            +
          • term +
              +
            • +

              : details

              +

              more details

              +
            • +
            +
          • +
          + +--- + +
          +
          term
          +
          +

          details

          +

          more details

          +
          +
          + +--- diff --git a/packages/rehype-description-list/fixtures/013.txt b/packages/rehype-description-list/fixtures/013.txt new file mode 100644 index 000000000..0b2e18356 --- /dev/null +++ b/packages/rehype-description-list/fixtures/013.txt @@ -0,0 +1,20 @@ +modifies an unordered tight list with a short details + +--- + +
            +
          • term +
              +
            • :
            • +
            +
          • +
          + +--- + +
          +
          term
          +
          +
          + +--- diff --git a/packages/rehype-description-list/fixtures/014.txt b/packages/rehype-description-list/fixtures/014.txt new file mode 100644 index 000000000..92024fbe3 --- /dev/null +++ b/packages/rehype-description-list/fixtures/014.txt @@ -0,0 +1,25 @@ +modifies an unordered loose list with a short details +todo: this test case is invalid + +--- + +
            +
          • term +
              +
            • +

              :

              +
            • +
            +
          • +
          + +--- + +
          +
          term
          +
          + +
          +
          + +--- diff --git a/packages/rehype-description-list/lib/main.test.ts b/packages/rehype-description-list/lib/main.test.ts new file mode 100644 index 000000000..f1e60292b --- /dev/null +++ b/packages/rehype-description-list/lib/main.test.ts @@ -0,0 +1,45 @@ +import {readFile, readdir} from "node:fs/promises" +import path from "node:path" +import rehypeParse from "rehype-parse" +import rehypeStringify from "rehype-stringify" +import {unified} from "unified" +import {test} from "uvu" +import {is} from "uvu/assert" +import {rehypeDescriptionList} from "./main.js" + +for (const [n, v, e] of await list()) { + test(n, async () => { + const f = await unified() + .data("settings", {fragment: true}) + .use(rehypeParse) + .use(rehypeDescriptionList) + .use(rehypeStringify) + .process(v) + is(f.toString(), e) + }) +} + +test.run() + +type TestCase = [string, string, string] + +async function list(): Promise { + const a: TestCase[] = [] + const d = await readdir("fixtures") + for (const n of d) { + const e = path.extname(n) + const p = path.basename(n, e) + const s = await readFile(`fixtures/${n}`, "utf8") + const c = create(p, s) + a.push(c) + } + return a +} + +function create(p: string, s: string): TestCase { + let [n, m, h] = s.split("\n---\n") + n = n.slice(0, -1) + m = m.slice(1).slice(0, -1) + h = h.slice(1).slice(0, -1) + return [`${p}: ${n}`, m, h] +} diff --git a/packages/rehype-description-list/lib/main.ts b/packages/rehype-description-list/lib/main.ts new file mode 100644 index 000000000..6e0548b92 --- /dev/null +++ b/packages/rehype-description-list/lib/main.ts @@ -0,0 +1,446 @@ +// Markdown (not CommonMark or even GFM) does not have standardized syntax for +// the description list (also known as dl, dt, dd HTML elements). One of the +// ready-to-use remark packages is [remark-definition-list], but unfortunately, +// this package is not compatible with many remark lint rules due to syntax +// conflicts. To avoid reinventing the wheel, the [MDN syntax] was chosen since +// it is compatible with everything else. +// +// This package implements definition list elements on top of hast structures. +// This is not the ideal place for such transformations. It would be +// significantly better to do them on top of mdast structures to be similar to +// the [remark-definition-list] package. However, this would require many hours +// of work, and the result is not necessarily worth it. +// +// [MDN syntax]: https://github.com/mdn/yari/blob/v2.65.0/markdown/m2h/handlers/dl.ts/ +// [remark-definition-list]: https://github.com/wataru-chocola/remark-definition-list/ + +import { + isLiElement, + isPElement, + isUlElement, +} from "@onlyoffice/hast-util-is-element" +import {isNewlineText, isText} from "@onlyoffice/hast-util-is-text" +import {type Element, type Root, type Text} from "hast" +import {h} from "hastscript" +import {CONTINUE, visit} from "unist-util-visit" + +export interface RehypeDescriptionListTransform { + (tree: Root): void +} + +export function rehypeDescriptionList(): RehypeDescriptionListTransform { + return function transform(t) { + visit(t, "element", (n, i, p) => { + if (!p || i === undefined) { + return + } + + const dl = convert(n) + if (dl.children.length === 0) { + return + } + + p.children[i] = dl + return [CONTINUE, i] + }) + } +} + +function convert(e: Element): Element { + // If the list is tight: + // + // > |
            + // ^^^^ + // |
          • term + // |
              + // |
            • : details
            • + // |
            + // |
          • + // |
          + // + // If the list is loose: + // + // > |
            + // ^^^^ + // |
          • + // |

            term

            + // |
              + // |
            • + // |

              : details

              + // |
            • + // |
            + // |
          • + // |
          + + if (!isUlElement(e)) { + return h("dl") + } + + const dl = h("dl") + + for (const c0 of e.children) { + // If the list is tight: + // + // > |
            + // ^ + // |
          • term + // |
              + // |
            • : details
            • + // |
            + // > |
          • + // ^ + // |
          + // + // If the list is loose: + // + // > |
            + // ^ + // |
          • + // |

            term

            + // |
              + // |
            • + // |

              : details

              + // |
            • + // |
            + // > |
          • + // ^ + // |
          + + if (isNewlineText(c0)) { + dl.children.push(c0) + continue + } + + // If the list is tight: + // + // |
            + // > |
          • term + // ^^^^ + // |
              + // |
            • : details
            • + // |
            + // |
          • + // |
          + // + // If the list is loose: + // + // |
            + // > |
          • + // ^^^^ + // |

            term

            + // |
              + // |
            • + // |

              : details

              + // |
            • + // |
            + // |
          • + // |
          + + if (isLiElement(c0)) { + const dt = h("dt") + const dd = h("dd") + + for (const c1 of c0.children) { + // If the list is tight: + // + // |
            + // > |
          • term + // ^ + // |
              + // |
            • : details
            • + // > |
            + // ^ + // |
          • + // |
          + // + // If the list is loose: + // + // |
            + // > |
          • + // ^ + // |

            term

            + // > ^ + // |
              + // |
            • + // |

              : details

              + // |
            • + // > |
            + // ^ + // |
          • + // |
          + + if (isNewlineText(c1)) { + dt.children.push(c1) + continue + } + + // Look at the details first. + + // If the list is tight: + // + // |
            + // |
          • term + // > |
              + // ^^^^ + // |
            • : details
            • + // |
            + // |
          • + // |
          + // + // If the list is loose: + // + // |
            + // |
          • + // |

            term

            + // > |
              + // ^^^^ + // |
            • + // |

              : details

              + // |
            • + // |
            + // |
          • + // |
          + + if (isUlElement(c1)) { + for (const c2 of c1.children) { + // If the list is tight: + // + // |
            + // |
          • term + // > |
              + // ^ + // > |
            • : details
            • + // ^ + // |
            + // |
          • + // |
          + // + // If the list is loose: + // + // |
            + // |
          • + // |

            term

            + // > |
              + // ^ + // |
            • + // |

              : details

              + // > |
            • + // ^ + // |
            + // |
          • + // |
          + + if (isNewlineText(c2)) { + continue + } + + // If the list is tight: + // + // |
            + // |
          • term + // |
              + // > |
            • : details
            • + // ^^^^ + // |
            + // |
          • + // |
          + // + // If the list is loose: + // + // |
            + // |
          • + // |

            term

            + // |
              + // > |
            • + // ^^^^ + // |

              : details

              + // |
            • + // |
            + // |
          • + // |
          + + if (isLiElement(c2)) { + for (const c3 of c2.children) { + // If the list is loose: + // + // |
            + // |
          • + // |

            term

            + // |
              + // > |
            • + // ^ + // > |

              : details

              + // ^ + // |
            • + // |
            + // |
          • + // |
          + + if (isNewlineText(c3)) { + dd.children.push(c3) + continue + } + + // Everything else. + + if (!isEmpty(dd)) { + dd.children.push(c3) + continue + } + + // If the list is tight: + // + // |
            + // |
          • term + // |
              + // > |
            • : details
            • + // ^^^^^^^^^ + // |
            + // |
          • + // |
          + // + // If the list is loose: + // + // |
            + // |
          • + // |

            term

            + // |
              + // |
            • + // > |

              : details

              + // ^^^^^^^^^^^^^^^^ + // |
            • + // |
            + // |
          • + // |
          + + if (isText(c3) && c3.value === ":") { + dd.children.push(noopText()) + continue + } + + if (isText(c3) && c3.value.startsWith(": ")) { + const m = structuredClone(c3) + m.value = m.value.slice(2) + dd.children.push(m) + continue + } + + if (isPElement(c3) && c3.children.length !== 0) { + const [c4] = c3.children + + if (isText(c4) && c4.value === ":") { + dd.children.push(noopText()) + continue + } + + if (isText(c4) && c4.value.startsWith(": ")) { + const m = structuredClone(c4) + m.value = m.value.slice(2) + + const p = structuredClone(c3) + p.children[0] = m + + dd.children.push(p) + continue + } + } + + return h("dl") + } + } + } + + if (!isEmpty(dd) && isEmpty(dt)) { + return h("dl") + } + + if (!isEmpty(dd)) { + continue + } + } + + // If the list is tight: + // + // |
            + // > |
          • term + // ^^^^ + // |
              + // |
            • : details
            • + // |
            + // |
          • + // |
          + // + // If the list is loose: + // + // |
            + // |
          • + // > |

            term

            + // ^^^^^^^^^^^ + // |
              + // |
            • + // |

              : details

              + // |
            • + // |
            + // |
          • + // |
          + + dt.children.push(c1) + } + + if (isEmpty(dt) || isEmpty(dd)) { + return h("dl") + } + + if (c0.children.length !== 0) { + let [c] = c0.children + if (isText(c) && !isNewlineText(c) && c.value.endsWith("\n")) { + const s = structuredClone(c) + s.value = s.value.slice(0, -1) + dt.children[0] = s + } + + c = c0.children[c0.children.length - 1] + if (isNewlineText(c)) { + dt.children.pop() + } + } + + for (let i = dd.children.length - 1; i >= 0; i -= 1) { + const c = dd.children[i] + if (isNoopText(c)) { + dd.children.splice(i, 1) + } + } + + dl.children.push(dt, {type: "text", value: "\n"}, dd) + + continue + } + + return h("dl") + } + + return dl +} + +function isEmpty(e: Element): boolean { + for (let i = e.children.length - 1; i >= 0; i -= 1) { + const c = e.children[i] + if (!isNewlineText(c)) { + return false + } + } + return true +} + +// todo: In this case, noop text is a hack that allows the tracking of empty +// details. The algorithm needs to be revised to eliminate it. + +function isNoopText(u: unknown): u is Text { + return isText(u) && u.value === "" && "__noop" in u +} + +function noopText(): Text { + // @ts-ignore read above + return {type: "text", value: "", __noop: true} +} diff --git a/packages/rehype-description-list/package.json b/packages/rehype-description-list/package.json new file mode 100644 index 000000000..f6ab9ea82 --- /dev/null +++ b/packages/rehype-description-list/package.json @@ -0,0 +1,30 @@ +{ + "name": "@onlyoffice/rehype-description-list", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@onlyoffice/hast-util-is-element": "workspace:^", + "@onlyoffice/hast-util-is-text": "workspace:^", + "@types/hast": "3.0.4", + "hastscript": "8.0.0", + "typescript": "5.4.5", + "unist-util-visit": "5.0.0" + }, + "devDependencies": { + "@types/node": "20.12.12", + "c8": "9.1.0", + "rehype-parse": "9.0.0", + "rehype-stringify": "10.0.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "unified": "11.0.5", + "uvu": "0.5.6" + } +} diff --git a/packages/rehype-description-list/tsconfig.json b/packages/rehype-description-list/tsconfig.json new file mode 100644 index 000000000..f0d8cf437 --- /dev/null +++ b/packages/rehype-description-list/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib"] +} diff --git a/packages/rehype-metaobject/fixtures/000.txt b/packages/rehype-metaobject/fixtures/000.txt new file mode 100644 index 000000000..e7f633559 --- /dev/null +++ b/packages/rehype-metaobject/fixtures/000.txt @@ -0,0 +1,9 @@ +does nothing for an empty content + +--- + + +--- + + +--- diff --git a/packages/rehype-metaobject/fixtures/001.txt b/packages/rehype-metaobject/fixtures/001.txt new file mode 100644 index 000000000..313be0d75 --- /dev/null +++ b/packages/rehype-metaobject/fixtures/001.txt @@ -0,0 +1,12 @@ +does not populate the metaobject if the metastring is not present + +--- + +```js +``` + +--- + + + +--- diff --git a/packages/rehype-metaobject/fixtures/002.txt b/packages/rehype-metaobject/fixtures/002.txt new file mode 100644 index 000000000..e8f66faf2 --- /dev/null +++ b/packages/rehype-metaobject/fixtures/002.txt @@ -0,0 +1,16 @@ +populates the metaobject + +--- + +```js o={p: "v"} +``` + +--- + +{ + "o": { + "p": "v" + } +} + +--- diff --git a/packages/rehype-metaobject/lib/internal.test.ts b/packages/rehype-metaobject/lib/internal.test.ts new file mode 100644 index 000000000..7942f1dfb --- /dev/null +++ b/packages/rehype-metaobject/lib/internal.test.ts @@ -0,0 +1,65 @@ +import {test} from "uvu" +import {equal as eq} from "uvu/assert" +import {metaobject} from "./internal.ts" + +const cases: [string, object][] = [ + ["", {}], + + // Group of empty values + ["a", {a: ""}], + ["a b", {a: "", b: ""}], + ["a=", {a: ""}], + + // Group of primitive values + ["a=0", {a: 0}], + ["a=''", {a: ""}], + ['a=""', {a: ""}], + ["a=true", {a: true}], + ["a=false", {a: false}], + ["a=null", {a: null}], + + // Group of array values + ["a=[]", {a: []}], + ["a=[0]", {a: [0]}], + ["a=['']", {a: [""]}], + ['a=[""]', {a: [""]}], + ["a=[true]", {a: [true]}], + ["a=[false]", {a: [false]}], + ["a=[null]", {a: [null]}], + + // Group of object values + ["a={}", {a: {}}], + ["a={v: 0}", {a: {v: 0}}], + ["a={v: ''}", {a: {v: ""}}], + ['a={v: ""}', {a: {v: ""}}], + ["a={v: true}", {a: {v: true}}], + ["a={v: false}", {a: {v: false}}], + ["a={v: null}", {a: {v: null}}], + ["a={v: []}", {a: {v: []}}], + ["a={v: {}}", {a: {v: {}}}], + + // Group of dot values + ["a.v=0", {a: {v: 0}}], + ["a.v=''", {a: {v: ""}}], + ['a.v=""', {a: {v: ""}}], + ["a.v=true", {a: {v: true}}], + ["a.v=false", {a: {v: false}}], + ["a.v=null", {a: {v: null}}], + ["a.v=[]", {a: {v: []}}], + ["a.v={}", {a: {v: {}}}], + + // Group of multiple values + ["a=0 b=1", {a: 0, b: 1}], + ["a={v: 0} b={v: 1}", {a: {v: 0}, b: {v: 1}}], + ["a.v=0 b.v=1", {a: {v: 0}, b: {v: 1}}], + ["a.x=0 a.y=1", {a: {x: 0, y: 1}}], +] + +for (const [s, e] of cases) { + test(s, () => { + const a = metaobject(s) + eq(a, e) + }) +} + +test.run() diff --git a/packages/rehype-metaobject/lib/internal.ts b/packages/rehype-metaobject/lib/internal.ts new file mode 100644 index 000000000..a4b963718 --- /dev/null +++ b/packages/rehype-metaobject/lib/internal.ts @@ -0,0 +1,86 @@ +import JSON5 from "json5" + +export function metaobject(s: string): object { + // It is problematic to use the unknown type here. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const r: Record = {} + + let i = 0 + + while (i < s.length) { + let t = r + + while (i < s.length && s[i] === " ") { + i += 1 + } + + const j = i + + while (i < s.length && s[i] !== "=" && s[i] !== " ") { + i += 1 + } + + const k = s.slice(j, i) + + let v: unknown = "" + + const a = k.split(".") + + for (const [j, p] of a.entries()) { + if (j !== a.length - 1) { + let o = t[p] + if (!o) { + o = {} + t[p] = o + } + t = o + continue + } + + if (s[i] === "=") { + i += 1 + + const j = i + + if (i >= s.length || s[i] === " ") { + // do nothing + } else if (s[i] === "{" || s[i] === "[") { + const o = s[i] + + let c = "" + if (o === "{") { + c = "}" + } else { + c = "]" + } + + let n = 1 + + i += 1 + + while (n > 0 && i < s.length) { + if (s[i] === o) { + n += 1 + } else if (s[i] === c) { + n -= 1 + } + i += 1 + } + } else { + while (i < s.length && s[i] !== " ") { + i += 1 + } + } + + if (j !== i) { + const r = s.slice(j, i) + v = JSON5.parse(r) + } + } + + t[p] = v + } + } + + return r +} diff --git a/packages/rehype-metaobject/lib/main.test.ts b/packages/rehype-metaobject/lib/main.test.ts new file mode 100644 index 000000000..03196aea7 --- /dev/null +++ b/packages/rehype-metaobject/lib/main.test.ts @@ -0,0 +1,64 @@ +import {readFile, readdir} from "node:fs/promises" +import path from "node:path" +import {rehypeMetastring} from "@onlyoffice/rehype-metastring" +import {type Root} from "hast" +import rehypeRaw from "rehype-raw" +import rehypeStringify from "rehype-stringify" +import remarkParse from "remark-parse" +import remarkRehype from "remark-rehype" +import {unified} from "unified" +import {visit} from "unist-util-visit" +import {test} from "uvu" +import {is} from "uvu/assert" +import {rehypeMetaobject} from "./main.js" + +for (const [n, v, e] of await list()) { + test(n, async () => { + let a = "" + + await unified() + .use(remarkParse) + .use(remarkRehype) + .use(rehypeMetastring) + .use(rehypeRaw) + .use(rehypeMetaobject) + .use(() => { + return function transform(t: Root) { + visit(t, "element", (n) => { + if (n.properties.metaobject) { + a = JSON.stringify(n.properties.metaobject, null, 2) + } + }) + } + }) + .use(rehypeStringify) + .process(v) + + is(a, e) + }) +} + +test.run() + +type TestCase = [string, string, string] + +async function list(): Promise { + const a: TestCase[] = [] + const d = await readdir("fixtures") + for (const n of d) { + const e = path.extname(n) + const p = path.basename(n, e) + const s = await readFile(`fixtures/${n}`, "utf8") + const c = create(p, s) + a.push(c) + } + return a +} + +function create(p: string, s: string): TestCase { + let [n, m, h] = s.split("\n---\n") + n = n.slice(0, -1) + m = m.slice(1).slice(0, -1) + h = h.slice(1).slice(0, -1) + return [`${p}: ${n}`, m, h] +} diff --git a/packages/rehype-metaobject/lib/main.ts b/packages/rehype-metaobject/lib/main.ts new file mode 100644 index 000000000..15f327b75 --- /dev/null +++ b/packages/rehype-metaobject/lib/main.ts @@ -0,0 +1,26 @@ +import {type Metaobject, type Root} from "hast" +import {visit} from "unist-util-visit" +import {metaobject} from "./internal.ts" + +declare module "hast" { + interface Properties { + metaobject?: Metaobject + } + + interface Metaobject {} +} + +export interface RehypeMetaobjectTransform { + (tree: Root): void +} + +export function rehypeMetaobject(): RehypeMetaobjectTransform { + return function transform(t) { + visit(t, "element", (n) => { + const p = n.properties + if (n.tagName === "code" && p.metastring) { + p.metaobject = metaobject(p.metastring) as Metaobject + } + }) + } +} diff --git a/packages/rehype-metaobject/package.json b/packages/rehype-metaobject/package.json new file mode 100644 index 000000000..10d0cdecf --- /dev/null +++ b/packages/rehype-metaobject/package.json @@ -0,0 +1,31 @@ +{ + "name": "@onlyoffice/rehype-metaobject", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@types/hast": "3.0.4", + "json5": "2.2.3", + "typescript": "5.4.5", + "unist-util-visit": "5.0.0" + }, + "devDependencies": { + "@onlyoffice/rehype-metastring": "workspace:^", + "@types/node": "20.12.12", + "c8": "9.1.0", + "rehype-raw": "7.0.0", + "rehype-stringify": "10.0.0", + "remark-parse": "11.0.0", + "remark-rehype": "11.1.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "unified": "11.0.5", + "uvu": "0.5.6" + } +} diff --git a/packages/rehype-metaobject/tsconfig.json b/packages/rehype-metaobject/tsconfig.json new file mode 100644 index 000000000..f0d8cf437 --- /dev/null +++ b/packages/rehype-metaobject/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib"] +} diff --git a/packages/rehype-parameters/fixtures/000.txt b/packages/rehype-parameters/fixtures/000.txt new file mode 100644 index 000000000..2b3f4063f --- /dev/null +++ b/packages/rehype-parameters/fixtures/000.txt @@ -0,0 +1,9 @@ +ignores an empty document + +--- + + +--- + + +--- diff --git a/packages/rehype-parameters/fixtures/001.txt b/packages/rehype-parameters/fixtures/001.txt new file mode 100644 index 000000000..6609aaf3a --- /dev/null +++ b/packages/rehype-parameters/fixtures/001.txt @@ -0,0 +1,14 @@ +ignores empty content + +--- + + + + + +--- + + + + +--- diff --git a/packages/rehype-parameters/fixtures/002.txt b/packages/rehype-parameters/fixtures/002.txt new file mode 100644 index 000000000..801419ada --- /dev/null +++ b/packages/rehype-parameters/fixtures/002.txt @@ -0,0 +1,17 @@ +ignores content without a descriptions list + +--- + + + +**b** + + + +--- + + +

          b

          +
          + +--- diff --git a/packages/rehype-parameters/fixtures/003.txt b/packages/rehype-parameters/fixtures/003.txt new file mode 100644 index 000000000..482f012db --- /dev/null +++ b/packages/rehype-parameters/fixtures/003.txt @@ -0,0 +1,24 @@ +creates a list of parameters with a single parameter + +--- + + + +- t + + - : d + + + +--- + +
          +
          +
          +t +
          +
          +
          d
          +
          + +--- diff --git a/packages/rehype-parameters/fixtures/004.txt b/packages/rehype-parameters/fixtures/004.txt new file mode 100644 index 000000000..39ede6b61 --- /dev/null +++ b/packages/rehype-parameters/fixtures/004.txt @@ -0,0 +1,34 @@ +creates a list of parameters with multiple parameters + +--- + + + +- a + + - : a.d + +- b + + - : b.d + + + +--- + +
          +
          +
          +a +
          +
          +
          a.d
          +
          +
          +b +
          +
          +
          b.d
          +
          + +--- diff --git a/packages/rehype-parameters/fixtures/005.txt b/packages/rehype-parameters/fixtures/005.txt new file mode 100644 index 000000000..68b9a5c88 --- /dev/null +++ b/packages/rehype-parameters/fixtures/005.txt @@ -0,0 +1,44 @@ +creates a nested list of parameters + +--- + + + +- a + + - : + + a.d + + + + - b + + - : b.d + + + + + +--- + +
          +
          +
          +a +
          +
          +
          +

          a.d

          +
          +
          +
          +b +
          +
          +
          b.d
          +
          +
          +
          + +--- diff --git a/packages/rehype-parameters/fixtures/006.txt b/packages/rehype-parameters/fixtures/006.txt new file mode 100644 index 000000000..5a504669c --- /dev/null +++ b/packages/rehype-parameters/fixtures/006.txt @@ -0,0 +1,24 @@ +creates a list of parameters with badges + +--- + + + +- t, required, format: f, default: d, example: e + + - : d + + + +--- + +
          +
          +
          +trequiredformat: fdefault: dexample: e +
          +
          +
          d
          +
          + +--- diff --git a/packages/rehype-parameters/fixtures/007.txt b/packages/rehype-parameters/fixtures/007.txt new file mode 100644 index 000000000..0edd18bd5 --- /dev/null +++ b/packages/rehype-parameters/fixtures/007.txt @@ -0,0 +1,28 @@ +creates a list of parameters with a signature + +--- + + + +- t + + ```yml signature.variant="inline" + - {type: keyword, text: function} + ``` + + - : d + + + +--- + +
          +
          +
          +tfunction +
          +
          +
          d
          +
          + +--- diff --git a/packages/rehype-parameters/fixtures/008.txt b/packages/rehype-parameters/fixtures/008.txt new file mode 100644 index 000000000..74ae35b84 --- /dev/null +++ b/packages/rehype-parameters/fixtures/008.txt @@ -0,0 +1,28 @@ +creates a list of parameters with a signature and badges + +--- + + + +- t, required + + ```yml signature.variant="inline" + - {type: keyword, text: function} + ``` + + - : d + + + +--- + +
          +
          +
          +tfunctionrequired +
          +
          +
          d
          +
          + +--- diff --git a/packages/rehype-parameters/fixtures/009.txt b/packages/rehype-parameters/fixtures/009.txt new file mode 100644 index 000000000..1584d3007 --- /dev/null +++ b/packages/rehype-parameters/fixtures/009.txt @@ -0,0 +1,24 @@ +creates a list of parameters with escaped commas in badges + +--- + + + +- t, format: \\,f\\,f\\,, default: d + + - : d + + + +--- + +
          +
          +
          +tformat: ,f,f,default: d +
          +
          +
          d
          +
          + +--- diff --git a/packages/rehype-parameters/lib/main.test.ts b/packages/rehype-parameters/lib/main.test.ts new file mode 100644 index 000000000..949c0eaf0 --- /dev/null +++ b/packages/rehype-parameters/lib/main.test.ts @@ -0,0 +1,56 @@ +import {readFile, readdir} from "node:fs/promises" +import path from "node:path" +import {rehypeDescriptionList} from "@onlyoffice/rehype-description-list" +import {rehypeMetaobject} from "@onlyoffice/rehype-metaobject" +import {rehypeMetastring} from "@onlyoffice/rehype-metastring" +import {rehypeSignature} from "@onlyoffice/rehype-signature" +import rehypeRaw from "rehype-raw" +import rehypeStringify from "rehype-stringify" +import remarkParse from "remark-parse" +import remarkRehype from "remark-rehype" +import {unified} from "unified" +import {test} from "uvu" +import {is} from "uvu/assert" +import {rehypeParameters} from "./main.ts" + +for (const [n, v, e] of await list()) { + test(n, async () => { + const f = await unified() + .use(remarkParse) + .use(remarkRehype, {allowDangerousHtml: true}) + .use(rehypeMetastring) + .use(rehypeRaw) + .use(rehypeMetaobject) + .use(rehypeDescriptionList) + .use(rehypeSignature, {onLink: (_, p) => p.id}) + .use(rehypeParameters) + .use(rehypeStringify) + .process(v) + is(f.toString(), e) + }) +} + +test.run() + +type TestCase = [string, string, string] + +async function list(): Promise { + const a: TestCase[] = [] + const d = await readdir("fixtures") + for (const n of d) { + const e = path.extname(n) + const p = path.basename(n, e) + const s = await readFile(`fixtures/${n}`, "utf8") + const c = create(p, s) + a.push(c) + } + return a +} + +function create(p: string, s: string): TestCase { + let [n, m, h] = s.split("\n---\n") + n = n.slice(0, -1) + m = m.slice(1).slice(0, -1) + h = h.slice(1).slice(0, -1) + return [`${p}: ${n}`, m, h] +} diff --git a/packages/rehype-parameters/lib/main.ts b/packages/rehype-parameters/lib/main.ts new file mode 100644 index 000000000..da8937d06 --- /dev/null +++ b/packages/rehype-parameters/lib/main.ts @@ -0,0 +1,212 @@ +import { + Glossary, + GlossaryDetails, + GlossaryTerm, +} from "@onlyoffice/glossary-hastscript" +import { + isCodeElement, + isDdElement, + isDlElement, + isDtElement, + isPElement, +} from "@onlyoffice/hast-util-is-element" +import {isNewlineText, isText} from "@onlyoffice/hast-util-is-text" +import { + type Children, + type Component, + Spacer as S, + h, + render, +} from "@onlyoffice/hastscript" +import {BadgeGroup} from "@onlyoffice/ui-badge-group-hastscript" +import {Badge, BadgeCaption} from "@onlyoffice/ui-badge-hastscript" +import {type Element, type Root} from "hast" +import {CONTINUE, visit} from "unist-util-visit" + +export interface RehypeParametersTransform { + (tree: Root): void +} + +export function rehypeParameters(): RehypeParametersTransform { + return function transform(t) { + visit(t, "element", (n, i, p) => { + if ( + !p || + i === undefined || + n.tagName !== "parameters" + ) { + return + } + + for (const c of n.children) { + if (!isDlElement(c)) { + continue + } + + const r = convertDl(c) + p.children[i] = render(r) + + return [CONTINUE, i] + } + }) + } +} + +function convertDl(e: Element): Component { + const t: Children = [] + + for (const c of e.children) { + if (isDtElement(c)) { + const r = convertDt(c) + t.push(r, "\n") + continue + } + + if (isDdElement(c)) { + const r = convertDd(c) + t.push(r, "\n") + continue + } + } + + if (t.length !== 0) { + const c = t[t.length - 1] + if (typeof c === "string" && c === "\n") { + t.pop() + } + } + + return h(Glossary, [ + h(S, t), + ]) +} + +function convertDt(e: Element): Component { + const t0: Component[] = [] + const t1: Component[] = [] + const t2: Component[] = [] + + let p = false + let s = false + + for (const x of e.children) { + if (p && s) { + break + } + + if (isPElement(x) && !p) { + for (const y of x.children) { + if (!isText(y)) { + continue + } + + const a = split(y.value) + if (a.length === 0) { + break + } + + const [n] = a + if (n) { + const c = h(Badge, {variant: "calm"}, [n]) + t0.push(c) + } + + for (let i = 1; i < a.length; i += 1) { + const s = a[i] + + if (s === "required") { + const c = h(Badge, {variant: "critical"}, ["required"]) + t2.push(c) + continue + } + + for (const b of ["format", "default", "example"]) { + const p = `${b}: ` + if (!s.startsWith(p)) { + continue + } + + const c = h(Badge, {variant: "neutral"}, [ + h(BadgeCaption, [p]), + s.slice(p.length), + ]) + t2.push(c) + break + } + } + + break + } + + p = true + continue + } + + if (isCodeElement(x) && !s) { + const c = h(Badge, {variant: "transparent"}, [x]) + t1.push(c) + + s = true + continue + } + } + + const t = [...t0, ...t1, ...t2] + + return h(GlossaryTerm, [ + t.length !== 0 && h(S, [ + h(BadgeGroup, [ + h(S, t), + ]), + ]), + ]) +} + +function convertDd(e: Element): Component { + const t = [...e.children] + if (t.length !== 0) { + const [c] = t + if (isNewlineText(c)) { + t.shift() + } + } + + return h(GlossaryDetails, t) +} + +function split(s: string): string[] { + const r = [] + + let t = "" + let w = true + let e = false + + for (const c of s) { + if (c === "\\" && !e) { + e = true + continue + } + + if (c === "," && !e) { + r.push(t) + t = "" + w = true + continue + } + + if (w && c === " ") { + continue + } + + t += c + w = false + e = false + } + + if (t) { + t = t.trimEnd() + r.push(t) + } + + return r +} diff --git a/packages/rehype-parameters/package.json b/packages/rehype-parameters/package.json new file mode 100644 index 000000000..6029f1cec --- /dev/null +++ b/packages/rehype-parameters/package.json @@ -0,0 +1,39 @@ +{ + "name": "@onlyoffice/rehype-parameters", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@onlyoffice/glossary-hastscript": "workspace:^", + "@onlyoffice/hast-util-is-element": "workspace:^", + "@onlyoffice/hast-util-is-text": "workspace:^", + "@onlyoffice/hastscript": "workspace:^", + "@onlyoffice/ui-badge-group-hastscript": "workspace:^", + "@onlyoffice/ui-badge-hastscript": "workspace:^", + "@types/hast": "3.0.4", + "typescript": "5.4.5", + "unist-util-visit": "5.0.0" + }, + "devDependencies": { + "@onlyoffice/rehype-description-list": "workspace:^", + "@onlyoffice/rehype-metaobject": "workspace:^", + "@onlyoffice/rehype-metastring": "workspace:^", + "@onlyoffice/rehype-signature": "workspace:^", + "c8": "9.1.0", + "rehype-parse": "9.0.0", + "rehype-raw": "7.0.0", + "rehype-stringify": "10.0.0", + "remark-parse": "11.0.0", + "remark-rehype": "11.1.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "unified": "11.0.5", + "uvu": "0.5.6" + } +} diff --git a/packages/rehype-parameters/tsconfig.json b/packages/rehype-parameters/tsconfig.json new file mode 100644 index 000000000..02f06a977 --- /dev/null +++ b/packages/rehype-parameters/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib", "index.d.ts"] +} diff --git a/packages/rehype-references/fixtures/000.txt b/packages/rehype-references/fixtures/000.txt new file mode 100644 index 000000000..2b3f4063f --- /dev/null +++ b/packages/rehype-references/fixtures/000.txt @@ -0,0 +1,9 @@ +ignores an empty document + +--- + + +--- + + +--- diff --git a/packages/rehype-references/fixtures/001.txt b/packages/rehype-references/fixtures/001.txt new file mode 100644 index 000000000..f4a9d1558 --- /dev/null +++ b/packages/rehype-references/fixtures/001.txt @@ -0,0 +1,14 @@ +ignores empty content + +--- + + + + + +--- + + + + +--- diff --git a/packages/rehype-references/fixtures/002.txt b/packages/rehype-references/fixtures/002.txt new file mode 100644 index 000000000..4690e996d --- /dev/null +++ b/packages/rehype-references/fixtures/002.txt @@ -0,0 +1,17 @@ +ignores content without a descriptions list + +--- + + + +**b** + + + +--- + + +

          b

          +
          + +--- diff --git a/packages/rehype-references/fixtures/003.txt b/packages/rehype-references/fixtures/003.txt new file mode 100644 index 000000000..3f10b922b --- /dev/null +++ b/packages/rehype-references/fixtures/003.txt @@ -0,0 +1,21 @@ +creates a list of references with a single reference + +--- + + + +- [t](.) + - : d + + + +--- + +
          +
          +t +
          +
          d
          +
          + +--- diff --git a/packages/rehype-references/fixtures/004.txt b/packages/rehype-references/fixtures/004.txt new file mode 100644 index 000000000..b3bed2ccb --- /dev/null +++ b/packages/rehype-references/fixtures/004.txt @@ -0,0 +1,27 @@ +creates a list of references with multiple references + +--- + + + +- [a](.) + - : a.d +- [b](.) + - : b.d + + + +--- + +
          +
          +a +
          +
          a.d
          +
          +b +
          +
          b.d
          +
          + +--- diff --git a/packages/rehype-references/lib/main.test.ts b/packages/rehype-references/lib/main.test.ts new file mode 100644 index 000000000..2806ea487 --- /dev/null +++ b/packages/rehype-references/lib/main.test.ts @@ -0,0 +1,50 @@ +import {readFile, readdir} from "node:fs/promises" +import path from "node:path" +import {rehypeDescriptionList} from "@onlyoffice/rehype-description-list" +import rehypeRaw from "rehype-raw" +import rehypeStringify from "rehype-stringify" +import remarkParse from "remark-parse" +import remarkRehype from "remark-rehype" +import {unified} from "unified" +import {test} from "uvu" +import {is} from "uvu/assert" +import {rehypeReferences} from "./main.ts" + +for (const [n, v, e] of await list()) { + test(n, async () => { + const f = await unified() + .use(remarkParse) + .use(remarkRehype, {allowDangerousHtml: true}) + .use(rehypeRaw) + .use(rehypeDescriptionList) + .use(rehypeReferences) + .use(rehypeStringify) + .process(v) + is(f.toString(), e) + }) +} + +test.run() + +type TestCase = [string, string, string] + +async function list(): Promise { + const a: TestCase[] = [] + const d = await readdir("fixtures") + for (const n of d) { + const e = path.extname(n) + const p = path.basename(n, e) + const s = await readFile(`fixtures/${n}`, "utf8") + const c = create(p, s) + a.push(c) + } + return a +} + +function create(p: string, s: string): TestCase { + let [n, m, h] = s.split("\n---\n") + n = n.slice(0, -1) + m = m.slice(1).slice(0, -1) + h = h.slice(1).slice(0, -1) + return [`${p}: ${n}`, m, h] +} diff --git a/packages/rehype-references/lib/main.ts b/packages/rehype-references/lib/main.ts new file mode 100644 index 000000000..8c7b480e1 --- /dev/null +++ b/packages/rehype-references/lib/main.ts @@ -0,0 +1,140 @@ +import { + Glossary, + GlossaryDetails, + GlossaryName, + GlossaryTerm, +} from "@onlyoffice/glossary-hastscript" +import { + isAElement, + // isCodeElement, + isDdElement, + isDlElement, + isDtElement, + // isPElement, +} from "@onlyoffice/hast-util-is-element" +// import {isNewlineText} from "@onlyoffice/hast-util-is-text" +import { + type Children, + type Component, + // Fragment as F, + Spacer as S, + h, + render, +} from "@onlyoffice/hastscript" +import {type Element, type Root} from "hast" +import {CONTINUE, visit} from "unist-util-visit" + +export interface RehypeReferencesTransform { + (tree: Root): void +} + +export function rehypeReferences(): RehypeReferencesTransform { + return function transform(t) { + visit(t, "element", (n, i, p) => { + if ( + !p || + i === undefined || + n.tagName !== "references" + ) { + return + } + + for (const c of n.children) { + if (!isDlElement(c)) { + continue + } + + const r = convertDl(c) + p.children[i] = render(r) + + return [CONTINUE, i] + } + }) + } +} + +function convertDl(e: Element): Component { + const t: Children = [] + + for (const c of e.children) { + if (isDtElement(c)) { + const r = convertDt(c) + t.push(r, "\n") + continue + } + + if (isDdElement(c)) { + const r = convertDd(c) + t.push(r, "\n") + continue + } + } + + if (t.length !== 0) { + const c = t[t.length - 1] + if (typeof c === "string" && c === "\n") { + t.pop() + } + } + + return h(Glossary, [ + h(S, t), + ]) +} + +function convertDt(e: Element): Component { + const t0: Component[] = [] + const t1: Component[] = [] + + let p = false + // let s = false + + for (const x of e.children) { + if (p) { + break + } + + // if (p && s) { + // break + // } + + if (isAElement(x) && !p) { + const c = h(GlossaryName, [x]) + t0.push(c) + p = true + continue + } + + // if (isPElement(x) && !p) { + // const c = h(GlossaryName, x.children) + // t0.push(c) + // p = true + // continue + // } + + // if (isCodeElement(x) && !s) { + // const c = h(F, [x]) + // t1.push(c) + // s = true + // continue + // } + } + + const t = [...t0, ...t1] + + return h(GlossaryTerm, [ + t.length !== 0 && h(S, t), + ]) +} + +function convertDd(e: Element): Component { + // const t = [...e.children] + // if (t.length !== 0) { + // const [c] = t + // if (isNewlineText(c)) { + // t.shift() + // } + // } + + return h(GlossaryDetails, e.children) +} diff --git a/packages/rehype-references/package.json b/packages/rehype-references/package.json new file mode 100644 index 000000000..88eae36cb --- /dev/null +++ b/packages/rehype-references/package.json @@ -0,0 +1,34 @@ +{ + "name": "@onlyoffice/rehype-references", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@onlyoffice/glossary-hastscript": "workspace:^", + "@onlyoffice/hast-util-is-element": "workspace:^", + "@onlyoffice/hast-util-is-text": "workspace:^", + "@onlyoffice/hastscript": "workspace:^", + "@types/hast": "3.0.4", + "typescript": "5.4.5", + "unist-util-visit": "5.0.0" + }, + "devDependencies": { + "@onlyoffice/rehype-description-list": "workspace:^", + "c8": "9.1.0", + "rehype-parse": "9.0.0", + "rehype-raw": "7.0.0", + "rehype-stringify": "10.0.0", + "remark-parse": "11.0.0", + "remark-rehype": "11.1.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "unified": "11.0.5", + "uvu": "0.5.6" + } +} diff --git a/packages/rehype-references/tsconfig.json b/packages/rehype-references/tsconfig.json new file mode 100644 index 000000000..f0d8cf437 --- /dev/null +++ b/packages/rehype-references/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib"] +} diff --git a/packages/rehype-signature/fixtures/000.txt b/packages/rehype-signature/fixtures/000.txt new file mode 100644 index 000000000..2b3f4063f --- /dev/null +++ b/packages/rehype-signature/fixtures/000.txt @@ -0,0 +1,9 @@ +ignores an empty document + +--- + + +--- + + +--- diff --git a/packages/rehype-signature/fixtures/001.txt b/packages/rehype-signature/fixtures/001.txt new file mode 100644 index 000000000..98b10a789 --- /dev/null +++ b/packages/rehype-signature/fixtures/001.txt @@ -0,0 +1,12 @@ +ignores an empty fenced code block + +--- + +``` +``` + +--- + +
          + +--- diff --git a/packages/rehype-signature/fixtures/002.txt b/packages/rehype-signature/fixtures/002.txt new file mode 100644 index 000000000..03f9d4993 --- /dev/null +++ b/packages/rehype-signature/fixtures/002.txt @@ -0,0 +1,12 @@ +ignores a fenced code block without language + +--- + +``` +``` + +--- + +
          + +--- diff --git a/packages/rehype-signature/fixtures/003.txt b/packages/rehype-signature/fixtures/003.txt new file mode 100644 index 000000000..0484bb48a --- /dev/null +++ b/packages/rehype-signature/fixtures/003.txt @@ -0,0 +1,12 @@ +ignores a fenced code block without content + +--- + +```js +``` + +--- + +
          + +--- diff --git a/packages/rehype-signature/fixtures/004.txt b/packages/rehype-signature/fixtures/004.txt new file mode 100644 index 000000000..c2a937fb3 --- /dev/null +++ b/packages/rehype-signature/fixtures/004.txt @@ -0,0 +1,14 @@ +ignores a fenced code block without properties + +--- + +```yml +- {type: keyword, text: function} +``` + +--- + +
          - {type: keyword, text: function}
          +
          + +--- diff --git a/packages/rehype-signature/fixtures/005.txt b/packages/rehype-signature/fixtures/005.txt new file mode 100644 index 000000000..018693a1b --- /dev/null +++ b/packages/rehype-signature/fixtures/005.txt @@ -0,0 +1,14 @@ +ignores a fenced code block with unsupported language + +--- + +```js signature +[{type: keyword, text: function}] +``` + +--- + +
          [{type: keyword, text: function}]
          +
          + +--- diff --git a/packages/rehype-signature/fixtures/006.txt b/packages/rehype-signature/fixtures/006.txt new file mode 100644 index 000000000..61beec0c0 --- /dev/null +++ b/packages/rehype-signature/fixtures/006.txt @@ -0,0 +1,13 @@ +creates a signature with yml language + +--- + +```yml signature +- {type: keyword, text: function} +``` + +--- + +
          function
          + +--- diff --git a/packages/rehype-signature/fixtures/007.txt b/packages/rehype-signature/fixtures/007.txt new file mode 100644 index 000000000..6011e4ba2 --- /dev/null +++ b/packages/rehype-signature/fixtures/007.txt @@ -0,0 +1,13 @@ +creates a signature with yaml language + +--- + +```yaml signature +- {type: keyword, text: function} +``` + +--- + +
          function
          + +--- diff --git a/packages/rehype-signature/fixtures/008.txt b/packages/rehype-signature/fixtures/008.txt new file mode 100644 index 000000000..c8f55fda9 --- /dev/null +++ b/packages/rehype-signature/fixtures/008.txt @@ -0,0 +1,13 @@ +creates a signature with custom properties + +--- + +```yml signature.variant="inline" +- {type: keyword, text: function} +``` + +--- + +function + +--- diff --git a/packages/rehype-signature/fixtures/009.txt b/packages/rehype-signature/fixtures/009.txt new file mode 100644 index 000000000..03d1559b9 --- /dev/null +++ b/packages/rehype-signature/fixtures/009.txt @@ -0,0 +1,13 @@ +creates a signature without onLink event + +--- + +```yml signature +- {id: "#", token: {type: "entity", text: "a"}} +``` + +--- + +
          a
          + +--- diff --git a/packages/rehype-signature/fixtures/010.txt b/packages/rehype-signature/fixtures/010.txt new file mode 100644 index 000000000..3fceaf4eb --- /dev/null +++ b/packages/rehype-signature/fixtures/010.txt @@ -0,0 +1,13 @@ +creates a signature with onLink event + +--- + +```yml signature test.id="#" +- {id: "#", token: {type: "entity", text: "a"}} +``` + +--- + +
          a
          + +--- diff --git a/packages/rehype-signature/index.d.ts b/packages/rehype-signature/index.d.ts new file mode 100644 index 000000000..2c1420fc7 --- /dev/null +++ b/packages/rehype-signature/index.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/rehype-signature/lib/main.test.ts b/packages/rehype-signature/lib/main.test.ts new file mode 100644 index 000000000..912c8f403 --- /dev/null +++ b/packages/rehype-signature/lib/main.test.ts @@ -0,0 +1,74 @@ +import {readFile, readdir} from "node:fs/promises" +import path from "node:path" +import {isCodeElement} from "@onlyoffice/hast-util-is-element" +import {rehypeMetaobject} from "@onlyoffice/rehype-metaobject" +import {rehypeMetastring} from "@onlyoffice/rehype-metastring" +import {type Metaobject, type Root} from "hast" +import rehypeRaw from "rehype-raw" +import rehypeStringify from "rehype-stringify" +import remarkParse from "remark-parse" +import remarkRehype from "remark-rehype" +import {unified} from "unified" +import {visit} from "unist-util-visit" +import {test} from "uvu" +import {is} from "uvu/assert" +import {rehypeSignature} from "./main.ts" + +for (const [n, v, e] of await list()) { + test(n, async () => { + let m: Metaobject & {test?: {id: string}} = {} + + const f = await unified() + .use(remarkParse) + .use(remarkRehype) + .use(rehypeMetastring) + .use(rehypeRaw) + .use(rehypeMetaobject) + .use(() => { + return function transform(t: Root) { + visit(t, "element", (n) => { + if (isCodeElement(n) && n.properties.metaobject) { + m = n.properties.metaobject + } + }) + } + }) + .use(rehypeSignature, { + onLink() { + if (m.test && m.test.id) { + return m.test.id + } + return "" + }, + }) + .use(rehypeStringify) + .process(v) + + is(f.toString(), e) + }) +} + +test.run() + +type TestCase = [string, string, string] + +async function list(): Promise { + const a: TestCase[] = [] + const d = await readdir("fixtures") + for (const n of d) { + const e = path.extname(n) + const p = path.basename(n, e) + const s = await readFile(`fixtures/${n}`, "utf8") + const c = create(p, s) + a.push(c) + } + return a +} + +function create(p: string, s: string): TestCase { + let [n, m, h] = s.split("\n---\n") + n = n.slice(0, -1) + m = m.slice(1).slice(0, -1) + h = h.slice(1).slice(0, -1) + return [`${p}: ${n}`, m, h] +} diff --git a/packages/rehype-signature/lib/main.ts b/packages/rehype-signature/lib/main.ts new file mode 100644 index 000000000..26d6ba87b --- /dev/null +++ b/packages/rehype-signature/lib/main.ts @@ -0,0 +1,112 @@ +import {isCodeElement, isPreElement} from "@onlyoffice/hast-util-is-element" +import {isText} from "@onlyoffice/hast-util-is-text" +import {Fragment as F, h, render} from "@onlyoffice/hastscript" +import {type Reference} from "@onlyoffice/signature" +import { + Signature, + type SignaturePropertiesBase, + SignatureReference, + type SignatureVariant, +} from "@onlyoffice/signature-hastscript" +import {type Element, type Root} from "hast" +import {visit} from "unist-util-visit" +import {type VFile} from "vfile" +import yaml from "yaml" + +declare module "hast" { + interface Metaobject { + signature?: MetaobjectSignature + } +} + +export interface MetaobjectSignature { + variant?: SignatureVariant +} + +export interface RehypeSignatureParameters { + onLink(this: void, f: VFile, t: Reference): string +} + +export interface RehypeSignatureTransform { + (t: Root, f: VFile): void +} + +export function rehypeSignature( + p: RehypeSignatureParameters, +): RehypeSignatureTransform { + const {onLink} = p + + return function transform(t, f) { + visit(t, "element", (n, i, p) => { + if (!p || i === undefined || !isPreElement(n)) { + return + } + + const [c] = n.children + if (!isCodeElement(c)) { + return + } + + const [t] = c.children + if (!isText(t)) { + return + } + + const m = c.properties.metaobject + if (!m) { + return + } + + const y = language(c) + if (!isYaml(y)) { + return + } + + const b: SignaturePropertiesBase = { + signature: [], + } + + if (m.signature) { + b.variant = m.signature.variant + } + + // Should the error be wrapped here? + b.signature = yaml.parse(t.value) + + // Here, many things that could be attached to a node are lost, such as + // metastring, metaobject, classes, and so on. Is this a bug or a feature? + p.children[i] = render( + h(Signature, b, [ + h(SignatureReference, [ + (p, ch) => { + const u = onLink(f, p.reference) + if (!u) { + return h(F, ch) + } + return h("a", {href: u}, ch) + }, + ]), + ]), + ) + }) + } +} + +function isYaml(u: unknown): u is string { + return typeof u === "string" && (u === "yml" || u === "yaml") +} + +function language(n: Element): string { + const c = n.properties.className + if (!Array.isArray(c)) { + return "" + } + + for (const s of c) { + if (typeof s === "string" && s.startsWith("language-")) { + return s.slice(9) + } + } + + return "" +} diff --git a/packages/rehype-signature/package.json b/packages/rehype-signature/package.json new file mode 100644 index 000000000..380fab2a6 --- /dev/null +++ b/packages/rehype-signature/package.json @@ -0,0 +1,37 @@ +{ + "name": "@onlyoffice/rehype-signature", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@onlyoffice/hast-util-is-element": "workspace:^", + "@onlyoffice/hast-util-is-text": "workspace:^", + "@onlyoffice/hastscript": "workspace:^", + "@onlyoffice/signature": "workspace:^", + "@onlyoffice/signature-hastscript": "workspace:^", + "@types/hast": "3.0.4", + "typescript": "5.4.5", + "unist-util-visit": "5.0.0", + "vfile": "6.0.1", + "yaml": "2.4.1" + }, + "devDependencies": { + "@onlyoffice/rehype-metaobject": "workspace:^", + "@onlyoffice/rehype-metastring": "workspace:^", + "c8": "9.1.0", + "rehype-raw": "7.0.0", + "rehype-stringify": "10.0.0", + "remark-parse": "11.0.0", + "remark-rehype": "11.1.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "unified": "11.0.5", + "uvu": "0.5.6" + } +} diff --git a/packages/rehype-signature/tsconfig.json b/packages/rehype-signature/tsconfig.json new file mode 100644 index 000000000..02f06a977 --- /dev/null +++ b/packages/rehype-signature/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib", "index.d.ts"] +} diff --git a/packages/remark-config/lib/main.ts b/packages/remark-config/lib/main.ts index 10d73f0f7..2349bfb10 100644 --- a/packages/remark-config/lib/main.ts +++ b/packages/remark-config/lib/main.ts @@ -93,6 +93,7 @@ export function remarkConfig(): Preset { "ini", "java", "json", + "json5", "kt", // kotlin, "php", "ps1", // powershell, diff --git a/packages/signature-hastscript/lib/main.test.ts b/packages/signature-hastscript/lib/main.test.ts new file mode 100644 index 000000000..19648661e --- /dev/null +++ b/packages/signature-hastscript/lib/main.test.ts @@ -0,0 +1,87 @@ +import {type Component, h, render} from "@onlyoffice/hastscript" +import {test} from "uvu" +import {equal as eq} from "uvu/assert" +import {Signature, SignatureReference} from "./main.ts" + +test("Signature(): creates an empty signature", () => { + const a = h(Signature) + const e = h("pre", {class: "signature"}, [h("code")]) + re(a, e) +}) + +test("Signature(): creates a signature with a default variant", () => { + const a = h(Signature, {variant: "default"}) + const e = h("pre", {class: "signature signature_variant_default"}, [h("code")]) + re(a, e) +}) + +test("Signature(): creates a signature with a block variant", () => { + const a = h(Signature, {variant: "block"}) + const e = h("pre", {class: "signature signature_variant_block"}, [h("code")]) + re(a, e) +}) + +test("Signature(): creates a signature with an inline variant", () => { + const a = h(Signature, {variant: "inline"}) + const e = h("code", {class: "signature signature_variant_inline"}) + re(a, e) +}) + +test("Signature(): creates a signature with an empty signature", () => { + const a = h(Signature, {signature: []}) + const e = h("pre", {class: "signature"}, [h("code")]) + re(a, e) +}) + +test("Signature(): creates a signature with a non-empty signature", () => { + const a = h(Signature, { + signature: [ + {type: "entity", text: "e"}, + {type: "keyword", text: "k"}, + {type: "noop"}, + {type: "parameter", text: "p"}, + {type: "string", text: "s"}, + {type: "text", text: "t"}, + {type: "type", text: "t"}, + {id: "#", token: {type: "entity", text: "e"}}, + ], + }) + const e = h("pre", {class: "signature"}, [ + h("code", [ + h("span", {class: "sg-en"}, ["e"]), + h("span", {class: "sg-kw"}, ["k"]), + h("span", {class: "sg-pm"}, ["p"]), + h("span", {class: "sg-st"}, ["s"]), + "t", + h("span", {class: "sg-tp"}, ["t"]), + h("span", {class: "sg-en"}, ["e"]), + ]), + ]) + re(a, e) +}) + +test("SignatureReference(): creates a signature with a reference", () => { + const a = h(Signature, { + signature: [ + {id: "#", token: {type: "entity", text: "e"}}, + ], + }, [ + h(SignatureReference, [ + (p, ch) => h("a", {href: p.reference.id}, ch), + ]), + ]) + const e = h("pre", {class: "signature"}, [ + h("code", [ + h("a", {href: "#"}, [ + h("span", {class: "sg-en"}, ["e"]), + ]), + ]), + ]) + re(a, e) +}) + +test.run() + +function re(a: Component, e: Component): void { + eq(render(a), render(e)) +} diff --git a/packages/signature-hastscript/lib/main.ts b/packages/signature-hastscript/lib/main.ts new file mode 100644 index 000000000..c809cdac0 --- /dev/null +++ b/packages/signature-hastscript/lib/main.ts @@ -0,0 +1,202 @@ +import { + type Children, + type Component, + Fragment as F, + createContext, + h, + useContext, +} from "@onlyoffice/hastscript" +import type * as E from "@onlyoffice/hastscript/elements.ts" +import type * as Sg from "@onlyoffice/signature" +import {clsx} from "clsx" + +class Context { + Reference: SignatureReferenceChild = (_: object, ch: Children) => h(F, ch) +} + +const ctx = createContext(new Context()) + +export type SignatureProperties = + DefaultSignatureProperties | + BlockSignatureProperties | + InlineSignatureProperties + +interface DefaultSignatureProperties extends + SignaturePropertiesBase, + E.PreProperties { + variant?: "default" +} + +interface BlockSignatureProperties extends + SignaturePropertiesBase, + E.PreProperties { + variant: "block" +} + +interface InlineSignatureProperties extends + SignaturePropertiesBase, + E.CodeProperties { + variant: "inline" +} + +export interface SignaturePropertiesBase { + variant?: SignatureVariant + signature?: Sg.Signature +} + +export type SignatureVariant = "default" | "block" | "inline" + +export function Signature(p: SignatureProperties, ch: Children): Component { + const {signature = []} = p + + return h(ctx.Provider, {value: new Context()}, [ + ...ch, + h(Root, p, [ + h(Base, {signature}), + ]), + ]) +} + +export interface SignatureReferenceChild { + (p: SignatureReferenceChildProperties, ch: Children): Component +} + +export interface SignatureReferenceChildProperties { + reference: Sg.Reference +} + +export function SignatureReference( + _: object, + ch: SignatureReferenceChild[], +): Component { + const x = useContext(ctx) + ;[x.Reference] = ch + return h(F) +} + +function Root(p: SignatureProperties, ch: Children): Component { + const {signature, ...o} = p + + o.class = clsx( + "signature", + o.variant && `signature_variant_${o.variant}`, + o.class, + ) + + if (o.variant === "inline") { + const {variant, ...a} = o + return h("code", a, ch) + } + + const {variant, ...a} = o + + return h("pre", a, [ + h("code", ch), + ]) +} + +interface BaseProperties { + signature: Sg.Signature +} + +function Base(p: BaseProperties): Component { + const ch: Children = [] + + for (const t of p.signature) { + let c: Component + + if ("id" in t) { + c = h(Reference, {reference: t}) + } else { + c = h(Token, {token: t}) + } + + ch.push(c) + } + + return h(F, ch) +} + +interface TokenProperties { + token: Sg.Token +} + +function Token(p: TokenProperties): Component { + switch (p.token.type) { + case "entity": + return h(EntityToken, {token: p.token}) + case "keyword": + return h(KeywordToken, {token: p.token}) + case "noop": + return h(F) + case "parameter": + return h(ParameterToken, {token: p.token}) + case "string": + return h(StringToken, {token: p.token}) + case "text": + return h(TextToken, {token: p.token}) + case "type": + return h(TypeToken, {token: p.token}) + } + return h(F) +} + +interface EntityTokenProperties { + token: Sg.EntityToken +} + +function EntityToken(p: EntityTokenProperties): Component { + return h("span", {class: "sg-en"}, [p.token.text]) +} + +interface KeywordTokenProperties { + token: Sg.KeywordToken +} + +function KeywordToken(p: KeywordTokenProperties): Component { + return h("span", {class: "sg-kw"}, [p.token.text]) +} + +interface ParameterTokenProperties { + token: Sg.ParameterToken +} + +function ParameterToken(p: ParameterTokenProperties): Component { + return h("span", {class: "sg-pm"}, [p.token.text]) +} + +interface StringTokenProperties { + token: Sg.StringToken +} + +function StringToken(p: StringTokenProperties): Component { + return h("span", {class: "sg-st"}, [p.token.text]) +} + +interface TextTokenProperties { + token: Sg.TextToken +} + +function TextToken(p: TextTokenProperties): Component { + return h(F, [p.token.text]) +} + +interface TypeTokenProperties { + token: Sg.TypeToken +} + +function TypeToken(p: TypeTokenProperties): Component { + return h("span", {class: "sg-tp"}, [p.token.text]) +} + +interface ReferenceProperties { + reference: Sg.Reference +} + +function Reference(p: ReferenceProperties): Component { + const {Reference} = useContext(ctx) + + return h(Reference, {reference: p.reference}, [ + h(Token, {token: p.reference.token}), + ]) +} diff --git a/packages/signature-hastscript/package.json b/packages/signature-hastscript/package.json new file mode 100644 index 000000000..38d9ad5f3 --- /dev/null +++ b/packages/signature-hastscript/package.json @@ -0,0 +1,24 @@ +{ + "name": "@onlyoffice/signature-hastscript", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@onlyoffice/hastscript": "workspace:^", + "@onlyoffice/signature": "workspace:^", + "clsx": "2.1.0", + "typescript": "5.4.5" + }, + "devDependencies": { + "c8": "9.1.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "uvu": "0.5.6" + } +} diff --git a/packages/signature-hastscript/tsconfig.json b/packages/signature-hastscript/tsconfig.json new file mode 100644 index 000000000..f0d8cf437 --- /dev/null +++ b/packages/signature-hastscript/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib"] +} diff --git a/packages/site-document-editor-playground/lib/client/element.ts b/packages/site-document-editor-playground/lib/client/element.ts index 6a9ee3f08..7ceb8dbdb 100644 --- a/packages/site-document-editor-playground/lib/client/element.ts +++ b/packages/site-document-editor-playground/lib/client/element.ts @@ -7,7 +7,7 @@ import {ComboboxContainer, ComboboxContainerChangeEvent, ComboboxContainerChangedEvent} from "@onlyoffice/combobox-container-html-element" import * as configSample from "@onlyoffice/document-editor-code-sample" -import {DocumentEditor, type DocumentEditorEventHandlerName} from "@onlyoffice/document-editor-html-element" +import {DocumentEditor, type DocumentEditorEventHandlerName, type DocumentEditorEventType} from "@onlyoffice/document-editor-html-element" import {DocumentEditorMirror} from "@onlyoffice/document-editor-mirror-html-element" import {type DocEditorConfigEvents, type DocEditorConfigurableOptions} from "@onlyoffice/document-server-types" import {type Client} from "@onlyoffice/server-client" @@ -762,10 +762,12 @@ export class DocumentEditorPlayground extends HTMLElement { } if (!de.editor) { + de.eventList.add("documenteditorappready") de.ondocumenteditorappready = this.play.bind(this) return } + de.eventList.remove("documenteditorappready") de.ondocumenteditorappready = null const cf = this.#currentConfig @@ -792,14 +794,23 @@ export class DocumentEditorPlayground extends HTMLElement { return } + for (const [, n] of this.#documentEditorHandlers.entries()) { + const en = `documenteditor${n.toLocaleLowerCase().slice(2)}` as DocumentEditorEventType + const hn = `on${en}` as DocumentEditorEventHandlerName + de.eventList.remove(en) + de[hn] = null + } this.#documentEditorHandlers.clear() + em.ondocumenteditormirrorconsoleerror = null em.ondocumenteditormirrorconsolelog = null em.ondocumenteditormirrorthrow = null if (events) { for (const [n, fn] of Object.entries(events)) { - const hn = `ondocumenteditor${n.toLocaleLowerCase().slice(2)}` + const en = `documenteditor${n.toLocaleLowerCase().slice(2)}` as DocumentEditorEventType + + const hn = `on${en}` if (!DocumentEditor.isDocumentEditorEventHandlerName(hn)) { const er = new Error(`The '${hn}' (${n}) event does not exist in the DocumentEditor`) const ev = new DocumentEditorPlaygroundErrorEvent({ @@ -811,8 +822,9 @@ export class DocumentEditorPlayground extends HTMLElement { continue } - this.#documentEditorHandlers.set(hn, n) + de.eventList.add(en) de[hn] = new Function(fn) as EventListener + this.#documentEditorHandlers.set(hn, n) } em.ondocumenteditormirrorconsolelog = this.#handleDocumentEditorMirrorEvent.bind(this) diff --git a/packages/ui-badge-group-hastscript/lib/main.test.ts b/packages/ui-badge-group-hastscript/lib/main.test.ts new file mode 100644 index 000000000..cc28cccb6 --- /dev/null +++ b/packages/ui-badge-group-hastscript/lib/main.test.ts @@ -0,0 +1,28 @@ +import {type Component, h, render} from "@onlyoffice/hastscript" +import {test} from "uvu" +import {equal as eq} from "uvu/assert" +import {BadgeGroup} from "./main.ts" + +test("BadgeGroup(): creates a badge group", () => { + const a = h(BadgeGroup) + const e = h("div", {class: "badge-group"}) + re(a, e) +}) + +test("BadgeGroup(): creates a badge group with properties", () => { + const a = h(BadgeGroup, {id: "d", class: "c"}) + const e = h("div", {class: "badge-group c", id: "d"}) + re(a, e) +}) + +test("BadgeGroup(): creates a badge group with children", () => { + const a = h(BadgeGroup, ["c"]) + const e = h("div", {class: "badge-group"}, ["c"]) + re(a, e) +}) + +test.run() + +function re(a: Component, e: Component): void { + eq(render(a), render(e)) +} diff --git a/packages/ui-badge-group-hastscript/lib/main.ts b/packages/ui-badge-group-hastscript/lib/main.ts new file mode 100644 index 000000000..d98251345 --- /dev/null +++ b/packages/ui-badge-group-hastscript/lib/main.ts @@ -0,0 +1,9 @@ +import {type Children, type Component, h} from "@onlyoffice/hastscript" +import type * as E from "@onlyoffice/hastscript/elements.ts" +import {clsx} from "clsx" + +export function BadgeGroup(p: E.DivProperties, ch: Children): Component { + const {...o} = p + o.class = clsx("badge-group", o.class) + return h("div", o, ch) +} diff --git a/packages/ui-badge-group-hastscript/package.json b/packages/ui-badge-group-hastscript/package.json new file mode 100644 index 000000000..86e75bf14 --- /dev/null +++ b/packages/ui-badge-group-hastscript/package.json @@ -0,0 +1,23 @@ +{ + "name": "@onlyoffice/ui-badge-group-hastscript", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@onlyoffice/hastscript": "workspace:^", + "clsx": "2.1.0", + "typescript": "5.4.5" + }, + "devDependencies": { + "c8": "9.1.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "uvu": "0.5.6" + } +} diff --git a/packages/ui-badge-group-hastscript/tsconfig.json b/packages/ui-badge-group-hastscript/tsconfig.json new file mode 100644 index 000000000..f0d8cf437 --- /dev/null +++ b/packages/ui-badge-group-hastscript/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib"] +} diff --git a/packages/ui-badge-hastscript/lib/main.test.ts b/packages/ui-badge-hastscript/lib/main.test.ts new file mode 100644 index 000000000..fbbbf2e9a --- /dev/null +++ b/packages/ui-badge-hastscript/lib/main.test.ts @@ -0,0 +1,52 @@ +import {type Component, h, render} from "@onlyoffice/hastscript" +import {test} from "uvu" +import {equal as eq} from "uvu/assert" +import {Badge, BadgeCaption} from "./main.ts" + +test("BadgeCaption(): creates a badge caption", () => { + const a = h(BadgeCaption) + const e = h("span", {class: "badge__caption"}) + re(a, e) +}) + +test("BadgeCaption(): creates a badge caption with properties", () => { + const a = h(BadgeCaption, {id: "d", class: "c"}) + const e = h("span", {class: "badge__caption c", id: "d"}) + re(a, e) +}) + +test("BadgeCaption(): creates a badge caption with children", () => { + const a = h(BadgeCaption, ["c"]) + const e = h("span", {class: "badge__caption"}, ["c"]) + re(a, e) +}) + +test("Badge(): creates a badge", () => { + const a = h(Badge) + const e = h("span", {class: "badge"}) + re(a, e) +}) + +test("Badge(): creates a badge with properties", () => { + const a = h(Badge, {id: "d", class: "c"}) + const e = h("span", {class: "badge c", id: "d"}) + re(a, e) +}) + +test("Badge(): creates a badge with children", () => { + const a = h(Badge, ["c"]) + const e = h("span", {class: "badge"}, ["c"]) + re(a, e) +}) + +test("Badge(): creates a badge with a variant", () => { + const a = h(Badge, {variant: "default"}) + const e = h("span", {class: "badge badge_variant_default"}) + re(a, e) +}) + +test.run() + +function re(a: Component, e: Component): void { + eq(render(a), render(e)) +} diff --git a/packages/ui-badge-hastscript/lib/main.ts b/packages/ui-badge-hastscript/lib/main.ts new file mode 100644 index 000000000..140faabac --- /dev/null +++ b/packages/ui-badge-hastscript/lib/main.ts @@ -0,0 +1,26 @@ +import {type Children, type Component, h} from "@onlyoffice/hastscript" +import type * as E from "@onlyoffice/hastscript/elements.ts" +import {clsx} from "clsx" + +export interface BadgeProperties extends E.SpanProperties { + variant?: + "default" | + "calm" | + "critical" | + "innovative" | + "neutral" | + "transparent" | + "vibrant" +} + +export function Badge(p: BadgeProperties, ch: Children): Component { + const {variant, ...o} = p + o.class = clsx("badge", variant && `badge_variant_${variant}`, o.class) + return h("span", o, ch) +} + +export function BadgeCaption(p: E.SpanProperties, ch: Children): Component { + const {...o} = p + o.class = clsx("badge__caption", o.class) + return h("span", o, ch) +} diff --git a/packages/ui-badge-hastscript/package.json b/packages/ui-badge-hastscript/package.json new file mode 100644 index 000000000..626777216 --- /dev/null +++ b/packages/ui-badge-hastscript/package.json @@ -0,0 +1,23 @@ +{ + "name": "@onlyoffice/ui-badge-hastscript", + "type": "module", + "private": true, + "main": "lib/main.ts", + "scripts": { + "clean": "rimraf coverage node_modules", + "test:types": "tsc", + "test:unit": "c8 --config ../../c8.config.json tsx node_modules/uvu/bin.js lib ^.*\\.test\\.ts$", + "test": "pnpm test:types && pnpm test:unit" + }, + "dependencies": { + "@onlyoffice/hastscript": "workspace:^", + "clsx": "2.1.0", + "typescript": "5.4.5" + }, + "devDependencies": { + "c8": "9.1.0", + "rimraf": "6.0.1", + "tsx": "4.16.5", + "uvu": "0.5.6" + } +} diff --git a/packages/ui-badge-hastscript/tsconfig.json b/packages/ui-badge-hastscript/tsconfig.json new file mode 100644 index 000000000..f0d8cf437 --- /dev/null +++ b/packages/ui-badge-hastscript/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["lib"] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6779949fa..cc1a08489 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -900,6 +900,31 @@ importers: packages/eslint-plugin: {} + packages/glossary-hastscript: + dependencies: + '@onlyoffice/hastscript': + specifier: workspace:^ + version: link:../hastscript + clsx: + specifier: 2.1.0 + version: 2.1.0 + typescript: + specifier: 5.4.5 + version: 5.4.5 + devDependencies: + c8: + specifier: 9.1.0 + version: 9.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + packages/hast-util-eleventy-img: dependencies: '@11ty/eleventy-img': @@ -919,6 +944,90 @@ importers: specifier: 6.0.1 version: 6.0.1 + packages/hast-util-is-element: + dependencies: + '@onlyoffice/hastscript': + specifier: workspace:^ + version: link:../hastscript + '@types/hast': + specifier: 3.0.4 + version: 3.0.4 + typescript: + specifier: 5.4.5 + version: 5.4.5 + devDependencies: + c8: + specifier: 9.1.0 + version: 9.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + + packages/hast-util-is-text: + dependencies: + '@onlyoffice/hastscript': + specifier: workspace:^ + version: link:../hastscript + '@types/hast': + specifier: 3.0.4 + version: 3.0.4 + typescript: + specifier: 5.4.5 + version: 5.4.5 + devDependencies: + c8: + specifier: 9.1.0 + version: 9.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + + packages/hastscript: + dependencies: + '@types/hast': + specifier: 3.0.4 + version: 3.0.4 + '@types/unist': + specifier: 3.0.3 + version: 3.0.3 + hastscript: + specifier: 8.0.0 + version: 8.0.0 + preact: + specifier: 10.22.0 + version: 10.22.0 + typescript: + specifier: 5.4.5 + version: 5.4.5 + unist-builder: + specifier: 4.0.0 + version: 4.0.0 + devDependencies: + c8: + specifier: 9.1.0 + version: 9.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + packages/jq: dependencies: '@onlyoffice/command': @@ -983,9 +1092,12 @@ importers: '@onlyoffice/library-signature': specifier: workspace:^ version: link:../library-signature - '@onlyoffice/markdown': + '@onlyoffice/mdast-util-extract-section': specifier: workspace:^ - version: link:../markdown + version: link:../mdast-util-extract-section + '@onlyoffice/mdast-util-first-sentence': + specifier: workspace:^ + version: link:../mdast-util-first-sentence '@onlyoffice/signature': specifier: workspace:^ version: link:../signature @@ -1076,25 +1188,6 @@ importers: specifier: 4.16.5 version: 4.16.5 - packages/keyed-json: - dependencies: - typescript: - specifier: 5.4.5 - version: 5.4.5 - devDependencies: - c8: - specifier: 9.1.0 - version: 9.1.0 - rimraf: - specifier: 6.0.1 - version: 6.0.1 - tsx: - specifier: 4.16.5 - version: 4.16.5 - uvu: - specifier: 0.5.6 - version: 0.5.6 - packages/library-declaration: dependencies: '@onlyoffice/declaration-code-example': @@ -1176,17 +1269,48 @@ importers: specifier: 0.5.6 version: 0.5.6 - packages/markdown: + packages/mdast-util-extract-section: dependencies: + '@onlyoffice/mdast-util-is-node': + specifier: workspace:^ + version: link:../mdast-util-is-node '@types/mdast': specifier: 4.0.3 version: 4.0.3 + mdast-util-to-string: + specifier: 4.0.0 + version: 4.0.0 + typescript: + specifier: 5.4.5 + version: 5.4.5 + devDependencies: + c8: + specifier: 9.1.0 + version: 9.1.0 mdast-util-from-markdown: specifier: 2.0.0 version: 2.0.0 mdast-util-to-markdown: specifier: 2.1.0 version: 2.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + + packages/mdast-util-first-sentence: + dependencies: + '@onlyoffice/mdast-util-is-node': + specifier: workspace:^ + version: link:../mdast-util-is-node + '@types/mdast': + specifier: 4.0.3 + version: 4.0.3 mdast-util-to-string: specifier: 4.0.0 version: 4.0.0 @@ -1196,12 +1320,34 @@ importers: typescript: specifier: 5.4.5 version: 5.4.5 - unist-util-remove: - specifier: 4.0.0 - version: 4.0.0 - unist-util-select: - specifier: 5.1.0 - version: 5.1.0 + devDependencies: + c8: + specifier: 9.1.0 + version: 9.1.0 + mdast-util-from-markdown: + specifier: 2.0.0 + version: 2.0.0 + mdast-util-to-markdown: + specifier: 2.1.0 + version: 2.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + + packages/mdast-util-is-node: + dependencies: + '@types/mdast': + specifier: 4.0.3 + version: 4.0.3 + typescript: + specifier: 5.4.5 + version: 5.4.5 devDependencies: c8: specifier: 9.1.0 @@ -1640,6 +1786,9 @@ importers: specifier: 5.0.0 version: 5.0.0 devDependencies: + '@onlyoffice/rehype-metaobject': + specifier: workspace:^ + version: link:../rehype-metaobject '@onlyoffice/rehype-metastring': specifier: workspace:^ version: link:../rehype-metastring @@ -1647,6 +1796,101 @@ importers: specifier: 6.0.1 version: 6.0.1 + packages/rehype-description-list: + dependencies: + '@onlyoffice/hast-util-is-element': + specifier: workspace:^ + version: link:../hast-util-is-element + '@onlyoffice/hast-util-is-text': + specifier: workspace:^ + version: link:../hast-util-is-text + '@types/hast': + specifier: 3.0.4 + version: 3.0.4 + hastscript: + specifier: 8.0.0 + version: 8.0.0 + typescript: + specifier: 5.4.5 + version: 5.4.5 + unist-util-visit: + specifier: 5.0.0 + version: 5.0.0 + devDependencies: + '@types/node': + specifier: 20.12.12 + version: 20.12.12 + c8: + specifier: 9.1.0 + version: 9.1.0 + rehype-parse: + specifier: 9.0.0 + version: 9.0.0 + rehype-stringify: + specifier: 10.0.0 + version: 10.0.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + unified: + specifier: 11.0.5 + version: 11.0.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + + packages/rehype-metaobject: + dependencies: + '@types/hast': + specifier: 3.0.4 + version: 3.0.4 + json5: + specifier: 2.2.3 + version: 2.2.3 + typescript: + specifier: 5.4.5 + version: 5.4.5 + unist-util-visit: + specifier: 5.0.0 + version: 5.0.0 + devDependencies: + '@onlyoffice/rehype-metastring': + specifier: workspace:^ + version: link:../rehype-metastring + '@types/node': + specifier: 20.12.12 + version: 20.12.12 + c8: + specifier: 9.1.0 + version: 9.1.0 + rehype-raw: + specifier: 7.0.0 + version: 7.0.0 + rehype-stringify: + specifier: 10.0.0 + version: 10.0.0 + remark-parse: + specifier: 11.0.0 + version: 11.0.0 + remark-rehype: + specifier: 11.1.0 + version: 11.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + unified: + specifier: 11.0.5 + version: 11.0.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + packages/rehype-metastring: dependencies: '@types/hast': @@ -1666,6 +1910,79 @@ importers: specifier: 6.0.1 version: 6.0.1 + packages/rehype-parameters: + dependencies: + '@onlyoffice/glossary-hastscript': + specifier: workspace:^ + version: link:../glossary-hastscript + '@onlyoffice/hast-util-is-element': + specifier: workspace:^ + version: link:../hast-util-is-element + '@onlyoffice/hast-util-is-text': + specifier: workspace:^ + version: link:../hast-util-is-text + '@onlyoffice/hastscript': + specifier: workspace:^ + version: link:../hastscript + '@onlyoffice/ui-badge-group-hastscript': + specifier: workspace:^ + version: link:../ui-badge-group-hastscript + '@onlyoffice/ui-badge-hastscript': + specifier: workspace:^ + version: link:../ui-badge-hastscript + '@types/hast': + specifier: 3.0.4 + version: 3.0.4 + typescript: + specifier: 5.4.5 + version: 5.4.5 + unist-util-visit: + specifier: 5.0.0 + version: 5.0.0 + devDependencies: + '@onlyoffice/rehype-description-list': + specifier: workspace:^ + version: link:../rehype-description-list + '@onlyoffice/rehype-metaobject': + specifier: workspace:^ + version: link:../rehype-metaobject + '@onlyoffice/rehype-metastring': + specifier: workspace:^ + version: link:../rehype-metastring + '@onlyoffice/rehype-signature': + specifier: workspace:^ + version: link:../rehype-signature + c8: + specifier: 9.1.0 + version: 9.1.0 + rehype-parse: + specifier: 9.0.0 + version: 9.0.0 + rehype-raw: + specifier: 7.0.0 + version: 7.0.0 + rehype-stringify: + specifier: 10.0.0 + version: 10.0.0 + remark-parse: + specifier: 11.0.0 + version: 11.0.0 + remark-rehype: + specifier: 11.1.0 + version: 11.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + unified: + specifier: 11.0.5 + version: 11.0.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + packages/rehype-preact: dependencies: '@types/hast': @@ -1688,6 +2005,131 @@ importers: specifier: 6.0.1 version: 6.0.1 + packages/rehype-references: + dependencies: + '@onlyoffice/glossary-hastscript': + specifier: workspace:^ + version: link:../glossary-hastscript + '@onlyoffice/hast-util-is-element': + specifier: workspace:^ + version: link:../hast-util-is-element + '@onlyoffice/hast-util-is-text': + specifier: workspace:^ + version: link:../hast-util-is-text + '@onlyoffice/hastscript': + specifier: workspace:^ + version: link:../hastscript + '@types/hast': + specifier: 3.0.4 + version: 3.0.4 + typescript: + specifier: 5.4.5 + version: 5.4.5 + unist-util-visit: + specifier: 5.0.0 + version: 5.0.0 + devDependencies: + '@onlyoffice/rehype-description-list': + specifier: workspace:^ + version: link:../rehype-description-list + c8: + specifier: 9.1.0 + version: 9.1.0 + rehype-parse: + specifier: 9.0.0 + version: 9.0.0 + rehype-raw: + specifier: 7.0.0 + version: 7.0.0 + rehype-stringify: + specifier: 10.0.0 + version: 10.0.0 + remark-parse: + specifier: 11.0.0 + version: 11.0.0 + remark-rehype: + specifier: 11.1.0 + version: 11.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + unified: + specifier: 11.0.5 + version: 11.0.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + + packages/rehype-signature: + dependencies: + '@onlyoffice/hast-util-is-element': + specifier: workspace:^ + version: link:../hast-util-is-element + '@onlyoffice/hast-util-is-text': + specifier: workspace:^ + version: link:../hast-util-is-text + '@onlyoffice/hastscript': + specifier: workspace:^ + version: link:../hastscript + '@onlyoffice/signature': + specifier: workspace:^ + version: link:../signature + '@onlyoffice/signature-hastscript': + specifier: workspace:^ + version: link:../signature-hastscript + '@types/hast': + specifier: 3.0.4 + version: 3.0.4 + typescript: + specifier: 5.4.5 + version: 5.4.5 + unist-util-visit: + specifier: 5.0.0 + version: 5.0.0 + vfile: + specifier: 6.0.1 + version: 6.0.1 + yaml: + specifier: 2.4.1 + version: 2.4.1 + devDependencies: + '@onlyoffice/rehype-metaobject': + specifier: workspace:^ + version: link:../rehype-metaobject + '@onlyoffice/rehype-metastring': + specifier: workspace:^ + version: link:../rehype-metastring + c8: + specifier: 9.1.0 + version: 9.1.0 + rehype-raw: + specifier: 7.0.0 + version: 7.0.0 + rehype-stringify: + specifier: 10.0.0 + version: 10.0.0 + remark-parse: + specifier: 11.0.0 + version: 11.0.0 + remark-rehype: + specifier: 11.1.0 + version: 11.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + unified: + specifier: 11.0.5 + version: 11.0.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + packages/rehype-starry-night: dependencies: '@types/hast': @@ -2123,6 +2565,34 @@ importers: specifier: 0.5.6 version: 0.5.6 + packages/signature-hastscript: + dependencies: + '@onlyoffice/hastscript': + specifier: workspace:^ + version: link:../hastscript + '@onlyoffice/signature': + specifier: workspace:^ + version: link:../signature + clsx: + specifier: 2.1.0 + version: 2.1.0 + typescript: + specifier: 5.4.5 + version: 5.4.5 + devDependencies: + c8: + specifier: 9.1.0 + version: 9.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + packages/site-article: dependencies: '@onlyoffice/css-calc': @@ -3212,6 +3682,56 @@ importers: specifier: 5.1.6 version: 5.1.6(@types/node@22.4.1)(lightningcss@1.26.0)(sugarss@4.0.1(postcss@8.4.41))(terser@5.31.6) + packages/ui-badge-group-hastscript: + dependencies: + '@onlyoffice/hastscript': + specifier: workspace:^ + version: link:../hastscript + clsx: + specifier: 2.1.0 + version: 2.1.0 + typescript: + specifier: 5.4.5 + version: 5.4.5 + devDependencies: + c8: + specifier: 9.1.0 + version: 9.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + + packages/ui-badge-hastscript: + dependencies: + '@onlyoffice/hastscript': + specifier: workspace:^ + version: link:../hastscript + clsx: + specifier: 2.1.0 + version: 2.1.0 + typescript: + specifier: 5.4.5 + version: 5.4.5 + devDependencies: + c8: + specifier: 9.1.0 + version: 9.1.0 + rimraf: + specifier: 6.0.1 + version: 6.0.1 + tsx: + specifier: 4.16.5 + version: 4.16.5 + uvu: + specifier: 0.5.6 + version: 0.5.6 + packages/ui-base: {} packages/ui-breadcrumb: @@ -3763,9 +4283,6 @@ importers: '@onlyoffice/jsdoc-resource-fixtures': specifier: workspace:^ version: link:../packages/jsdoc-resource-fixtures - '@onlyoffice/keyed-json': - specifier: workspace:^ - version: link:../packages/keyed-json '@onlyoffice/library-declaration': specifier: workspace:^ version: link:../packages/library-declaration @@ -3799,12 +4316,27 @@ importers: '@onlyoffice/rehype-clean': specifier: workspace:^ version: link:../packages/rehype-clean + '@onlyoffice/rehype-description-list': + specifier: workspace:^ + version: link:../packages/rehype-description-list + '@onlyoffice/rehype-metaobject': + specifier: workspace:^ + version: link:../packages/rehype-metaobject '@onlyoffice/rehype-metastring': specifier: workspace:^ version: link:../packages/rehype-metastring + '@onlyoffice/rehype-parameters': + specifier: workspace:^ + version: link:../packages/rehype-parameters '@onlyoffice/rehype-preact': specifier: workspace:^ version: link:../packages/rehype-preact + '@onlyoffice/rehype-references': + specifier: workspace:^ + version: link:../packages/rehype-references + '@onlyoffice/rehype-signature': + specifier: workspace:^ + version: link:../packages/rehype-signature '@onlyoffice/rehype-starry-night': specifier: workspace:^ version: link:../packages/rehype-starry-night @@ -10692,6 +11224,9 @@ packages: resolution: {integrity: sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==} engines: {node: '>=8'} + unist-builder@4.0.0: + resolution: {integrity: sha512-wmRFnH+BLpZnTKpc5L7O67Kac89s9HMrtELpnNaE6TAobq5DTZZs5YaTQfAZBA9bFPECx2uVAPO31c+GVug8mg==} + unist-util-find-after@5.0.0: resolution: {integrity: sha512-amQa0Ep2m6hE2g72AugUItjbuM8X8cGQnFoHk0pGfrFeT9GZhzN5SW8nRsiGKK7Aif4CrACPENkA6P/Lw6fHGQ==} @@ -10707,9 +11242,6 @@ packages: unist-util-remove-position@5.0.0: resolution: {integrity: sha512-Hp5Kh3wLxv0PHj9m2yZhhLt58KzPtEYKQQ4yxfYFEO7EvHwzyDYnduhHnY1mDxoqr7VUwVuHXk9RXKIiYS1N8Q==} - unist-util-remove@4.0.0: - resolution: {integrity: sha512-b4gokeGId57UVRX/eVKej5gXqGlc9+trkORhFJpu9raqZkZhU0zm8Doi05+HaiBsMEIJowL+2WtQ5ItjsngPXg==} - unist-util-select@5.1.0: resolution: {integrity: sha512-4A5mfokSHG/rNQ4g7gSbdEs+H586xyd24sdJqF1IWamqrLHvYb+DH48fzxowyOhOfK7YSqX+XlCojAyuuyyT2A==} @@ -19504,6 +20036,10 @@ snapshots: dependencies: crypto-random-string: 2.0.0 + unist-builder@4.0.0: + dependencies: + '@types/unist': 3.0.3 + unist-util-find-after@5.0.0: dependencies: '@types/unist': 3.0.3 @@ -19526,12 +20062,6 @@ snapshots: '@types/unist': 3.0.3 unist-util-visit: 5.0.0 - unist-util-remove@4.0.0: - dependencies: - '@types/unist': 3.0.3 - unist-util-is: 6.0.0 - unist-util-visit-parents: 6.0.1 - unist-util-select@5.1.0: dependencies: '@types/unist': 3.0.3 diff --git a/site/assets/images/desktop/extended_comments.png b/site/assets/images/desktop/extended_comments.png index 398a7090d..a87eec290 100644 Binary files a/site/assets/images/desktop/extended_comments.png and b/site/assets/images/desktop/extended_comments.png differ diff --git a/site/assets/images/docbuilder/cpp-result-file.png b/site/assets/images/docbuilder/cpp-result-file.png new file mode 100644 index 000000000..adff17f67 Binary files /dev/null and b/site/assets/images/docbuilder/cpp-result-file.png differ diff --git a/site/assets/images/docbuilder/cpp/build_and_run.png b/site/assets/images/docbuilder/cpp/build_and_run.png deleted file mode 100644 index ac98f9fed..000000000 Binary files a/site/assets/images/docbuilder/cpp/build_and_run.png and /dev/null differ diff --git a/site/assets/images/docbuilder/cpp/builder_function.png b/site/assets/images/docbuilder/cpp/builder_function.png deleted file mode 100644 index 9ec785921..000000000 Binary files a/site/assets/images/docbuilder/cpp/builder_function.png and /dev/null differ diff --git a/site/assets/images/docbuilder/cpp/folder_root_after.png b/site/assets/images/docbuilder/cpp/folder_root_after.png deleted file mode 100644 index 173abd456..000000000 Binary files a/site/assets/images/docbuilder/cpp/folder_root_after.png and /dev/null differ diff --git a/site/assets/images/docbuilder/cpp/program_file.png b/site/assets/images/docbuilder/cpp/program_file.png deleted file mode 100644 index 5540c3cd4..000000000 Binary files a/site/assets/images/docbuilder/cpp/program_file.png and /dev/null differ diff --git a/site/assets/images/docbuilder/cpp/project_file.png b/site/assets/images/docbuilder/cpp/project_file.png deleted file mode 100644 index 43e860bcd..000000000 Binary files a/site/assets/images/docbuilder/cpp/project_file.png and /dev/null differ diff --git a/site/assets/images/docbuilder/cpp/sample_structure.png b/site/assets/images/docbuilder/cpp/sample_structure.png deleted file mode 100644 index 0f4721223..000000000 Binary files a/site/assets/images/docbuilder/cpp/sample_structure.png and /dev/null differ diff --git a/site/assets/images/docbuilder/cpp/sample_structure_after.png b/site/assets/images/docbuilder/cpp/sample_structure_after.png deleted file mode 100644 index 5eaaa48fd..000000000 Binary files a/site/assets/images/docbuilder/cpp/sample_structure_after.png and /dev/null differ diff --git a/site/assets/images/docbuilder/cs-result-file.png b/site/assets/images/docbuilder/cs-result-file.png new file mode 100644 index 000000000..3227aba05 Binary files /dev/null and b/site/assets/images/docbuilder/cs-result-file.png differ diff --git a/site/assets/images/docbuilder/csharp/build_and_run.png b/site/assets/images/docbuilder/csharp/build_and_run.png deleted file mode 100644 index 616f2239a..000000000 Binary files a/site/assets/images/docbuilder/csharp/build_and_run.png and /dev/null differ diff --git a/site/assets/images/docbuilder/csharp/builder_function.png b/site/assets/images/docbuilder/csharp/builder_function.png deleted file mode 100644 index b307c0e8b..000000000 Binary files a/site/assets/images/docbuilder/csharp/builder_function.png and /dev/null differ diff --git a/site/assets/images/docbuilder/csharp/folder_root_after.png b/site/assets/images/docbuilder/csharp/folder_root_after.png deleted file mode 100644 index fd185c50b..000000000 Binary files a/site/assets/images/docbuilder/csharp/folder_root_after.png and /dev/null differ diff --git a/site/assets/images/docbuilder/csharp/program_file.png b/site/assets/images/docbuilder/csharp/program_file.png deleted file mode 100644 index d78cf2c5a..000000000 Binary files a/site/assets/images/docbuilder/csharp/program_file.png and /dev/null differ diff --git a/site/assets/images/docbuilder/csharp/project_file.png b/site/assets/images/docbuilder/csharp/project_file.png deleted file mode 100644 index 2536d342f..000000000 Binary files a/site/assets/images/docbuilder/csharp/project_file.png and /dev/null differ diff --git a/site/assets/images/docbuilder/csharp/result_file.png b/site/assets/images/docbuilder/csharp/result_file.png deleted file mode 100644 index 32db2dfdb..000000000 Binary files a/site/assets/images/docbuilder/csharp/result_file.png and /dev/null differ diff --git a/site/assets/images/docbuilder/csharp/sample_structure.png b/site/assets/images/docbuilder/csharp/sample_structure.png deleted file mode 100644 index 6384f6eba..000000000 Binary files a/site/assets/images/docbuilder/csharp/sample_structure.png and /dev/null differ diff --git a/site/assets/images/docbuilder/csharp/sample_structure_after.png b/site/assets/images/docbuilder/csharp/sample_structure_after.png deleted file mode 100644 index 241b3115e..000000000 Binary files a/site/assets/images/docbuilder/csharp/sample_structure_after.png and /dev/null differ diff --git a/site/assets/images/docbuilder/java-result-file.png b/site/assets/images/docbuilder/java-result-file.png new file mode 100644 index 000000000..e7bd6c49b Binary files /dev/null and b/site/assets/images/docbuilder/java-result-file.png differ diff --git a/site/assets/images/docbuilder/python-result-file.png b/site/assets/images/docbuilder/python-result-file.png new file mode 100644 index 000000000..eec8df568 Binary files /dev/null and b/site/assets/images/docbuilder/python-result-file.png differ diff --git a/site/assets/images/docbuilder/retarget-projects.png b/site/assets/images/docbuilder/retarget-projects.png new file mode 100644 index 000000000..7db66ce19 Binary files /dev/null and b/site/assets/images/docbuilder/retarget-projects.png differ diff --git a/site/assets/images/docspace/access-scopes.dark.png b/site/assets/images/docspace/access-scopes.dark.png new file mode 100644 index 000000000..3ceaccf4f Binary files /dev/null and b/site/assets/images/docspace/access-scopes.dark.png differ diff --git a/site/assets/images/docspace/access-scopes.png b/site/assets/images/docspace/access-scopes.png new file mode 100644 index 000000000..13939f053 Binary files /dev/null and b/site/assets/images/docspace/access-scopes.png differ diff --git a/site/assets/images/docspace/add-in-js-sdk-root-url.png b/site/assets/images/docspace/add-in-js-sdk-root-url.png index 70a2dacbb..d2ad16556 100644 Binary files a/site/assets/images/docspace/add-in-js-sdk-root-url.png and b/site/assets/images/docspace/add-in-js-sdk-root-url.png differ diff --git a/site/assets/images/docspace/auth-button.dark.png b/site/assets/images/docspace/auth-button.dark.png new file mode 100644 index 000000000..7ab5052f5 Binary files /dev/null and b/site/assets/images/docspace/auth-button.dark.png differ diff --git a/site/assets/images/docspace/auth-button.png b/site/assets/images/docspace/auth-button.png new file mode 100644 index 000000000..0c400d6ec Binary files /dev/null and b/site/assets/images/docspace/auth-button.png differ diff --git a/site/assets/images/docspace/authorization-flow.png b/site/assets/images/docspace/authorization-flow.png new file mode 100644 index 000000000..148c17455 Binary files /dev/null and b/site/assets/images/docspace/authorization-flow.png differ diff --git a/site/assets/images/docspace/authorized-apps.dark.png b/site/assets/images/docspace/authorized-apps.dark.png new file mode 100644 index 000000000..636d1a7e5 Binary files /dev/null and b/site/assets/images/docspace/authorized-apps.dark.png differ diff --git a/site/assets/images/docspace/authorized-apps.png b/site/assets/images/docspace/authorized-apps.png new file mode 100644 index 000000000..bc21808a6 Binary files /dev/null and b/site/assets/images/docspace/authorized-apps.png differ diff --git a/site/assets/images/docspace/basic-info.dark.png b/site/assets/images/docspace/basic-info.dark.png new file mode 100644 index 000000000..13174a723 Binary files /dev/null and b/site/assets/images/docspace/basic-info.dark.png differ diff --git a/site/assets/images/docspace/basic-info.png b/site/assets/images/docspace/basic-info.png new file mode 100644 index 000000000..e700699b4 Binary files /dev/null and b/site/assets/images/docspace/basic-info.png differ diff --git a/site/assets/images/docspace/choose-portal.png b/site/assets/images/docspace/choose-portal.png new file mode 100644 index 000000000..520874032 Binary files /dev/null and b/site/assets/images/docspace/choose-portal.png differ diff --git a/site/assets/images/docspace/consent-page.dark.png b/site/assets/images/docspace/consent-page.dark.png new file mode 100644 index 000000000..6e2bb1a39 Binary files /dev/null and b/site/assets/images/docspace/consent-page.dark.png differ diff --git a/site/assets/images/docspace/consent-page.png b/site/assets/images/docspace/consent-page.png new file mode 100644 index 000000000..66fe5e5f8 Binary files /dev/null and b/site/assets/images/docspace/consent-page.png differ diff --git a/site/assets/images/docspace/context-menu-item.png b/site/assets/images/docspace/context-menu-item.png index c4379e470..5aa611ea2 100644 Binary files a/site/assets/images/docspace/context-menu-item.png and b/site/assets/images/docspace/context-menu-item.png differ diff --git a/site/assets/images/docspace/context-menu-plugin.png b/site/assets/images/docspace/context-menu-plugin.png index b2e8aa943..288fba5c5 100644 Binary files a/site/assets/images/docspace/context-menu-plugin.png and b/site/assets/images/docspace/context-menu-plugin.png differ diff --git a/site/assets/images/docspace/convert-to-text.png b/site/assets/images/docspace/convert-to-text.png index 6b23ba276..8240ff66c 100644 Binary files a/site/assets/images/docspace/convert-to-text.png and b/site/assets/images/docspace/convert-to-text.png differ diff --git a/site/assets/images/docspace/create-diagram.png b/site/assets/images/docspace/create-diagram.png index 404b49f0f..b21abf2a6 100644 Binary files a/site/assets/images/docspace/create-diagram.png and b/site/assets/images/docspace/create-diagram.png differ diff --git a/site/assets/images/docspace/customization-of-editors.png b/site/assets/images/docspace/customization-of-editors.png index ffc3ae8eb..3bc68af06 100644 Binary files a/site/assets/images/docspace/customization-of-editors.png and b/site/assets/images/docspace/customization-of-editors.png differ diff --git a/site/assets/images/docspace/delete-button.dark.png b/site/assets/images/docspace/delete-button.dark.png new file mode 100644 index 000000000..3a5026931 Binary files /dev/null and b/site/assets/images/docspace/delete-button.dark.png differ diff --git a/site/assets/images/docspace/delete-button.png b/site/assets/images/docspace/delete-button.png new file mode 100644 index 000000000..8855f3b20 Binary files /dev/null and b/site/assets/images/docspace/delete-button.png differ diff --git a/site/assets/images/docspace/disable-button.dark.png b/site/assets/images/docspace/disable-button.dark.png new file mode 100644 index 000000000..0695d315a Binary files /dev/null and b/site/assets/images/docspace/disable-button.dark.png differ diff --git a/site/assets/images/docspace/disable-button.png b/site/assets/images/docspace/disable-button.png new file mode 100644 index 000000000..8a62d5b4b Binary files /dev/null and b/site/assets/images/docspace/disable-button.png differ diff --git a/site/assets/images/docspace/disable-toggle-button.dark.png b/site/assets/images/docspace/disable-toggle-button.dark.png new file mode 100644 index 000000000..541121a13 Binary files /dev/null and b/site/assets/images/docspace/disable-toggle-button.dark.png differ diff --git a/site/assets/images/docspace/disable-toggle-button.png b/site/assets/images/docspace/disable-toggle-button.png new file mode 100644 index 000000000..7b84d26a8 Binary files /dev/null and b/site/assets/images/docspace/disable-toggle-button.png differ diff --git a/site/assets/images/docspace/docspace-plugins.png b/site/assets/images/docspace/docspace-plugins.png index 70c4e422c..2f8334f03 100644 Binary files a/site/assets/images/docspace/docspace-plugins.png and b/site/assets/images/docspace/docspace-plugins.png differ diff --git a/site/assets/images/docspace/docspace-settings.png b/site/assets/images/docspace/docspace-settings.png index eb2dfd5d5..bcd6b349d 100644 Binary files a/site/assets/images/docspace/docspace-settings.png and b/site/assets/images/docspace/docspace-settings.png differ diff --git a/site/assets/images/docspace/drawio-file.png b/site/assets/images/docspace/drawio-file.png index 9f2d4a311..3ed10ede7 100644 Binary files a/site/assets/images/docspace/drawio-file.png and b/site/assets/images/docspace/drawio-file.png differ diff --git a/site/assets/images/docspace/edit-button.dark.png b/site/assets/images/docspace/edit-button.dark.png new file mode 100644 index 000000000..f026f50cc Binary files /dev/null and b/site/assets/images/docspace/edit-button.dark.png differ diff --git a/site/assets/images/docspace/edit-button.png b/site/assets/images/docspace/edit-button.png new file mode 100644 index 000000000..f6aaeb656 Binary files /dev/null and b/site/assets/images/docspace/edit-button.png differ diff --git a/site/assets/images/docspace/editing-app.dark.png b/site/assets/images/docspace/editing-app.dark.png new file mode 100644 index 000000000..510468402 Binary files /dev/null and b/site/assets/images/docspace/editing-app.dark.png differ diff --git a/site/assets/images/docspace/editing-app.png b/site/assets/images/docspace/editing-app.png new file mode 100644 index 000000000..d2ebe2e96 Binary files /dev/null and b/site/assets/images/docspace/editing-app.png differ diff --git a/site/assets/images/docspace/editor-mode.png b/site/assets/images/docspace/editor-mode.png index e1294af69..47065620a 100644 Binary files a/site/assets/images/docspace/editor-mode.png and b/site/assets/images/docspace/editor-mode.png differ diff --git a/site/assets/images/docspace/error-page.dark.png b/site/assets/images/docspace/error-page.dark.png new file mode 100644 index 000000000..47719ecc5 Binary files /dev/null and b/site/assets/images/docspace/error-page.dark.png differ diff --git a/site/assets/images/docspace/error-page.png b/site/assets/images/docspace/error-page.png new file mode 100644 index 000000000..c4c548604 Binary files /dev/null and b/site/assets/images/docspace/error-page.png differ diff --git a/site/assets/images/docspace/file-icon-tile.png b/site/assets/images/docspace/file-icon-tile.png index abe93f4f0..72bd392e2 100644 Binary files a/site/assets/images/docspace/file-icon-tile.png and b/site/assets/images/docspace/file-icon-tile.png differ diff --git a/site/assets/images/docspace/file-icon.png b/site/assets/images/docspace/file-icon.png index 868090c20..40796a319 100644 Binary files a/site/assets/images/docspace/file-icon.png and b/site/assets/images/docspace/file-icon.png differ diff --git a/site/assets/images/docspace/file-selector-mode.png b/site/assets/images/docspace/file-selector-mode.png index 16aa3c20b..db501e7f9 100644 Binary files a/site/assets/images/docspace/file-selector-mode.png and b/site/assets/images/docspace/file-selector-mode.png differ diff --git a/site/assets/images/docspace/generate-token.dark.png b/site/assets/images/docspace/generate-token.dark.png new file mode 100644 index 000000000..2c65533b4 Binary files /dev/null and b/site/assets/images/docspace/generate-token.dark.png differ diff --git a/site/assets/images/docspace/generate-token.png b/site/assets/images/docspace/generate-token.png new file mode 100644 index 000000000..1a343bc00 Binary files /dev/null and b/site/assets/images/docspace/generate-token.png differ diff --git a/site/assets/images/docspace/gifs/js-sdk-attach-files.gif b/site/assets/images/docspace/gifs/js-sdk-attach-files.gif index 04302ba40..a3ce3fcae 100644 Binary files a/site/assets/images/docspace/gifs/js-sdk-attach-files.gif and b/site/assets/images/docspace/gifs/js-sdk-attach-files.gif differ diff --git a/site/assets/images/docspace/gifs/open-editors.gif b/site/assets/images/docspace/gifs/open-editors.gif index bc74756fe..08f283ba9 100644 Binary files a/site/assets/images/docspace/gifs/open-editors.gif and b/site/assets/images/docspace/gifs/open-editors.gif differ diff --git a/site/assets/images/docspace/main-button-icon.png b/site/assets/images/docspace/main-button-icon.png index 30cb1ec57..1cae7df99 100644 Binary files a/site/assets/images/docspace/main-button-icon.png and b/site/assets/images/docspace/main-button-icon.png differ diff --git a/site/assets/images/docspace/main-button-plugin.png b/site/assets/images/docspace/main-button-plugin.png index 07d4fcf8e..8add86e58 100644 Binary files a/site/assets/images/docspace/main-button-plugin.png and b/site/assets/images/docspace/main-button-plugin.png differ diff --git a/site/assets/images/docspace/manager-mode.png b/site/assets/images/docspace/manager-mode.png index 7cae8444d..66069fa3a 100644 Binary files a/site/assets/images/docspace/manager-mode.png and b/site/assets/images/docspace/manager-mode.png differ diff --git a/site/assets/images/docspace/more-icon.dark.png b/site/assets/images/docspace/more-icon.dark.png new file mode 100644 index 000000000..fbb9ed2b9 Binary files /dev/null and b/site/assets/images/docspace/more-icon.dark.png differ diff --git a/site/assets/images/docspace/oauth-app.dark.png b/site/assets/images/docspace/oauth-app.dark.png new file mode 100644 index 000000000..a1a568e4c Binary files /dev/null and b/site/assets/images/docspace/oauth-app.dark.png differ diff --git a/site/assets/images/docspace/oauth-app.png b/site/assets/images/docspace/oauth-app.png new file mode 100644 index 000000000..183aee241 Binary files /dev/null and b/site/assets/images/docspace/oauth-app.png differ diff --git a/site/assets/images/docspace/oauth-new-app.dark.png b/site/assets/images/docspace/oauth-new-app.dark.png new file mode 100644 index 000000000..6b18dcd9f Binary files /dev/null and b/site/assets/images/docspace/oauth-new-app.dark.png differ diff --git a/site/assets/images/docspace/oauth-new-app.png b/site/assets/images/docspace/oauth-new-app.png new file mode 100644 index 000000000..2936e7d7b Binary files /dev/null and b/site/assets/images/docspace/oauth-new-app.png differ diff --git a/site/assets/images/docspace/plugin-logo.png b/site/assets/images/docspace/plugin-logo.png index be5921f4f..f09484f30 100644 Binary files a/site/assets/images/docspace/plugin-logo.png and b/site/assets/images/docspace/plugin-logo.png differ diff --git a/site/assets/images/docspace/plugin-samples.png b/site/assets/images/docspace/plugin-samples.png index ef783905e..2b780c330 100644 Binary files a/site/assets/images/docspace/plugin-samples.png and b/site/assets/images/docspace/plugin-samples.png differ diff --git a/site/assets/images/docspace/plugin-settings.png b/site/assets/images/docspace/plugin-settings.png index 6f3638705..60e712191 100644 Binary files a/site/assets/images/docspace/plugin-settings.png and b/site/assets/images/docspace/plugin-settings.png differ diff --git a/site/assets/images/docspace/plus.dark.png b/site/assets/images/docspace/plus.dark.png new file mode 100644 index 000000000..b0190720c Binary files /dev/null and b/site/assets/images/docspace/plus.dark.png differ diff --git a/site/assets/images/docspace/plus.png b/site/assets/images/docspace/plus.png new file mode 100644 index 000000000..a5f6c6632 Binary files /dev/null and b/site/assets/images/docspace/plus.png differ diff --git a/site/assets/images/docspace/preview.dark.png b/site/assets/images/docspace/preview.dark.png new file mode 100644 index 000000000..93800d969 Binary files /dev/null and b/site/assets/images/docspace/preview.dark.png differ diff --git a/site/assets/images/docspace/preview.png b/site/assets/images/docspace/preview.png new file mode 100644 index 000000000..e80b59bcb Binary files /dev/null and b/site/assets/images/docspace/preview.png differ diff --git a/site/assets/images/docspace/revoke-token.dark.png b/site/assets/images/docspace/revoke-token.dark.png new file mode 100644 index 000000000..87721a748 Binary files /dev/null and b/site/assets/images/docspace/revoke-token.dark.png differ diff --git a/site/assets/images/docspace/revoke-token.png b/site/assets/images/docspace/revoke-token.png new file mode 100644 index 000000000..c47106d91 Binary files /dev/null and b/site/assets/images/docspace/revoke-token.png differ diff --git a/site/assets/images/docspace/revoke.dark.png b/site/assets/images/docspace/revoke.dark.png new file mode 100644 index 000000000..c8605fadd Binary files /dev/null and b/site/assets/images/docspace/revoke.dark.png differ diff --git a/site/assets/images/docspace/revoke.png b/site/assets/images/docspace/revoke.png new file mode 100644 index 000000000..808faccdb Binary files /dev/null and b/site/assets/images/docspace/revoke.png differ diff --git a/site/assets/images/docspace/room-selector-mode.png b/site/assets/images/docspace/room-selector-mode.png index 897b2d5c9..a5fa01d3c 100644 Binary files a/site/assets/images/docspace/room-selector-mode.png and b/site/assets/images/docspace/room-selector-mode.png differ diff --git a/site/assets/images/docspace/settings-block.png b/site/assets/images/docspace/settings-block.png index da3a4b30c..f2f60ae3d 100644 Binary files a/site/assets/images/docspace/settings-block.png and b/site/assets/images/docspace/settings-block.png differ diff --git a/site/assets/images/docspace/speech-settings.png b/site/assets/images/docspace/speech-settings.png index 78ffdd85e..60e712191 100644 Binary files a/site/assets/images/docspace/speech-settings.png and b/site/assets/images/docspace/speech-settings.png differ diff --git a/site/assets/images/docspace/support-and-legal-info.dark.png b/site/assets/images/docspace/support-and-legal-info.dark.png new file mode 100644 index 000000000..083efab52 Binary files /dev/null and b/site/assets/images/docspace/support-and-legal-info.dark.png differ diff --git a/site/assets/images/docspace/support-and-legal-info.png b/site/assets/images/docspace/support-and-legal-info.png new file mode 100644 index 000000000..42401e3c5 Binary files /dev/null and b/site/assets/images/docspace/support-and-legal-info.png differ diff --git a/site/assets/images/docspace/switcher.png b/site/assets/images/docspace/switcher.png index fc5865aa2..3720661cf 100644 Binary files a/site/assets/images/docspace/switcher.png and b/site/assets/images/docspace/switcher.png differ diff --git a/site/assets/images/docspace/token-window.dark.png b/site/assets/images/docspace/token-window.dark.png new file mode 100644 index 000000000..b887dba19 Binary files /dev/null and b/site/assets/images/docspace/token-window.dark.png differ diff --git a/site/assets/images/docspace/token-window.png b/site/assets/images/docspace/token-window.png new file mode 100644 index 000000000..335c14dd9 Binary files /dev/null and b/site/assets/images/docspace/token-window.png differ diff --git a/site/assets/images/docspace/upload-plugin.jpg b/site/assets/images/docspace/upload-plugin.jpg deleted file mode 100644 index eab5ff739..000000000 Binary files a/site/assets/images/docspace/upload-plugin.jpg and /dev/null differ diff --git a/site/assets/images/docspace/upload-plugin.png b/site/assets/images/docspace/upload-plugin.png new file mode 100644 index 000000000..160b162a6 Binary files /dev/null and b/site/assets/images/docspace/upload-plugin.png differ diff --git a/site/assets/images/docspace/viewer-mode.png b/site/assets/images/docspace/viewer-mode.png index c046d0b69..3d8caf98f 100644 Binary files a/site/assets/images/docspace/viewer-mode.png and b/site/assets/images/docspace/viewer-mode.png differ diff --git a/site/assets/images/editor/hideNotes.png b/site/assets/images/editor/hideNotes.png index a49403fe3..58b289bff 100644 Binary files a/site/assets/images/editor/hideNotes.png and b/site/assets/images/editor/hideNotes.png differ diff --git a/site/assets/images/editor/hideRulers.png b/site/assets/images/editor/hideRulers.png index 9045f6d2a..e5cedc835 100644 Binary files a/site/assets/images/editor/hideRulers.png and b/site/assets/images/editor/hideRulers.png differ diff --git a/site/assets/images/editor/plugins.dark.png b/site/assets/images/editor/plugins.dark.png new file mode 100644 index 000000000..27d3cc424 Binary files /dev/null and b/site/assets/images/editor/plugins.dark.png differ diff --git a/site/assets/images/editor/plugins.png b/site/assets/images/editor/plugins.png index 4c1427df4..2860f61eb 100644 Binary files a/site/assets/images/editor/plugins.png and b/site/assets/images/editor/plugins.png differ diff --git a/site/assets/images/plugins/add-comments-and-highlight-cells-spreadsheet.dark.png b/site/assets/images/plugins/add-comments-and-highlight-cells-spreadsheet.dark.png new file mode 100644 index 000000000..aaacd7810 Binary files /dev/null and b/site/assets/images/plugins/add-comments-and-highlight-cells-spreadsheet.dark.png differ diff --git a/site/assets/images/plugins/add-comments-and-highlight-cells-spreadsheet.png b/site/assets/images/plugins/add-comments-and-highlight-cells-spreadsheet.png new file mode 100644 index 000000000..972216d35 Binary files /dev/null and b/site/assets/images/plugins/add-comments-and-highlight-cells-spreadsheet.png differ diff --git a/site/assets/images/plugins/init-data.png b/site/assets/images/plugins/init-data.png index ca94e72a2..c067d686e 100644 Binary files a/site/assets/images/plugins/init-data.png and b/site/assets/images/plugins/init-data.png differ diff --git a/site/assets/images/plugins/plugin-groups.dark.png b/site/assets/images/plugins/plugin-groups.dark.png index 25feb1763..8b6752378 100644 Binary files a/site/assets/images/plugins/plugin-groups.dark.png and b/site/assets/images/plugins/plugin-groups.dark.png differ diff --git a/site/assets/images/plugins/plugin-groups.png b/site/assets/images/plugins/plugin-groups.png index e48e3c088..34dfae165 100644 Binary files a/site/assets/images/plugins/plugin-groups.png and b/site/assets/images/plugins/plugin-groups.png differ diff --git a/site/assets/images/plugins/replace-words-in-document.dark.png b/site/assets/images/plugins/replace-words-in-document.dark.png index 5bd825d42..1e28e9f02 100644 Binary files a/site/assets/images/plugins/replace-words-in-document.dark.png and b/site/assets/images/plugins/replace-words-in-document.dark.png differ diff --git a/site/assets/images/plugins/replace-words-in-document.png b/site/assets/images/plugins/replace-words-in-document.png index fa11c03c8..0134f81ba 100644 Binary files a/site/assets/images/plugins/replace-words-in-document.png and b/site/assets/images/plugins/replace-words-in-document.png differ diff --git a/site/config.production.yml b/site/config.production.yml index 091952643..6d07884ae 100644 --- a/site/config.production.yml +++ b/site/config.production.yml @@ -6,8 +6,8 @@ analytics: true robots: true server: - baseUrl: https://legacy-api.teamlab.info/ + baseUrl: https://legacy-api.onlyoffice.com/ playground: documentEditor: - documentServerUrl: https://api.docs.teamlab.info/ + documentServerUrl: https://api.docs.onlyoffice.com/ diff --git a/site/internal/document-builder-container.tsx b/site/internal/document-builder-container.tsx index fb31c4338..ef8e20c7d 100644 --- a/site/internal/document-builder-container.tsx +++ b/site/internal/document-builder-container.tsx @@ -1,13 +1,18 @@ import {documentBuilder} from "@onlyoffice/document-builder-hast-element" import {type DocumentEditorConfig} from "@onlyoffice/document-editor-html-element" import {mergeConfig, normalizeConfig} from "@onlyoffice/document-server-utils" -import {fromKeys} from "@onlyoffice/keyed-json" import {Config} from "@onlyoffice/site-config" import {template} from "@onlyoffice/template-hast-element" import {type Element, type Root} from "hast" import {toText} from "hast-util-to-text" import {visit} from "unist-util-visit" +declare module "hast" { + interface Metaobject { + "document-builder"?: DocumentEditorConfig + } +} + export interface RehypeDocumentBuilderContainerTransform { (tree: Root): void } @@ -26,13 +31,12 @@ export function rehypeDocumentBuilderContainer(): RehypeDocumentBuilderContainer return } - const m = e.properties.metastring + const m = e.properties.metaobject if (!m) { return } - const o = fromKeys(m) - const b = o["document-builder"] as DocumentEditorConfig | undefined + const b = m["document-builder"] if (!b) { return } diff --git a/site/internal/link.tsx b/site/internal/link.tsx index 31f46869a..59f2918aa 100644 --- a/site/internal/link.tsx +++ b/site/internal/link.tsx @@ -27,7 +27,7 @@ export function Link(p: LinkProperties): JSX.Element { throw new TypeError("The 'href' attribute must be a string.") } - p.href = resolve(p.file, p.href) + p.href = resolveLink(p.file, p.href) return } @@ -52,12 +52,12 @@ export function rehypeLink(): RehypeLinkTransform { throw new TypeError("The 'href' attribute must be a string.") } - n.properties.href = resolve(f.path, p.href) + n.properties.href = resolveLink(f.path, p.href) }) } } -function resolve(a: string, b: string): string { +export function resolveLink(a: string, b: string): string { const s = Sitemap.shared if (URL.canParse(b)) { diff --git a/site/internal/markdown.tsx b/site/internal/markdown.tsx index 51b4f8790..6c52a57e2 100644 --- a/site/internal/markdown.tsx +++ b/site/internal/markdown.tsx @@ -3,8 +3,13 @@ import {type UserConfig} from "@onlyoffice/eleventy-types" import {useSuspense} from "@onlyoffice/preact-suspense" import {type ChildrenIncludable} from "@onlyoffice/preact-types" import {rehypeClean} from "@onlyoffice/rehype-clean" +import {rehypeDescriptionList} from "@onlyoffice/rehype-description-list" +import {rehypeMetaobject} from "@onlyoffice/rehype-metaobject" import {rehypeMetastring} from "@onlyoffice/rehype-metastring" +import {rehypeParameters} from "@onlyoffice/rehype-parameters" import {rehypePreact} from "@onlyoffice/rehype-preact" +import {rehypeReferences} from "@onlyoffice/rehype-references" +import {rehypeSignature} from "@onlyoffice/rehype-signature" import {rehypeStarryNight} from "@onlyoffice/rehype-starry-night" import type * as Hast from "hast" import type * as Mdast from "mdast" @@ -22,7 +27,7 @@ import {reporterPretty} from "vfile-reporter-pretty" import pack from "../package.json" with {type: "json"} import {rehypeDocumentBuilderContainer} from "./document-builder-container.tsx" import {rehypeImage} from "./image.tsx" -import {rehypeLink} from "./link.tsx" +import {rehypeLink, resolveLink} from "./link.tsx" export function Markdown(p: ChildrenIncludable): JSX.Element { let r: JSX.Element | null = null @@ -76,14 +81,23 @@ function markdown(): MarkdownProcessor { .use(remarkParse) .use(remarkGfm) .use(remarkRehype, {allowDangerousHtml: true}) + .use(rehypeDescriptionList) .use(rehypeMetastring) .use(rehypeRaw) + .use(rehypeMetaobject) .use(rehypeSlug, {enableCustomId: true}) .use(rehypeAutolink, {behavior: "wrap"}) .use(rehypeLink) .use(rehypeImage) + .use(rehypeSignature, { + onLink(f, t) { + return resolveLink(f.path, t.id) + }, + }) .use(rehypeStarryNight, starryNight) .use(rehypeDocumentBuilderContainer) + .use(rehypeParameters) + .use(rehypeReferences) .use(rehypeClean) .use(rehypePreact, {Fragment, jsx, jsxs}) .freeze() as unknown as MarkdownProcessor diff --git a/site/package.json b/site/package.json index e1c9489af..af251fff3 100644 --- a/site/package.json +++ b/site/package.json @@ -42,7 +42,6 @@ "@onlyoffice/eleventy-types": "workspace:^", "@onlyoffice/hast-util-eleventy-img": "workspace:^", "@onlyoffice/jsdoc-resource-fixtures": "workspace:^", - "@onlyoffice/keyed-json": "workspace:^", "@onlyoffice/library-declaration": "workspace:^", "@onlyoffice/library-resource": "workspace:^", "@onlyoffice/node-path": "workspace:^", @@ -54,8 +53,13 @@ "@onlyoffice/preact-types": "workspace:^", "@onlyoffice/radiogroup-container-html-element": "workspace:^", "@onlyoffice/rehype-clean": "workspace:^", + "@onlyoffice/rehype-description-list": "workspace:^", + "@onlyoffice/rehype-metaobject": "workspace:^", "@onlyoffice/rehype-metastring": "workspace:^", + "@onlyoffice/rehype-parameters": "workspace:^", "@onlyoffice/rehype-preact": "workspace:^", + "@onlyoffice/rehype-references": "workspace:^", + "@onlyoffice/rehype-signature": "workspace:^", "@onlyoffice/rehype-starry-night": "workspace:^", "@onlyoffice/server-client": "workspace:^", "@onlyoffice/service-declaration": "workspace:^", diff --git a/site/pages/DocSpace/For Hosting Providers/Usage API/api.tsx b/site/pages/DocSpace/For Hosting Providers/Usage API/api.tsx index 89b5ebb80..905adb89e 100644 --- a/site/pages/DocSpace/For Hosting Providers/Usage API/api.tsx +++ b/site/pages/DocSpace/For Hosting Providers/Usage API/api.tsx @@ -1,7 +1,7 @@ import {type Data} from "@onlyoffice/eleventy-types" import * as g from "@/generations/service.ts" -import * as r from "@/resources/docspace-hosted-solutions.ts" +import * as r from "@/resources/docspace.ts" export function data(): Data { - return g.data(r) + return g.data(r.apisystem) } diff --git a/site/pages/DocSpace/JavaScript SDK/index.md b/site/pages/DocSpace/JavaScript SDK/index.md index 0971d4825..a1d9d4649 100644 --- a/site/pages/DocSpace/JavaScript SDK/index.md +++ b/site/pages/DocSpace/JavaScript SDK/index.md @@ -1,5 +1,5 @@ --- -order: -3 +order: -4 icon: javascript-sdk summary: In this section, you will learn how to connect DocSpace as a frame to your website using api.js. You can embed an entire DocSpace portal, a single room, or a document. diff --git a/site/pages/DocSpace/OAuth API/Get Started/Basic concepts/index.md b/site/pages/DocSpace/OAuth API/Get Started/Basic concepts/index.md new file mode 100644 index 000000000..a1fa334d3 --- /dev/null +++ b/site/pages/DocSpace/OAuth API/Get Started/Basic concepts/index.md @@ -0,0 +1,21 @@ +The [OAuth 2.0](https://datatracker.ietf.org/doc/html/rfc6749) authorization protocol enables a third-party application to obtain limited access to an HTTP service. You can add OAuth applications to the DocSpace portal and use them to access the API for authorization and further actions such as accessing accounts, rooms, files, etc. + +**DocSpace OAuth API** allows developers to register a new OAuth application on the portal. + +This documentation describes: + +- How to [create a new OAuth application](../../Usage%20API/Creating%20OAuth%20App/index.md) +- How to [edit the application](../../Usage%20API/Editing%20OAuth%20App/index.md) +- How to preview the [authorization button](../../Usage%20API/Auth%20Button/index.md) and embed it into your website +- How to [generate a developer token](../../Usage%20API/Developer%20Token/index.md) +- How the [authorization flow](../../Usage%20API/Authorization%20Flow/index.md) looks like +- How to [view active authorizations](../../Usage%20API/Viewing%20Active%20Authorizations/index.md) + +## What OAuth apps can do + +An OAuth application can: + +- authorize users through the DocSpace portal without storing or processing passwords; +- access user account information (such as name) to verify their identity without having access to the password; +- use an access token to retrieve user information (before the token expires); +- perform only those actions on the data that are allowed by the authorized user. diff --git a/site/pages/DocSpace/OAuth API/Get Started/index.md b/site/pages/DocSpace/OAuth API/Get Started/index.md new file mode 100644 index 000000000..db1baa816 --- /dev/null +++ b/site/pages/DocSpace/OAuth API/Get Started/index.md @@ -0,0 +1,5 @@ +--- +chapter: + tableOfContents: true +order: -2 +--- diff --git a/site/pages/DocSpace/OAuth API/Usage API/Auth Button/index.md b/site/pages/DocSpace/OAuth API/Usage API/Auth Button/index.md new file mode 100644 index 000000000..cecac0d07 --- /dev/null +++ b/site/pages/DocSpace/OAuth API/Usage API/Auth Button/index.md @@ -0,0 +1,78 @@ +--- +order: -4 +--- + +1. To preview an auth button in your application, click ![More icon](/assets/images/docspace/more-icon.png) to open the context menu and choose **Auth button**. + + ![Auth button](/assets/images/docspace/auth-button.png) + +2. In the opened window, copy HTML, CSS, and JavaScript code blocks and use them to embed a button into your website. + + Preview + +3. Copy the **Authorize link** and assign it to the authorization button. This link contains the following parameters: + +## response_type + +The type of the server response after authenticating the user and redirecting them to [redirect_uri](#redirect_uri). Currently, the *code* value is supported. + +Example: code + +## client_id + +The ID of the client that will be used for authorization. + +Example: 695d37b7-18aa-4033-91b4-09690178e99a + +## redirect_uri + +The URL where the user will be redirected after successful or unsuccessful authentication. + +Example: `https://redirect-url.com` + +## scope + +All the possibilities of the current application to work with the DocSpace portal. + +To get the required value, use the following code: + +``` ts +const scopesString = client.scopes.join(" ") +const encodingScopes = encodeURI(scopesString || "") +``` + +Example: files:write%20accounts:write%20files:read%20openid%20rooms:read%20accounts.self:read%20accounts:read%20accounts.self:write%20rooms:write + +## state + +The random string to solve the CSRF vulnerability problem. This parameter with the *code* value will be added to [redirect_uri](#redirect_uri). This parameter is optional, but we recommend to specify it for security purposes. + +Example: OENBaHXhZStQ9eDVIq1NlHu6luruKqJtCp6RhgOFXAeAp4YWoUHtOkGYCPtW7l8T-qtZaoUnmvtHZuJbb3d-wgYtHOKhd-nqisoeiO91u-Z9fsnhtiO318JmihPflIpV + +## code_challenge_method + +The method to encode the code verifier. Two parameters are supported: **plain** and **S256** (preferred). This parameter is used only when the authentication method is not specified (none) and the public client (PKCE) is allowed. + +Example: S256 + +## code_challenge + +The encoded code verifier. To get it, use the **crypto-js** npm package and the following code: + +``` ts +// Total of 44 characters (1 Bytes = 2 char) (standard states that: 43 chars <= //verifier <= 128 chars) +const NUM_OF_BYTES = 36 + +const codeVerifier = crypto.lib.WordArray.random(NUM_OF_BYTES).toString() +const codeVerifierHash = sha256(randomVerifier).toString(crypto.enc.Base64) +``` + +This parameter is used only when the authentication method is not specified (none) and the public client (PKCE) is allowed. + +Example: kNDpYrWzia4n6BoUewMVbnb5kQRIFgVdiaKwNGZ-_Wc + +> Please note that the code verifier will be generated anew each time the preview dialog is reopened. + +You can click the example button to go through the entire [authorization flow](../Authorization%20Flow/index.md). + +Authorization flow diff --git a/site/pages/DocSpace/OAuth API/Usage API/Authorization Flow/index.md b/site/pages/DocSpace/OAuth API/Usage API/Authorization Flow/index.md new file mode 100644 index 000000000..8dd452f76 --- /dev/null +++ b/site/pages/DocSpace/OAuth API/Usage API/Authorization Flow/index.md @@ -0,0 +1,89 @@ +--- +order: -2 +--- + +When the user goes to the authorization link, four scenarios are possible. + +## Scenario 1. User authorization + +If the user is not yet authorized on the portal, an authorization form opens. The user must enter their email and password and click the **Sign in** button. If the authorization is successful, they will be redirected to the pages described in scenarios 2 and 3. + +Authorization flow + +## Scenario 2. Portal selection + +If the user has more than one portal with the entered personal data, they will be redirected to the page for choosing the necessary one. + +Choose portal + +## Scenario 3. Consent page + +If the user is already authorized on the portal, they will be redirected to a consent page where all the application abilities will be listed and the URLs to the privacy policy and terms of service will be displayed. Also there will be the possibility to change the user profile. + +Click **Allow** or **Deny** to finish the authorization flow. + +Consent page + +## Scenario 4. Error page + +If the authorization link contains non-existent [client_id](../Auth%20Button/index.md#client_id) and [redirect_uri](../Auth%20Button/index.md#redirect_uri), the user will be redirected to the DocSpace error page. + +Error page + +## How it works + +1. When the user clicks the **Allow** button on the consent page, they will be redirected to [redirect_uri](#redirect_uri) where the code field will be added to the search. + + > If the user clicks the **Deny** button on the consent page, they will be redirected to [redirect_uri](#redirect_uri) with an error, without the possibility to get JWT. + +2. The application exchanges the user code for the access token and refresh token, save them to its storage, and use these tokens to get the access to the DocSpace API. + +3. The application sends the POST request: + +``` ini +{{docspace_address}}/oauth2/token +``` + +The parameters that must be specified in the request body depends on the client type. + +### For client_secret_post + +#### client_id + +The ID of the client that will be used for authorization. + +Example: 695d37b7-18aa-4033-91b4-09690178e99a + +#### client_secret + +The secret of the client that will be used for authorization. + +Example: 49487362-7d4a-471f-bbf3-c04e2e1c541f + +#### grant_type + +The OAuth grant type. + +Example: authorization_code + +#### code + +A temporary authorization code that is sent to the client to be exchanged for a token. + +Example: OENBaHXhZStQ9eDVIq1NlHu6luruKqJtCp6RhgOFXAeAp4YWoUHtOkGYCPtW7l8T-qtZaoUnmvtHZuJbb3d-wgYtHOKhd-nqisoeiO91u-Z9fsnhtiO318JmihPflIpV + +#### redirect_uri + +The URL where the user will be redirected after successful or unsuccessful authentication. + +Example: `https://redirect-url.com` + +### For client with PKCE + +For the client with PKCE, the parameters are the same as for **client_secret_post**, but the [client_secret](#client_secret) must be replaced with the **code_verifier**. + +#### code_verifier + +The code verifier, a cryptographically random string between 43 and 128 characters long. + +Example: a50883696b67d1e91e52be26d86b78ae902b354a4b3a8965aaffbe30fc8056c8b9afa066 diff --git a/site/pages/DocSpace/OAuth API/Usage API/Creating OAuth App/index.md b/site/pages/DocSpace/OAuth API/Usage API/Creating OAuth App/index.md new file mode 100644 index 000000000..e472dec49 --- /dev/null +++ b/site/pages/DocSpace/OAuth API/Usage API/Creating OAuth App/index.md @@ -0,0 +1,102 @@ +--- +order: -6 +--- + +To create a new OAuth application on your portal: + +1. Go to the DocSpace settings. + +2. Navigate to the **Developer Tools** section. + +3. Open the **OAuth 2.0** tab. + +4. Click **Register a new application**. + + ![OAuth new app](/assets/images/docspace/oauth-new-app.png) + +5. Specify the settings for your application: + +## Basic info + +### App name + +The application name that will be displayed on all consent screens and in the app list. + +Presence: required + +### Website URL + +The URL to the home page of the application website. + +Presence: required + +### App icon + +The application icon that will be displayed on all consent screens and in the app list. Available icon extensions: JPG, PNG, or SVG. The required icon size is 32x32. +Presence: required + +### Description + +The application brief description. + +Presence: optional + +### Authentication method + +The verification method when receiving a JWT token. To receive the token, you will need to send the SHA key. Check **Allow public client (PKCE)** to use PKCE. + +PKCE ([RFC 7636](https://www.rfc-editor.org/rfc/rfc7636)) is an extension to the [Authorization Code flow](https://oauth.net/2/grant-types/authorization-code/) to prevent CSRF and authorization code injection attacks. + +PKCE is not a form of client authentication, and PKCE is not a replacement for a client secret or other client authentication. PKCE is recommended even if a client is using a client secret or other form of [client authentication](https://oauth.net/2/client-authentication/) like [private_key_jwt](https://oauth.net/private-key-jwt/). + +Because PKCE is not a replacement for client authentication, it does not allow treating a public client as a confidential client. + +Presence: optional + +### Redirects URLS + +The URLs where the user will be redirected after successfully passing the consent screen. Enter the address and press the **Add** button. You can specify several URLs by clicking ![Plus icon](/assets/images/docspace/plus.png). For example, for test and production versions. + +Presence: required + +### Allowed origins + +The URLs of sources that will be able to make requests to the DocSpace API without CORS blocking. Enter the address and press the **Add** button. You can specify several URLs by clicking ![Plus icon](/assets/images/docspace/plus.png). + +Presence: required + +![Basic info](/assets/images/docspace/basic-info.png) + +## Access scopes + +Defines the capabilities of a third-party application in relation to Docspace API. Scopes are used to limit your app's access to all user-related data, and they'll let you specify exactly what kind of access you need. This parameter is required. + +| Scope | Read | Write | +| --------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| Profile | *accounts.self:read* - view basic information about your profile. | *accounts.self:write* - view and manage basic information about your profile. | +| Accounts | *accounts:read* - view all accounts. | *accounts:write* - view and manage all accounts. | +| Files & Folders | *files:read* - view all files and folders. | *files:write* - view and manage all files and folders. | +| Rooms | *rooms:read* - view all rooms. | *rooms:write* - view and manage all rooms. | +| Open ID | *openid* - view your personal data. | | + +Check **Read** or **Write** options near each scope. When selecting the **Write** capability, the **Read** option is automatically enabled. + +![Access scopes](/assets/images/docspace/access-scopes.png) + +## Support & Legal info + +### Privacy policy URL + +The URL to the Privacy Policy that must comply with applicable laws and regulations and that make clear how the application collects, uses, shares, retains and otherwise processes personal information. + +Presence: required + +### Terms of Service URL + +The terms and conditions that users must comply with when using this application. + +Presence: required + +![Support and legal info](/assets/images/docspace/support-and-legal-info.png) + +When all settings are specified, click **Save**. A new application will appear in the application list. diff --git a/site/pages/DocSpace/OAuth API/Usage API/Developer Token/index.md b/site/pages/DocSpace/OAuth API/Usage API/Developer Token/index.md new file mode 100644 index 000000000..50f4f4ae4 --- /dev/null +++ b/site/pages/DocSpace/OAuth API/Usage API/Developer Token/index.md @@ -0,0 +1,35 @@ +--- +order: -3 +--- + +You can generate a developer access token that allows you to make API calls without authorization. To obtain access tokens for other users, apply the standard OAuth flow. + +For scoped apps, the token will have the same scope as the app. + +To create the developer token: + +1. Click ![More icon](/assets/images/docspace/more-icon.png) to open the context menu and choose **Generate token**. + + ![Generate token](/assets/images/docspace/generate-token.png) + +2. In the opened modal window, click **Generate**. + + ![Token window](/assets/images/docspace/token-window.png) + +3. Click **Copy & Cancel** to copy the generated token and use it later. + +The created token has a limited lifetime and will be automatically deprecated when a new one is generated. + +## Revoking the token + +The token can be revoked: + +1. Click ![More icon](/assets/images/docspace/more-icon.png) to open the context menu and choose **Revoke token**. +2. Enter your token in the text field. +3. Click **Revoke**. + +![Revoke token](/assets/images/docspace/revoke-token.png) + +The validation is performed by application ID and token lifetime. + +Any integrations using this token will no longer be able to access the API. diff --git a/site/pages/DocSpace/OAuth API/Usage API/Editing OAuth App/index.md b/site/pages/DocSpace/OAuth API/Usage API/Editing OAuth App/index.md new file mode 100644 index 000000000..5105f5379 --- /dev/null +++ b/site/pages/DocSpace/OAuth API/Usage API/Editing OAuth App/index.md @@ -0,0 +1,43 @@ +--- +order: -5 +--- + +To edit the application settings: + +1. Left-click the application in the list. + + ![OAuth app](/assets/images/docspace/oauth-app.png) + + or + +2. Click ![More icon](/assets/images/docspace/more-icon.png) to open the context menu and choose **Edit**. + + ![Edit button](/assets/images/docspace/edit-button.png) + +For security purposes, you can edit only **App name**, **App icon**, **Description**, and **Authentication method**. In the following versions, this list might be expanded. + +![Editing app](/assets/images/docspace/editing-app.png) + +## Disabling the app + +To disable the application: + +1. Click the toggle button next to the application in the list. + + ![Disable toggle button](/assets/images/docspace/disable-toggle-button.png) + + or + +2. Click ![More icon](/assets/images/docspace/more-icon.png) to open the context menu and choose **Disable**. + + ![Disable button](/assets/images/docspace/disable-button.png) + +When the application is disabled, all active sessions will be stopped. + +## Deleting the app + +To delete the application, click ![More icon](/assets/images/docspace/more-icon.png) to open the context menu and choose **Delete**. + +![Delete button](/assets/images/docspace/delete-button.png) + +All active sessions will be stopped and deleted. diff --git a/site/pages/DocSpace/OAuth API/Usage API/Viewing Active Authorizations/index.md b/site/pages/DocSpace/OAuth API/Usage API/Viewing Active Authorizations/index.md new file mode 100644 index 000000000..4fd4d3b05 --- /dev/null +++ b/site/pages/DocSpace/OAuth API/Usage API/Viewing Active Authorizations/index.md @@ -0,0 +1,11 @@ +--- +order: -1 +--- + +Each user can see the applications they have granted access to on the profile page, on the **Authorized apps** tab. + +![Authorized apps](/assets/images/docspace/authorized-apps.png) + +To revoke access rights from the specified application, click ![More icon](/assets/images/docspace/more-icon.png) to open the context menu and press the **Revoke** button. + +![Revoke app rights](/assets/images/docspace/revoke.png) diff --git a/site/pages/DocSpace/OAuth API/Usage API/index.md b/site/pages/DocSpace/OAuth API/Usage API/index.md new file mode 100644 index 000000000..16e65bfb9 --- /dev/null +++ b/site/pages/DocSpace/OAuth API/Usage API/index.md @@ -0,0 +1,5 @@ +--- +chapter: + tableOfContents: true +order: -1 +--- diff --git a/site/pages/DocSpace/OAuth API/index.md b/site/pages/DocSpace/OAuth API/index.md new file mode 100644 index 000000000..af21f1848 --- /dev/null +++ b/site/pages/DocSpace/OAuth API/index.md @@ -0,0 +1,11 @@ +--- +order: -2 +icon: docs-api +summary: In this section, you will learn how to register a new OAuth application on the DocSpace portal. + +menubar: + path: /pages/DocSpace/OAuth API/Get Started/Basic concepts/index.md + +chapter: + tableOfContents: true +--- diff --git a/site/pages/DocSpace/Plugins SDK/Usage SDK/Adding Plugin/index.md b/site/pages/DocSpace/Plugins SDK/Usage SDK/Adding Plugin/index.md index 61a11b169..b613de2cc 100644 --- a/site/pages/DocSpace/Plugins SDK/Usage SDK/Adding Plugin/index.md +++ b/site/pages/DocSpace/Plugins SDK/Usage SDK/Adding Plugin/index.md @@ -42,6 +42,8 @@ Now the plugin is available to use. ## Uploading plugins +> You can upload your own plugins only in the DocSpace on-premises solution. In the SaaS solution, this option is unavailable. + In the DocSpace on-premises solution, the system plugins will be available on the same **Plugins** page. But in this case, you also have the option to upload your own plugins. To do this: 1. In the lower left corner, click ![More icon](/assets/images/docspace/more-icon.png) and open the **Settings** page. @@ -54,7 +56,7 @@ In the DocSpace on-premises solution, the system plugins will be available on th 4. Click the **Upload plugin** button. - ![Plugin uploading](/assets/images/docspace/upload-plugin.jpg) + ![Plugin uploading](/assets/images/docspace/upload-plugin.png) 5. Choose the plugin archive and click **Open**. diff --git a/site/pages/DocSpace/Plugins SDK/index.md b/site/pages/DocSpace/Plugins SDK/index.md index 6ba923925..f94bdba64 100644 --- a/site/pages/DocSpace/Plugins SDK/index.md +++ b/site/pages/DocSpace/Plugins SDK/index.md @@ -1,5 +1,5 @@ --- -order: -2 +order: -3 icon: plugins summary: In this section, you will learn how to create your own plugins and add them to the DocSpace portal. diff --git a/site/pages/Docs/Docs API/Additional API/Conversion API/Conversion tables/index.md b/site/pages/Docs/Docs API/Additional API/Conversion API/Conversion tables/index.md new file mode 100644 index 000000000..f4069db16 --- /dev/null +++ b/site/pages/Docs/Docs API/Additional API/Conversion API/Conversion tables/index.md @@ -0,0 +1,77 @@ +--- +order: -2 +--- + +Below you can find tables with formats that are available for conversion in different types of editors. + +## Text document file formats + +| | bmp | docm | docx | docxf | dotm | dotx | epub | fb2 | gif | html | jpg | odt | ott | pdf | pdfa | png | rtf | txt | +| ----- | --- | ---- | ---- | ----- | ---- | ---- | ---- | --- | --- | ---- | --- | --- | --- | --- | ---- | --- | --- | --- | +| djvu | + | | | | | | | | + | | + | | | + | + | + | | | +| doc | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| docm | + | | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| docx | + | + | | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| docxf | + | + | + | | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| dot | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| dotm | + | + | + | + | | + | + | + | + | + | + | + | + | + | + | + | + | + | +| dotx | + | + | + | + | + | | + | + | + | + | + | + | + | + | + | + | + | + | +| epub | + | + | + | + | + | + | | + | + | + | + | + | + | + | + | + | + | + | +| fb2 | + | + | + | + | + | + | + | | + | + | + | + | + | + | + | + | + | + | +| fodt | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| htm | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| html | + | + | + | + | + | + | + | + | + | | + | + | + | + | + | + | + | + | +| mht | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| mhtml | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| odt | + | + | + | + | + | + | + | + | + | + | + | | + | + | + | + | + | + | +| ott | + | + | + | + | + | + | + | + | + | + | | + | + | + | + | + | + | + | +| oxps | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| pdf | + | + | + | + | + | + | + | + | + | + | + | + | + | | + | + | + | + | +| rtf | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | | + | +| stw | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| sxw | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| txt | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | | +| wps | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| wpt | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| xml | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| xps | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + +## Spreadsheet file formats + +| | bmp | csv | gif | jpg | ods | ots | pdf | pdfa | png | xlsm | xlsx | xltm | xltx | +| ---- | --- | --- | --- | --- | --- | --- | --- | ---- | --- | ---- | ---- | ---- | ---- | +| csv | + | | + | + | + | + | + | + | + | + | + | + | + | +| et | + | + | + | + | + | + | + | + | + | + | + | + | + | +| ett | + | + | + | + | + | + | + | + | + | + | + | + | + | +| fods | + | + | + | + | + | + | + | + | + | + | + | + | + | +| ods | + | + | + | + | | + | + | + | + | + | + | + | + | +| ots | + | + | + | + | + | | + | + | + | + | + | + | + | +| sxc | + | + | + | + | + | + | + | + | + | + | + | + | + | +| xls | + | + | + | + | + | + | + | + | + | + | + | + | + | +| xlsb | + | + | + | + | + | + | + | + | + | + | + | + | + | +| xlsm | + | + | + | + | + | + | + | + | + | | + | + | + | +| xlsx | + | + | + | + | + | + | + | + | + | + | | + | + | +| xlt | + | + | + | + | + | + | + | + | + | + | + | + | + | +| xltm | + | + | + | + | + | + | + | + | + | + | + | | + | +| xltx | + | + | + | + | + | + | + | + | + | + | + | + | | +| xml | + | + | + | + | + | + | + | + | + | + | + | + | + | + +## Presentation file formats + +| | bmp | gif | jpg | odp | otp | pdf | pdfa | png | potm | potx | ppsm | ppsx | pptm | pptx | +| ---- | --- | --- | --- | --- | --- | --- | ---- | --- | ---- | ---- | ---- | ---- | ---- | ---- | +| dps | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| dpt | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| fodp | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| odp | + | + | + | | + | + | + | + | + | + | + | + | + | + | +| otp | + | + | + | + | | + | + | + | + | + | + | + | + | + | +| pot | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| potm | + | + | + | + | + | + | + | + | | + | + | + | + | + | +| potx | + | + | + | + | + | + | + | + | + | | + | + | + | + | +| pps | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| ppsm | + | + | + | + | + | + | + | + | + | + | | + | + | + | +| ppsx | + | + | + | + | + | + | + | + | + | + | + | | + | + | +| ppt | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +| pptm | + | + | + | + | + | + | + | + | + | + | + | + | | + | +| pptx | + | + | + | + | + | + | + | + | + | + | + | + | + | | +| sxi | + | + | + | + | + | + | + | + | + | + | + | + | + | + | diff --git a/site/pages/Docs/Docs API/Additional API/Conversion API/Error codes/index.md b/site/pages/Docs/Docs API/Additional API/Conversion API/Error codes/index.md new file mode 100644 index 000000000..983c8e973 --- /dev/null +++ b/site/pages/Docs/Docs API/Additional API/Conversion API/Error codes/index.md @@ -0,0 +1,18 @@ +--- +order: -1 +--- + +An [error](../Response/index.md#error) can occur during the conversion. Below you can find possible error codes and their description. + +| Error code | Description | +| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| -1 | Unknown error. | +| -2 | Conversion timeout error. | +| -3 | Conversion error. | +| -4 | Error while downloading the document file to be converted. | +| -5 | Incorrect password. | +| -6 | Error while accessing the conversion result database. | +| -7 | Input error. | +| -8 | Invalid token. | +| -9 | Error when the converter cannot automatically determine the output file format. This error means that the client must explicitly specify in which format the file should be converted (text document or spreadsheet). It is used to convert XML to OOXML in case the XML type is unknown. | +| -10 | Size limit exceeded. | diff --git a/site/pages/Docs/Docs API/Additional API/Conversion API/Request/index.md b/site/pages/Docs/Docs API/Additional API/Conversion API/Request/index.md new file mode 100644 index 000000000..2be52af3f --- /dev/null +++ b/site/pages/Docs/Docs API/Additional API/Conversion API/Request/index.md @@ -0,0 +1,757 @@ +--- +order: -4 +--- + +For the interaction with the **document conversion service** the POST requests are used. The request parameters are entered in JSON format in the request body. The requests are sent to the `https://documentserver/converter` address where **documentserver** is the name of the server with the ONLYOFFICE Docs installed. + +> Please note that prior to version 5.5, the `https://documentserver/ConvertService.ashx` address was used to send requests. + +Starting from version 8.1, it is recommended to add the [shardkey](../../../Get%20Started/How%20It%20Works/index.md#shard-key) parameter to the URL *QueryString* with the *key* value in it. For example, *?shardkey=Khirz6zTPdfd7*. This allows you to load balance requests. + +> In **ONLYOFFICE Docs** prior to version 4.2 the GET request with the parameters in the *QueryString* were used. + +- [async](#async) +- [codePage](#codepage) +- [delimiter](#delimiter) +- [documentLayout](#documentlayout) +- [documentRenderer](#documentrenderer) +- [filetype](#filetype) +- [key](#key) +- [outputtype](#outputtype) +- [password](#password) +- [pdf](#pdf) +- [region](#region) +- [spreadsheetLayout](#spreadsheetlayout) +- [thumbnail](#thumbnail) +- [title](#title) +- [token](#token) +- [url](#url) +- [watermark](#watermark) + +## Request parameters and their description + +### async + +Defines the conversion request type: asynchronous or not. + +Supported values: + +- **true** +- **false** + +When the asynchronous request type is used, the response is formed instantly. In this case to get the result it is necessary to send requests without parameter change until the conversion is finished. The default value is **false**. + +Type: boolean + +Presence: optional + +> If the conversion is synchronous and the file takes a long time to be converted, a web request timeout error may occur. Although the conversion can be eventually completed, the result can only be obtained by sending the request again with the same key. + +### codePage + +Defines the file encoding when converting from *csv* or *txt* format. + +Main supported values: + +- **932** - Japanese (Shift-JIS); +- **950** - Chinese Traditional (Big5); +- **1250** - Central European (Windows); +- **1251** - Cyrillic (Windows); +- **65001** - Unicode (UTF-8). + +You can find all the supported values [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). + +Type: integer + +Presence: optional + +### delimiter + +Defines the delimiter characters for separating values when converting from *csv* format. + +Supported values: + +- **0** - no delimiter; +- **1** - tab; +- **2** - semicolon; +- **3** - colon; +- **4** - comma; +- **5** - space. + +Type: integer + +Presence: optional + +### documentLayout + +Defines the document layout which specifies parameters for printing forms as *pdf* documents or images. + +Type: object + +Presence: optional + +#### documentLayout.drawPlaceHolders + +Defines if placeholders will be drawn or not. + +Type: boolean + +Presence: optional + +#### documentLayout.drawFormHighlight + +Defines if forms will be highlighted or not. + +Type: boolean + +Presence: optional + +#### documentLayout.isPrint + +Defines if the print mode is turned on or off. This parameter is used only for converting *docx/docxf* into *pdf*. If this parameter is equal to **true**, the *drawPlaceHolders* and *drawFormHighlight* flags are used as described above. If this parameter is **false**, the *drawFormHighlight* flag does not work and the *drawPlaceHolders* parameter allows saving the forms in the *pdf* format. The default value is **false**. + +Type: boolean + +Presence: optional + +### documentRenderer + +Defines the document renderer when converting from *pdf*, *xps*, *oxps*. + +Type: object + +Presence: optional + +#### documentRenderer.textAssociation + +Defines the rendering mode that can have the following values: + +- **blockChar** - all text is converted by single characters. Each character is in its own frame (like a textbox); +- **blockLine** - all text is converted by separate lines. Each text line is in its own frame. Lines can be combined within the same block; +- **plainLine** - all text is converted as a plain text. But each line is a separate paragraph; +- **plainParagraph** - all text is converted as a plain text. Lines are combined into paragraphs. + +The default value is **plainLine**. + +Type: string + +Presence: optional + +### filetype + +Defines the type of the document file to be converted. + +> In the tables below you can see possibility of conversion your documents into the most known file formats, where the **Input format** column corresponds to the values of the **filetype** parameter and the **Output format** columns correspond to the values of the **outputtype** parameter. + +Type: string + +Presence: required + +### key + +Defines the document identifier used to unambiguously identify the document file. + +Type: string + +Presence: required + +### outputtype + +Defines the resulting converted document type. Starting from version 7.0, file formats can be specified instead of extensions. They are used when we do not know in advance what extension is required: + +- **ooxml** - defines that the file will be converted into *docx*, *docm*, *xlsx*, *xlsm*, *pptx* or *pptm*. For example, when the *doc* file is converted into the OOXML format, the resulting file can be *docx* or *docm* if this file contains macros (the same for *xls* and *ppt*). It is also applied when converting XML files into OOXML formats (*docx*, *xlsx* or *pptx* depending on the content); +- **odf** - defines that the file will be converted into *odt*, *ods* or *odp*. For example, it is used when converting XML files into ODF formats (*odt*, *ods* or *odp* depending on the content). + +> In the tables below you can see possibility of conversion your documents into the most known file formats, where the **Input format** column corresponds to the values of the **filetype** parameter and the **Output format** columns correspond to the values of the **outputtype** parameter. + +Type: string + +Presence: required + +### password + +Defines the password for the document file if it is protected with a password. + +Type: string + +Presence: optional + +### pdf + +Defines settings for converting document files to pdf. + +Type: object + +Presence: optional + +#### pdf.form + +Defines whether the document will be converted to the *pdf* form (**true**) or to a regular *pdf* file (**false**). If this parameter is omitted, the document contents will not be changed. If the document has fields, they will remain in the converted document. If has not, the converted document will not contain them either. For example, you don't need to specify this parameter when converting *docxf* and *oform* formats to *pdf*. They will always be converted to *pdf* forms. + +Type: boolean + +Presence: optional + +### region + +Defines the default display format for currency and date and time when converting from *Spreadsheet format* to *pdf*. Is set using the four letter (**en-US**, **fr-FR**, etc.) language codes. The default value is **en-US**. + +Type: string + +Presence: optional + +### spreadsheetLayout + +Defines settings for converting the spreadsheet to pdf. + +> Please note that the maximum number of pages that can be returned at once after converting a spreadsheet into pdf or image formats is no more than 1500. + +Type: object + +Presence: optional + +#### spreadsheetLayout.fitToHeight + +Sets the height of the converted area, measured in the number of pages. The default value is **0**. + +Type: integer + +Presence: optional + +#### spreadsheetLayout.fitToWidth + +Sets the width of the converted area, measured in the number of pages. The default value is **0**. + +Type: integer + +Presence: optional + +#### spreadsheetLayout.gridLines + +Allows to include grid lines to the output PDF file or not. The default value is **false**. + +Type: boolean + +Presence: optional + +#### spreadsheetLayout.headings + +Allows to include the headings to the output PDF file or not. The default value is **false**. + +Type: boolean + +Presence: optional + +#### spreadsheetLayout.ignorePrintArea + +Determines whether to ignore the print area chosen for the spreadsheet file or not. The default value is **true**. + +Type: boolean + +Presence: optional + +#### spreadsheetLayout.margins + +Sets the margins of the output PDF file. + +Type: object + +Presence: optional + +#### spreadsheetLayout.margins.bottom + +Sets the bottom margin of the output PDF file. The default value is **19.1mm**. + +Type: string + +Presence: optional + +#### spreadsheetLayout.margins.left + +Sets the left margin of the output PDF file. The default value is **17.8mm**. + +Type: string + +Presence: optional + +#### spreadsheetLayout.margins.right + +Sets the right margin of the output PDF file. The default value is **17.8mm**. + +Type: string + +Presence: optional + +#### spreadsheetLayout.margins.top + +Sets the top margin of the output PDF file. The default value is **19.1mm**. + +Type: string + +Presence: optional + +#### spreadsheetLayout.orientation + +Sets the orientation of the output PDF file. May be **landscape**, **portrait**. The default value is **portrait**. + +Type: string + +Presence: optional + +#### spreadsheetLayout.pageSize + +Sets the page size of the output PDF file. + +Type: object + +Presence: optional + +#### spreadsheetLayout.pageSize.height + +Sets the page height of the output PDF file. The default value is **297mm**. + +Type: string + +Presence: optional + +#### spreadsheetLayout.pageSize.width + +Sets the page width of the output PDF file. The default value is **210mm**. + +Type: string + +Presence: optional + +#### spreadsheetLayout.scale + +Allows to set the scale of the output PDF file. The default value is **100**. + +Type: integer + +Presence: optional + +### thumbnail + +Defines the settings for the thumbnail when specifying the image formats (*bmp*, *gif*, *jpg*, *png*) as **outputtype**. + +Type: object + +Presence: optional + +#### thumbnail.aspect + +Defines the mode to fit the image to the height and width specifyed. Supported values: + +- **0** - stretch file to fit height and width; +- **1** - keep the aspect for the image; +- **2** - in this case, the width and height settings are not used. Instead of that, metric sizes of the page are converted into pixels with 96dpi. E.g., the A4 (210x297mm) page will turn out to be a picture with the 794x1123pix dimensions. + +The default value is **2**. + +Type: integer + +Presence: optional + +#### thumbnail.first + +Defines if the thumbnails should be generated for the first page only or for all the document pages. If false, the zip archive containing thumbnails for all the pages will be created. The default value is **true**. + +Type: boolean + +Presence: optional + +#### thumbnail.height + +Defines the thumbnail height in pixels. The default value is **100**. + +Type: integer + +Presence: optional + +#### thumbnail.width + +Defines the thumbnail width in pixels. The default value is **100**. + +Type: integer + +Presence: optional + +### title + +Defines the converted file name. + +Type: string + +Presence: optional + +### token + +Defines the encrypted signature added to the **ONLYOFFICE Docs** config in the form of a [token](../../Signature/Request/Token%20in%20body/index.md#request-to-convert-the-document). + +Type: string + +Presence: required by configuration + +### url + +Defines the absolute URL to the document to be converted. Be sure to add a [token](../../../Get%20Started/How%20It%20Works/Security/index.md) when using local links. Otherwise, an error will occur. + +Type: string + +Presence: required + +### watermark + +Defines a JSON object containing the properties of a watermark which is inserted into the pdf and image files during conversion. + +Type: object + +Presence: optional + +#### watermark.transparent + +Defines the watermark transparency degree. + +Type: float + +Presence: optional + +#### watermark.type + +Defines the shape type which specifies the preset shape geometry for the current watermark. + +Type: string + +Presence: optional + +#### watermark.width + +Defines the watermark width measured in millimeters. + +Type: integer + +Presence: optional + +#### watermark.height + +Defines the watermark height measured in millimeters. + +Type: integer + +Presence: optional + +#### watermark.rotate + +Defines the watermark rotation angle measured in degrees. + +Type: integer + +Presence: optional + +#### watermark.margins + +Defines the text margins measured in millimeters in the watermark shape. + +Type: array of integers + +Presence: optional + +#### watermark.fill + +Defines the watermark fill color in the RGB format, or the URL to image (base64 support: *data:image/png;...*). The empty array \[] means that the watermark has no fill. + +Type: array of integers \| string + +Presence: optional + +#### watermark.stroke-width + +Defines the watermark stroke width measured in millimeters. + +Type: integer + +Presence: optional + +#### watermark.stroke + +Defines the watermark stroke color in the RGB format. The empty array \[] means that the watermark stroke has no fill. + +Type: array of integers + +Presence: optional + +#### watermark.align + +Defines the vertical text align in the watermark shape: **0** - bottom, **1** - center, **4** - top. + +Type: integer + +Presence: optional + +#### watermark.paragraphs + +Defines the array with paragraphs from the current watermark with their properties. + +Type: array of objects + +Presence: optional + +#### watermark.paragraphs.align + +Defines the horizontal text align in the current paragraph: **0** - right, **1** - left, **2** - center, **3** - justify. + +Type: integer + +Presence: optional + +#### watermark.paragraphs.fill + +Defines the paragraph highlight in the RGB format. The empty array \[] means that the paragraph is not highlighted. + +Type: array of integers + +Presence: optional + +#### watermark.paragraphs.linespacing + +Defines the text linespacing in the current paragraph. + +Type: integer + +Presence: optional + +#### watermark.paragraphs.runs + +Defines the array with runs from the current paragraph with their properties. + +Type: array of objects + +Presence: optional + +#### watermark.paragraphs.runs.text + +Defines the run text. + +Type: string + +Presence: optional + +#### watermark.paragraphs.runs.fill + +Defines the text highlight in the RGB format. The empty array \[] means that the text is not highlighted. + +Type: array of integers + +Presence: optional + +#### watermark.paragraphs.runs.font-family + +Defines the text font family. + +Type: string + +Presence: optional + +#### watermark.paragraphs.runs.font-size + +Defines the text font size measured in points (pt). + +Type: string + +Presence: optional + +#### watermark.paragraphs.runs.bold + +Defines if the current text is displayed bold or not. + +Type: boolean + +Presence: optional + +#### watermark.paragraphs.runs.italic + +Defines if the current text is displayed italic or not. + +Type: boolean + +Presence: optional + +#### watermark.paragraphs.runs.strikeout + +Defines if the current text is displayed struck through or not. + +Type: boolean + +Presence: optional + +#### watermark.paragraphs.runs.underline + +Defines if the current text is displayed underlined or not. + +Type: boolean + +Presence: optional + +## Examples of requests + +### Sample of JSON object sent to **document conversion service** used to convert the file from *docx* format to *pdf* format + +``` json +{ + "async": false, + "filetype": "docx", + "key": "Khirz6zTPdfd7", + "outputtype": "pdf", + "title": "Example Document Title.docx", + "url": "https://example.com/url-to-example-document.docx" +} +``` + +Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. + +### Sample of JSON object sent to **document conversion service** used to convert the password-protected file from *docx* format to *pdf* format + +``` json +{ + "async": false, + "filetype": "docx", + "key": "Khirz6zTPdfd7", + "outputtype": "pdf", + "password": "123456", + "title": "Example Document Title.docx", + "url": "https://example.com/url-to-example-document.docx" +} +``` + +Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. + +### Sample of JSON object sent to **document conversion service** used to convert the file from *docx* format to *pdf* form + +``` json +{ + "async": false, + "filetype": "docx", + "key": "Khirz6zTPdfd7", + "outputtype": "pdf", + "pdf": { + "form": true + }, + "title": "Example Document Title.docx", + "url": "https://example.com/url-to-example-document.docx" +} +``` + +Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. + +### Sample of JSON object sent to **document conversion service** used to convert the file from *docx* format to *pdf* format with a watermark inserted + +``` json +{ + "async": false, + "filetype": "docx", + "key": "Khirz6zTPdfd7", + "outputtype": "pdf", + "title": "Example Document Title.docx", + "url": "https://example.com/url-to-example-document.docx", + "watermark": { + "align": 1, + "fill": [255, 0, 0], + "height": 100, + "margins": [10, 10, 10, 10], + "paragraphs": [ + { + "align": 2, + "fill": [255, 0, 0], + "linespacing": 1, + "runs": [ + { + "bold": true, + "italic": false, + "fill": [0, 0, 0], + "font-family": "Arial", + "font-size": 40, + "strikeout": false, + "text": "Watermark", + "underline": false + }, + { + "text": "<%br%>" + } + ] + } + ], + "rotate": -45, + "transparent": 0.3, + "type": "rect", + "stroke-width": 1, + "stroke": [0, 0, 255], + "width": 100 + } +} +``` + +Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. + +### Sample of JSON object sent to **document conversion service** used to generate *png* thumbnail of file in *docx* format + +``` json +{ + "filetype": "docx", + "key": "Khirz6zTPdfd7", + "outputtype": "png", + "thumbnail": { + "aspect": 0, + "first": true, + "height": 150, + "width": 100 + }, + "title": "Example Document Title.docx", + "url": "https://example.com/url-to-example-document.docx" +} +``` + +Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. + +### Sample of JSON object sent to **document conversion service** used to convert the *spreadsheet* file to *pdf* format + +``` json +{ + "filetype": "xlsx", + "key": "Khirz6zTPdfd7", + "outputtype": "pdf", + "region": "en-US", + "spreadsheetLayout": { + "ignorePrintArea": true, + "orientation": "portrait", + "fitToWidth": 0, + "fitToHeight": 0, + "scale": 100, + "headings": false, + "gridLines": false, + "pageSize": { + "width": "210mm", + "height": "297mm" + }, + "margins": { + "left": "17.8mm", + "right": "17.8mm", + "top": "19.1mm", + "bottom": "19.1mm" + } + }, + "title": "Example Document Title.docx", + "url": "https://example.com/url-to-example-spreadsheet.xlsx" +} +``` + +Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. + +### Sample of JSON object contains the JSON Web Token sent to **document conversion service** used to convert the file from *docx* format to *pdf* format + +``` json +{ + "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxldHlwZSI6ImRvY3giLCJrZXkiOiJLaGlyejZ6VFBkZmQ3Iiwib3V0cHV0dHlwZSI6InBkZiIsInRpdGxlIjoiRXhhbXBsZSBEb2N1bWVudCBUaXRsZS5kb2N4IiwidXJsIjoiaHR0cDovL2V4YW1wbGUuY29tL3VybC10by1leGFtcGxlLWRvY3VtZW50LmRvY3gifQ.U-YAfuuy7clWjn-xOncfJ-sxVG5DlcYn0AOzJYkoR0M" +} +``` + +Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. diff --git a/site/pages/Docs/Docs API/Additional API/Conversion API/Response/index.md b/site/pages/Docs/Docs API/Additional API/Conversion API/Response/index.md new file mode 100644 index 000000000..7b1bc4a53 --- /dev/null +++ b/site/pages/Docs/Docs API/Additional API/Conversion API/Response/index.md @@ -0,0 +1,120 @@ +--- +order: -3 +--- + +The request result is returned in XML format. To receive a response in JSON format you need to specify the *Accept* header with the **application/json** value in the HTTP request (available from version 4.3). When forming the link to the resulting file, the same server name is used which was made the conversion request to. + +- [endConvert](#endconvert) +- [error](#error) +- [fileType](#filetype) +- [fileUrl](#fileurl) +- [percent](#percent) + +## Response parameters and their description + +### endConvert + +Defines if the conversion is completed or not. + +Type: boolean + +Example: true + +### error + +Defines an error occurred during the conversion. Possible error codes can be found [here](../Error%20codes/index.md). + +Type: integer + +Example: -3 + +### fileType + +Defines an extension of the converted file. + +Type: string + +Example: "docm" + +### fileUrl + +Defines the link to the converted document. This parameter will be received only when the *endConvert* parameter is set to **true**. + +Type: string + +Example: `https://documentserver/url-to-converted-document.pdf` + +### percent + +Defines the percentage of the file conversion. If the *endConvert* parameter is set to **true**, the *percent* is equal to **100**. + +Type: integer + +Example: 100 + +## Examples of responses + +### Sample of the response in XML format + +When forming the link to the resulting file, the same server name is used which was made the conversion request to. + +``` xml + + + True + docm + https://documentserver/url-to-converted-document.pdf + 100 + +``` + +### Sample of the response in JSON format + +When forming the link to the resulting file, the same server name is used which was made the conversion request to. + +``` json +{ + "endConvert": true, + "fileType": "docm", + "fileUrl": "https://documentserver/url-to-converted-document.pdf", + "percent": 100 +} +``` + +### Sample of the intermediate response to the asynchronous request (with the parameter *async=true*) in XML format + +```xml + + + False + + + 95 + +``` + +### Sample of the intermediate response to the asynchronous request (with the parameter *async=true*) in JSON format + +```json +{ + "endConvert": false, + "percent": 95 +} +``` + +### Sample of the response when an error occurred in XML format + +```xml + + + -3 + +``` + +### Sample of the response when an error occurred in JSON format + +``` json +{ + "error": -3 +} +``` diff --git a/site/pages/Docs/Docs API/Additional API/Conversion API/index.md b/site/pages/Docs/Docs API/Additional API/Conversion API/index.md index 51cdc6ded..a733a7fc5 100644 --- a/site/pages/Docs/Docs API/Additional API/Conversion API/index.md +++ b/site/pages/Docs/Docs API/Additional API/Conversion API/index.md @@ -1,919 +1,4 @@ -For the interaction with the **document conversion service** the POST requests are used. The request parameters are entered in JSON format in the request body. The requests are sent to the `https://documentserver/converter` address where **documentserver** is the name of the server with the ONLYOFFICE Docs installed. - -> Please note that prior to version 5.5, the `https://documentserver/ConvertService.ashx` address was used to send requests. - -Starting from version 8.1, it is recommended to add the [shardkey](../../Get%20Started/How%20It%20Works/index.md#shard-key) parameter to the URL *QueryString* with the *key* value in it. For example, *?shardkey=Khirz6zTPdfd7*. This allows you to load balance requests. - -> In **ONLYOFFICE Docs** prior to version 4.2 the GET request with the parameters in the *QueryString* were used. - -## Request parameters and their description - -- [async](#async) -- [codePage](#codepage) -- [delimiter](#delimiter) -- [documentLayout](#documentlayout) -- [documentRenderer](#documentrenderer) -- [filetype](#filetype) -- [key](#key) -- [outputtype](#outputtype) -- [password](#password) -- [pdf](#pdf) -- [region](#region) -- [spreadsheetLayout](#spreadsheetlayout) -- [thumbnail](#thumbnail) -- [title](#title) -- [token](#token) -- [url](#url) -- [watermark](#watermark) - -### async - -Defines the conversion request type: asynchronous or not. - -Supported values: - -- **true** -- **false** - -When the asynchronous request type is used, the response is formed instantly. In this case to get the result it is necessary to send requests without parameter change until the conversion is finished. The default value is **false**. - -Type: boolean - -Presence: optional - -> If the conversion is synchronous and the file takes a long time to be converted, a web request timeout error may occur. Although the conversion can be eventually completed, the result can only be obtained by sending the request again with the same key. - -### codePage - -Defines the file encoding when converting from *csv* or *txt* format. - -Main supported values: - -- **932** - Japanese (Shift-JIS); -- **950** - Chinese Traditional (Big5); -- **1250** - Central European (Windows); -- **1251** - Cyrillic (Windows); -- **65001** - Unicode (UTF-8). - -You can find all the supported values [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). - -Type: integer - -Presence: optional - -### delimiter - -Defines the delimiter characters for separating values when converting from *csv* format. - -Supported values: - -- **0** - no delimiter; -- **1** - tab; -- **2** - semicolon; -- **3** - colon; -- **4** - comma; -- **5** - space. - -Type: integer - -Presence: optional - -### documentLayout - -Defines the document layout which specifies parameters for printing forms as *pdf* documents or images. - -Type: object - -Presence: optional - -#### documentLayout.drawPlaceHolders - -Defines if placeholders will be drawn or not. - -Type: boolean - -Presence: optional - -#### documentLayout.drawFormHighlight - -Defines if forms will be highlighted or not. - -Type: boolean - -Presence: optional - -#### documentLayout.isPrint - -Defines if the print mode is turned on or off. This parameter is used only for converting *docx/docxf* into *pdf*. If this parameter is equal to **true**, the *drawPlaceHolders* and *drawFormHighlight* flags are used as described above. If this parameter is **false**, the *drawFormHighlight* flag does not work and the *drawPlaceHolders* parameter allows saving the forms in the *pdf* format. The default value is **false**. - -Type: boolean - -Presence: optional - -### documentRenderer - -Defines the document renderer when converting from *pdf*, *xps*, *oxps*. - -Type: object - -Presence: optional - -#### documentRenderer.textAssociation - -Defines the rendering mode that can have the following values: - -- **blockChar** - all text is converted by single characters. Each character is in its own frame (like a textbox); -- **blockLine** - all text is converted by separate lines. Each text line is in its own frame. Lines can be combined within the same block; -- **plainLine** - all text is converted as a plain text. But each line is a separate paragraph; -- **plainParagraph** - all text is converted as a plain text. Lines are combined into paragraphs. - -The default value is **plainLine**. - -Type: string - -Presence: optional - -### filetype - -Defines the type of the document file to be converted. - -> In the tables below you can see possibility of conversion your documents into the most known file formats, where the **Input format** column corresponds to the values of the **filetype** parameter and the **Output format** columns correspond to the values of the **outputtype** parameter. - -Type: string - -Presence: required - -### key - -Defines the document identifier used to unambiguously identify the document file. - -Type: string - -Presence: required - -### outputtype - -Defines the resulting converted document type. Starting from version 7.0, file formats can be specified instead of extensions. They are used when we do not know in advance what extension is required: - -- **ooxml** - defines that the file will be converted into *docx*, *docm*, *xlsx*, *xlsm*, *pptx* or *pptm*. For example, when the *doc* file is converted into the OOXML format, the resulting file can be *docx* or *docm* if this file contains macros (the same for *xls* and *ppt*). It is also applied when converting XML files into OOXML formats (*docx*, *xlsx* or *pptx* depending on the content); -- **odf** - defines that the file will be converted into *odt*, *ods* or *odp*. For example, it is used when converting XML files into ODF formats (*odt*, *ods* or *odp* depending on the content). - -> In the tables below you can see possibility of conversion your documents into the most known file formats, where the **Input format** column corresponds to the values of the **filetype** parameter and the **Output format** columns correspond to the values of the **outputtype** parameter. - -Type: string - -Presence: required - -### password - -Defines the password for the document file if it is protected with a password. - -Type: string - -Presence: optional - -### pdf - -Defines settings for converting document files to pdf. - -Type: object - -Presence: optional - -#### pdf.form - -Defines whether the document will be converted to the *pdf* form (**true**) or to a regular *pdf* file (**false**). If this parameter is omitted, the document contents will not be changed. If the document has fields, they will remain in the converted document. If has not, the converted document will not contain them either. For example, you don't need to specify this parameter when converting *docxf* and *oform* formats to *pdf*. They will always be converted to *pdf* forms. - -Type: boolean - -Presence: optional - -### region - -Defines the default display format for currency and date and time when converting from *Spreadsheet format* to *pdf*. Is set using the four letter (**en-US**, **fr-FR**, etc.) language codes. The default value is **en-US**. - -Type: string - -Presence: optional - -### spreadsheetLayout - -Defines settings for converting the spreadsheet to pdf. - -> Please note that the maximum number of pages that can be returned at once after converting a spreadsheet into pdf or image formats is no more than 1500. - -Type: object - -Presence: optional - -#### spreadsheetLayout.fitToHeight - -Sets the height of the converted area, measured in the number of pages. The default value is **0**. - -Type: integer - -Presence: optional - -#### spreadsheetLayout.fitToWidth - -Sets the width of the converted area, measured in the number of pages. The default value is **0**. - -Type: integer - -Presence: optional - -#### spreadsheetLayout.gridLines - -Allows to include grid lines to the output PDF file or not. The default value is **false**. - -Type: boolean - -Presence: optional - -#### spreadsheetLayout.headings - -Allows to include the headings to the output PDF file or not. The default value is **false**. - -Type: boolean - -Presence: optional - -#### spreadsheetLayout.ignorePrintArea - -Determines whether to ignore the print area chosen for the spreadsheet file or not. The default value is **true**. - -Type: boolean - -Presence: optional - -#### spreadsheetLayout.margins - -Sets the margins of the output PDF file. - -Type: object - -Presence: optional - -#### spreadsheetLayout.margins.bottom - -Sets the bottom margin of the output PDF file. The default value is **19.1mm**. - -Type: string - -Presence: optional - -#### spreadsheetLayout.margins.left - -Sets the left margin of the output PDF file. The default value is **17.8mm**. - -Type: string - -Presence: optional - -#### spreadsheetLayout.margins.right - -Sets the right margin of the output PDF file. The default value is **17.8mm**. - -Type: string - -Presence: optional - -#### spreadsheetLayout.margins.top - -Sets the top margin of the output PDF file. The default value is **19.1mm**. - -Type: string - -Presence: optional - -#### spreadsheetLayout.orientation - -Sets the orientation of the output PDF file. May be **landscape**, **portrait**. The default value is **portrait**. - -Type: string - -Presence: optional - -#### spreadsheetLayout.pageSize - -Sets the page size of the output PDF file. - -Type: object - -Presence: optional - -#### spreadsheetLayout.pageSize.height - -Sets the page height of the output PDF file. The default value is **297mm**. - -Type: string - -Presence: optional - -#### spreadsheetLayout.pageSize.width - -Sets the page width of the output PDF file. The default value is **210mm**. - -Type: string - -Presence: optional - -#### spreadsheetLayout.scale - -Allows to set the scale of the output PDF file. The default value is **100**. - -Type: integer - -Presence: optional - -### thumbnail - -Defines the settings for the thumbnail when specifying the image formats (*bmp*, *gif*, *jpg*, *png*) as **outputtype**. - -Type: object - -Presence: optional - -#### thumbnail.aspect - -Defines the mode to fit the image to the height and width specifyed. Supported values: - -- **0** - stretch file to fit height and width; -- **1** - keep the aspect for the image; -- **2** - in this case, the width and height settings are not used. Instead of that, metric sizes of the page are converted into pixels with 96dpi. E.g., the A4 (210x297mm) page will turn out to be a picture with the 794x1123pix dimensions. - -The default value is **2**. - -Type: integer - -Presence: optional - -#### thumbnail.first - -Defines if the thumbnails should be generated for the first page only or for all the document pages. If false, the zip archive containing thumbnails for all the pages will be created. The default value is **true**. - -Type: boolean - -Presence: optional - -#### thumbnail.height - -Defines the thumbnail height in pixels. The default value is **100**. - -Type: integer - -Presence: optional - -#### thumbnail.width - -Defines the thumbnail width in pixels. The default value is **100**. - -Type: integer - -Presence: optional - -### title - -Defines the converted file name. - -Type: string - -Presence: optional - -### token - -Defines the encrypted signature added to the **ONLYOFFICE Docs** config in the form of a [token](../../Additional%20API/Signature/Request/Token%20in%20body/index.md#request-to-convert-the-document). - -Type: string - -Presence: required by configuration - -### url - -Defines the absolute URL to the document to be converted. Be sure to add a [token](../../Get%20Started/How%20It%20Works/Security/index.md) when using local links. Otherwise, an error will occur. - -Type: string - -Presence: required - -### watermark - -Defines a JSON object containing the properties of a watermark which is inserted into the pdf and image files during conversion. - -Type: object - -Presence: optional - -#### watermark.transparent - -Defines the watermark transparency degree. - -Type: float - -Presence: optional - -#### watermark.type - -Defines the shape type which specifies the preset shape geometry for the current watermark. - -Type: string - -Presence: optional - -#### watermark.width - -Defines the watermark width measured in millimeters. - -Type: integer - -Presence: optional - -#### watermark.height - -Defines the watermark height measured in millimeters. - -Type: integer - -Presence: optional - -#### watermark.rotate - -Defines the watermark rotation angle measured in degrees. - -Type: integer - -Presence: optional - -#### watermark.margins - -Defines the text margins measured in millimeters in the watermark shape. - -Type: array of integers - -Presence: optional - -#### watermark.fill - -Defines the watermark fill color in the RGB format, or the URL to image (base64 support: *data:image/png;...*). The empty array \[] means that the watermark has no fill. - -Type: array of integers \| string - -Presence: optional - -#### watermark.stroke-width - -Defines the watermark stroke width measured in millimeters. - -Type: integer - -Presence: optional - -#### watermark.stroke - -Defines the watermark stroke color in the RGB format. The empty array \[] means that the watermark stroke has no fill. - -Type: array of integers - -Presence: optional - -#### watermark.align - -Defines the vertical text align in the watermark shape: **0** - bottom, **1** - center, **4** - top. - -Type: integer - -Presence: optional - -#### watermark.paragraphs - -Defines the array with paragraphs from the current watermark with their properties. - -Type: array of objects - -Presence: optional - -#### watermark.paragraphs.align - -Defines the horizontal text align in the current paragraph: **0** - right, **1** - left, **2** - center, **3** - justify. - -Type: integer - -Presence: optional - -#### watermark.paragraphs.fill - -Defines the paragraph highlight in the RGB format. The empty array \[] means that the paragraph is not highlighted. - -Type: array of integers - -Presence: optional - -#### watermark.paragraphs.linespacing - -Defines the text linespacing in the current paragraph. - -Type: integer - -Presence: optional - -#### watermark.paragraphs.runs - -Defines the array with runs from the current paragraph with their properties. - -Type: array of objects - -Presence: optional - -#### watermark.paragraphs.runs.text - -Defines the run text. - -Type: string - -Presence: optional - -#### watermark.paragraphs.runs.fill - -Defines the text highlight in the RGB format. The empty array \[] means that the text is not highlighted. - -Type: array of integers - -Presence: optional - -#### watermark.paragraphs.runs.font-family - -Defines the text font family. - -Type: string - -Presence: optional - -#### watermark.paragraphs.runs.font-size - -Defines the text font size measured in points (pt). - -Type: string - -Presence: optional - -#### watermark.paragraphs.runs.bold - -Defines if the current text is displayed bold or not. - -Type: boolean - -Presence: optional - -#### watermark.paragraphs.runs.italic - -Defines if the current text is displayed italic or not. - -Type: boolean - -Presence: optional - -#### watermark.paragraphs.runs.strikeout - -Defines if the current text is displayed struck through or not. - -Type: boolean - -Presence: optional - -#### watermark.paragraphs.runs.underline - -Defines if the current text is displayed underlined or not. - -Type: boolean - -Presence: optional - -## Text document file formats - -| | bmp | docm | docx | docxf | dotm | dotx | epub | fb2 | gif | html | jpg | odt | ott | pdf | pdfa | png | rtf | txt | -| ----- | --- | ---- | ---- | ----- | ---- | ---- | ---- | --- | --- | ---- | --- | --- | --- | --- | ---- | --- | --- | --- | -| djvu | + | | | | | | | | + | | + | | | + | + | + | | | -| doc | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| docm | + | | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| docx | + | + | | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| docxf | + | + | + | | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| dot | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| dotm | + | + | + | + | | + | + | + | + | + | + | + | + | + | + | + | + | + | -| dotx | + | + | + | + | + | | + | + | + | + | + | + | + | + | + | + | + | + | -| epub | + | + | + | + | + | + | | + | + | + | + | + | + | + | + | + | + | + | -| fb2 | + | + | + | + | + | + | + | | + | + | + | + | + | + | + | + | + | + | -| fodt | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| htm | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| html | + | + | + | + | + | + | + | + | + | | + | + | + | + | + | + | + | + | -| mht | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| mhtml | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| odt | + | + | + | + | + | + | + | + | + | + | + | | + | + | + | + | + | + | -| ott | + | + | + | + | + | + | + | + | + | + | | + | + | + | + | + | + | + | -| oxps | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| pdf | + | + | + | + | + | + | + | + | + | + | + | + | + | | + | + | + | + | -| rtf | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | | + | -| stw | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| sxw | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| txt | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | | -| wps | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| wpt | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| xml | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| xps | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | - -## Spreadsheet file formats - -| | bmp | csv | gif | jpg | ods | ots | pdf | pdfa | png | xlsm | xlsx | xltm | xltx | -| ---- | --- | --- | --- | --- | --- | --- | --- | ---- | --- | ---- | ---- | ---- | ---- | -| csv | + | | + | + | + | + | + | + | + | + | + | + | + | -| et | + | + | + | + | + | + | + | + | + | + | + | + | + | -| ett | + | + | + | + | + | + | + | + | + | + | + | + | + | -| fods | + | + | + | + | + | + | + | + | + | + | + | + | + | -| ods | + | + | + | + | | + | + | + | + | + | + | + | + | -| ots | + | + | + | + | + | | + | + | + | + | + | + | + | -| sxc | + | + | + | + | + | + | + | + | + | + | + | + | + | -| xls | + | + | + | + | + | + | + | + | + | + | + | + | + | -| xlsb | + | + | + | + | + | + | + | + | + | + | + | + | + | -| xlsm | + | + | + | + | + | + | + | + | + | | + | + | + | -| xlsx | + | + | + | + | + | + | + | + | + | + | | + | + | -| xlt | + | + | + | + | + | + | + | + | + | + | + | + | + | -| xltm | + | + | + | + | + | + | + | + | + | + | + | | + | -| xltx | + | + | + | + | + | + | + | + | + | + | + | + | | -| xml | + | + | + | + | + | + | + | + | + | + | + | + | + | - -## Presentation file formats - -| | bmp | gif | jpg | odp | otp | pdf | pdfa | png | potm | potx | ppsm | ppsx | pptm | pptx | -| ---- | --- | --- | --- | --- | --- | --- | ---- | --- | ---- | ---- | ---- | ---- | ---- | ---- | -| dps | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| dpt | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| fodp | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| odp | + | + | + | | + | + | + | + | + | + | + | + | + | + | -| otp | + | + | + | + | | + | + | + | + | + | + | + | + | + | -| pot | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| potm | + | + | + | + | + | + | + | + | | + | + | + | + | + | -| potx | + | + | + | + | + | + | + | + | + | | + | + | + | + | -| pps | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| ppsm | + | + | + | + | + | + | + | + | + | + | | + | + | + | -| ppsx | + | + | + | + | + | + | + | + | + | + | + | | + | + | -| ppt | + | + | + | + | + | + | + | + | + | + | + | + | + | + | -| pptm | + | + | + | + | + | + | + | + | + | + | + | + | | + | -| pptx | + | + | + | + | + | + | + | + | + | + | + | + | + | | -| sxi | + | + | + | + | + | + | + | + | + | + | + | + | + | + | - -## Examples of requests - -### Sample of JSON object sent to **document conversion service** used to convert the file from *docx* format to *pdf* format - -``` json -{ - "async": false, - "filetype": "docx", - "key": "Khirz6zTPdfd7", - "outputtype": "pdf", - "title": "Example Document Title.docx", - "url": "https://example.com/url-to-example-document.docx" -} -``` - -Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. - -### Sample of JSON object sent to **document conversion service** used to convert the password-protected file from *docx* format to *pdf* format - -``` json -{ - "async": false, - "filetype": "docx", - "key": "Khirz6zTPdfd7", - "outputtype": "pdf", - "password": "123456", - "title": "Example Document Title.docx", - "url": "https://example.com/url-to-example-document.docx" -} -``` - -Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. - -### Sample of JSON object sent to **document conversion service** used to convert the file from *docx* format to *pdf* form - -``` json -{ - "async": false, - "filetype": "docx", - "key": "Khirz6zTPdfd7", - "outputtype": "pdf", - "pdf": { - "form": true - }, - "title": "Example Document Title.docx", - "url": "https://example.com/url-to-example-document.docx" -} -``` - -Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. - -### Sample of JSON object sent to **document conversion service** used to convert the file from *docx* format to *pdf* format with a watermark inserted - -``` json -{ - "async": false, - "filetype": "docx", - "key": "Khirz6zTPdfd7", - "outputtype": "pdf", - "title": "Example Document Title.docx", - "url": "https://example.com/url-to-example-document.docx", - "watermark": { - "align": 1, - "fill": [255, 0, 0], - "height": 100, - "margins": [10, 10, 10, 10], - "paragraphs": [ - { - "align": 2, - "fill": [255, 0, 0], - "linespacing": 1, - "runs": [ - { - "bold": true, - "italic": false, - "fill": [0, 0, 0], - "font-family": "Arial", - "font-size": 40, - "strikeout": false, - "text": "Watermark", - "underline": false - }, - { - "text": "<%br%>" - } - ] - } - ], - "rotate": -45, - "transparent": 0.3, - "type": "rect", - "stroke-width": 1, - "stroke": [0, 0, 255], - "width": 100 - } -} -``` - -Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. - -### Sample of JSON object sent to **document conversion service** used to generate *png* thumbnail of file in *docx* format - -``` json -{ - "filetype": "docx", - "key": "Khirz6zTPdfd7", - "outputtype": "png", - "thumbnail": { - "aspect": 0, - "first": true, - "height": 150, - "width": 100 - }, - "title": "Example Document Title.docx", - "url": "https://example.com/url-to-example-document.docx" -} -``` - -Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. - -### Sample of JSON object sent to **document conversion service** used to convert the *spreadsheet* file to *pdf* format - -``` json -{ - "filetype": "xlsx", - "key": "Khirz6zTPdfd7", - "outputtype": "pdf", - "region": "en-US", - "spreadsheetLayout": { - "ignorePrintArea": true, - "orientation": "portrait", - "fitToWidth": 0, - "fitToHeight": 0, - "scale": 100, - "headings": false, - "gridLines": false, - "pageSize": { - "width": "210mm", - "height": "297mm" - }, - "margins": { - "left": "17.8mm", - "right": "17.8mm", - "top": "19.1mm", - "bottom": "19.1mm" - } - }, - "title": "Example Document Title.docx", - "url": "https://example.com/url-to-example-spreadsheet.xlsx" -} -``` - -Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. - -### Sample of JSON object contains the JSON Web Token sent to **document conversion service** used to convert the file from *docx* format to *pdf* format - -``` json -{ - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxldHlwZSI6ImRvY3giLCJrZXkiOiJLaGlyejZ6VFBkZmQ3Iiwib3V0cHV0dHlwZSI6InBkZiIsInRpdGxlIjoiRXhhbXBsZSBEb2N1bWVudCBUaXRsZS5kb2N4IiwidXJsIjoiaHR0cDovL2V4YW1wbGUuY29tL3VybC10by1leGFtcGxlLWRvY3VtZW50LmRvY3gifQ.U-YAfuuy7clWjn-xOncfJ-sxVG5DlcYn0AOzJYkoR0M" -} -``` - -Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../Get%20Started/How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. - -## Response parameters and their description - -The request result is returned in XML format. To receive a response in JSON format you need to specify the *Accept* header with the **application/json** value in the HTTP request (available from version 4.3). When forming the link to the resulting file, the same server name is used which was made the conversion request to. - -| Parameter | Type | Example | Description | -| ---------- | ------- | ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- | -| endConvert | boolean | true | Defines if the conversion is completed or not. | -| error | integer | -3 | Defines an error occurred during the conversion. Possible error codes can be found [here](#possible-error-codes-and-their-description). | -| fileType | string | "docm" | Defines an extension of the converted file. | -| fileUrl | string | `https://documentserver/url-to-converted-document.pdf` | Defines the link to the converted document. This parameter will be received only when the *endConvert* parameter is set to **true**. | -| percent | integer | 100 | Defines the percentage of the file conversion. If the *endConvert* parameter is set to **true**, the *percent* is equal to **100**. | - -## Examples of responses - -### Sample of the response in XML format - -When forming the link to the resulting file, the same server name is used which was made the conversion request to. - -``` xml - - - True - docm - https://documentserver/url-to-converted-document.pdf - 100 - -``` - -### Sample of the response in JSON format - -When forming the link to the resulting file, the same server name is used which was made the conversion request to. - -``` json -{ - "endConvert": true, - "fileType": "docm", - "fileUrl": "https://documentserver/url-to-converted-document.pdf", - "percent": 100 -} -``` - -### Sample of the intermediate response to the asynchronous request (with the parameter *async=true*) in XML format - -```xml - - - False - - - 95 - -``` - -### Sample of the intermediate response to the asynchronous request (with the parameter *async=true*) in JSON format - -```json -{ - "endConvert": false, - "percent": 95 -} -``` - -### Sample of the response when an error occurred in XML format - -```xml - - - -3 - -``` - -### Sample of the response when an error occurred in JSON format - -``` json -{ - "error": -3 -} -``` - -## Possible error codes and their description - -| Error code | Description | -| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| -1 | Unknown error. | -| -2 | Conversion timeout error. | -| -3 | Conversion error. | -| -4 | Error while downloading the document file to be converted. | -| -5 | Incorrect password. | -| -6 | Error while accessing the conversion result database. | -| -7 | Input error. | -| -8 | Invalid token. | -| -9 | Error when the converter cannot automatically determine the output file format. This error means that the client must explicitly specify in which format the file should be converted (text document or spreadsheet). It is used to convert XML to OOXML in case the XML type is unknown. | -| -10 | Size limit exceeded. | +--- +chapter: + tableOfContents: true +--- diff --git a/site/pages/Docs/Docs API/Additional API/Signature/Request/Token in body/index.md b/site/pages/Docs/Docs API/Additional API/Signature/Request/Token in body/index.md index d91d3eb14..26ac27d18 100644 --- a/site/pages/Docs/Docs API/Additional API/Signature/Request/Token in body/index.md +++ b/site/pages/Docs/Docs API/Additional API/Signature/Request/Token in body/index.md @@ -50,7 +50,7 @@ As you can see there is no need to include the above parameters into the request ### Request to convert the document -Validation is performed for incoming requests with the commands from the **document storage service** to the [document conversion service](../../../Conversion%20API/index.md). +Validation is performed for incoming requests with the commands from the **document storage service** to the [document conversion service](../../../Conversion%20API/Request/index.md). Sample parameters of request to convert the document: diff --git a/site/pages/Docs/Docs API/Additional API/Signature/Request/Token in header/index.md b/site/pages/Docs/Docs API/Additional API/Signature/Request/Token in header/index.md index 0904b4417..50a637c71 100644 --- a/site/pages/Docs/Docs API/Additional API/Signature/Request/Token in header/index.md +++ b/site/pages/Docs/Docs API/Additional API/Signature/Request/Token in header/index.md @@ -37,7 +37,7 @@ Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjp7ImMiO ### Request to convert the document -Validation is performed for incoming requests from the **document storage service** to the [document conversion service](../../../Conversion%20API/index.md). +Validation is performed for incoming requests from the **document storage service** to the [document conversion service](../../../Conversion%20API/Request/index.md). Sample payload of request to convert the document: diff --git a/site/pages/Docs/Docs API/Additional API/Signature/Request/index.md b/site/pages/Docs/Docs API/Additional API/Signature/Request/index.md index a3c39238a..550532eeb 100644 --- a/site/pages/Docs/Docs API/Additional API/Signature/Request/index.md +++ b/site/pages/Docs/Docs API/Additional API/Signature/Request/index.md @@ -50,7 +50,7 @@ As you can see there is no need to include the above parameters into the request ### Request to convert the document -Validation is performed for incoming requests with the commands from the **document storage service** to the [document conversion service](../../Conversion%20API/index.md). +Validation is performed for incoming requests with the commands from the **document storage service** to the [document conversion service](../../Conversion%20API/Request/index.md). Sample parameters of request to convert the document: diff --git a/site/pages/Docs/Docs API/Get Started/Basic concepts/index.md b/site/pages/Docs/Docs API/Get Started/Basic concepts/index.md index d229d1f91..a50e02b90 100644 --- a/site/pages/Docs/Docs API/Get Started/Basic concepts/index.md +++ b/site/pages/Docs/Docs API/Get Started/Basic concepts/index.md @@ -2,57 +2,27 @@ order: -8 --- -[ONLYOFFICE Docs](../Get%20ONLYOFFICE%20Docs/index.md) is an open-source office suite that includes editors for text documents, spreadsheets, presentations and fillable forms. It provides the following features: +[ONLYOFFICE Docs](https://www.onlyoffice.com/download-docs.aspx?from=api#docs-developer) is an open-source office suite that includes editors for text documents, spreadsheets, presentations and fillable forms. -- creating, editing and viewing text documents, spreadsheets, presentations and fillable forms; -- collaborating on files with other teammates in real time. - -ONLYOFFICE Docs also supports the **WOPI protocol** that is used to integrate your application with an online office. Further information about WOPI can be found [here](../../Using%20WOPI/Overview/index.md). - -**ONLYOFFICE Docs API** is used to let the developers integrate the ONLYOFFICE Document/Spreadsheet/Presentation/Pdf Editors into their own web sites and setup and manage the editors. - -The API JavaScript file can normally be found in the following editors folder: - -`https://documentserver/web-apps/apps/api/documents/api.js` +This documentation describes: -Where **documentserver** is the name of the server with the ONLYOFFICE Docs installed. +- How to extend the editors functionality with [plugins](../../Usage%20API/Config/Editor/Plugins/index.md) and [customization settings](../../Usage%20API/Config/Editor/Customization/index.md), or limit it to suit your use-case +- How to manage editors via [Automation API](../../Usage%20API/Automation%20API/index.md) +- How to use the [WOPI protocol](../../Using%20WOPI/Overview/index.md) to integrate your application with an online office +- How to integrate ONLYOFFICE Docs into a range of [frameworks](../Frontend%20Frameworks/index.md) and [Document Management Systems (DMSs)](../Ready-to-use%20connectors/index.md) -Starting from version 8.1, it is recommended to add the [shardkey](../../Get%20Started/How%20It%20Works/index.md#shard-key) parameter to the URL *QueryString* with the *key* value in it. For example, *?shardkey=Khirz6zTPdfd7*. This allows you to load balance requests. +## What editors can do -The target HTML file where the editors are to be embedded need to have a placeholder *div* tag, where all the information about the editor parameters will be passed: +ONLYOFFICE Docs provides the following features: -``` html -
          - -``` - -The page code containing the changeable parameters looks the following way: - -``` ts -const docEditor = new DocsAPI.DocEditor("placeholder", config) -``` - -Where *config* is an object: - -``` 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.ashx", - }, -} -``` +- creating, editing and viewing text documents, spreadsheets, presentations and fillable forms; +- collaborating on files with other teammates in real time. -Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. +ONLYOFFICE Docs API is used to let the developers integrate the ONLYOFFICE Document/Spreadsheet/Presentation/Pdf Editors into their own web sites and setup and manage the editors. ONLYOFFICE Docs can be customized to look and feel like part of your application or webpage by [customizing the user interface](../../Usage%20API/Config/Editor/Customization/index.md). -From now the *docEditor* object can be used to call the **document editor** [Methods](../../Usage%20API/Methods/index.md). +## How to get editors -The example above includes all the parameters necessary for ONLYOFFICE Docs correct startup. There are additional non-obligatory parameters though which can be changed to achieve different goals with your document (change access rights for the document, display different information about the document, etc.). See the [Advanced parameters](../../Usage%20API/Advanced%20parameters/index.md) section to find out what these parameters are and how you can change them. +To get ONLYOFFICE Docs and start using its features: -To prevent the substitution of important parameters, add an encrypted signature to the requests in the form of [token](../../Additional%20API/Signature/index.md). +- load it from the [ONLYOFFICE Docs Cloud CDN](../Installation/Cloud/index.md) (Content Delivery Network), which will ensure ONLYOFFICE Docs is always using the latest version; +- install the [self-hosted](../Installation/Self-hosted/index.md) solution. diff --git a/site/pages/Docs/Docs API/Get Started/Get ONLYOFFICE Docs/index.md b/site/pages/Docs/Docs API/Get Started/Get ONLYOFFICE Docs/index.md deleted file mode 100644 index 626dec40e..000000000 --- a/site/pages/Docs/Docs API/Get Started/Get ONLYOFFICE Docs/index.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -order: -7 ---- - -[ONLYOFFICE Docs](https://www.onlyoffice.com/download-docs.aspx?from=api#docs-developer) is available for Windows, Linux and Docker. - -To install it on your local server, follow the instructions in **ONLYOFFICE Help Center**: - -- [](https://helpcenter.onlyoffice.com/installation/docs-developer-install-windows.aspx?from=api) - - [Get ONLYOFFICE Docs for Windows](https://helpcenter.onlyoffice.com/installation/docs-developer-install-windows.aspx?from=api) - -- [](https://helpcenter.onlyoffice.com/installation/docs-developer-install-ubuntu.aspx?from=api) - - [Get ONLYOFFICE Docs for Linux](https://helpcenter.onlyoffice.com/installation/docs-developer-install-ubuntu.aspx?from=api) - -- [](https://helpcenter.onlyoffice.com/installation/docs-developer-install-docker.aspx?from=api) - - [Get ONLYOFFICE Docs for Docker](https://helpcenter.onlyoffice.com/installation/docs-developer-install-docker.aspx?from=api) - -Before working with ONLYOFFICE Docs API documentation, it is recommended to make the following settings if necessary: - -- configure [ONLYOFFICE Docs server settings](https://helpcenter.onlyoffice.com/installation/docs-developer-configuring.aspx?from=api) in ONLYOFFICE Docs configuration file; -- switch ONLYOFFICE Docs to the HTTPS protocol for secure connection using [SSL Certificates](https://helpcenter.onlyoffice.com/installation/docs-community-https-linux.aspx?from=api); -- add additional [fonts](https://helpcenter.onlyoffice.com/installation/docs-community-install-fonts-linux.aspx?from=api) to ONLYOFFICE Docs to enhance the work with the editors; -- add your own [color themes](https://helpcenter.onlyoffice.com/installation/docs-developer-change-theme.aspx?from=api) for the application interface. - -## Health check - -To check if the editors are available, send the GET request to */healthcheck*. This request checks the availability of the databases, message broker, Redis connection, and storage. - -The response must be **true**, which means that the editors are ready to use. - -If something went wrong, make sure that you have followed the installation instructions above. diff --git a/site/pages/Docs/Docs API/Get Started/How It Works/Saving file/index.md b/site/pages/Docs/Docs API/Get Started/How It Works/Saving file/index.md index df078d3fb..928e16db5 100644 --- a/site/pages/Docs/Docs API/Get Started/How It Works/Saving file/index.md +++ b/site/pages/Docs/Docs API/Get Started/How It Works/Saving file/index.md @@ -129,9 +129,22 @@ Starting from version 7.0, the [assemblyFormatAsOrigin](https://helpcenter.onlyo ### Parameters -| Parameter | Type | Example | Description | -| -------------------------------------------------- | ------- | ------- | ---------------------------------------------------------------------------------------------------- | -| services.CoAuthoring.server.assemblyFormatAsOrigin | boolean | true | Defines if the assembled file is saved in its original format or not. The default value is **true**. | +#### services.CoAuthoring.server.assemblyFormatAsOrigin + +Defines whether the editor will try to save the assembled file in its original format. + +This parameter works as follows: + +1. The editor always returns a file in the OOXML format. +2. If the *assemblyFormatAsOrigin* parameter is set to **true**, the editor tries to convert the file to the original format. +3. If the original format is old (for example, `doc`) and converting back to the old format fails, the *rollback to save changes to ooxml* warning will be thrown, and the file will be converted back to the OOXML format. +4. If the *assemblyFormatAsOrigin* parameter is set to **false**, the editor will not convert the file to the original format and return it in the OOXML format. + +The default value is **true**. + +Type: boolean + +Example: true ### Sample local.json configuration diff --git a/site/pages/Docs/Docs API/Get Started/How It Works/Security/index.md b/site/pages/Docs/Docs API/Get Started/How It Works/Security/index.md index fe6db160f..a3cbf564d 100644 --- a/site/pages/Docs/Docs API/Get Started/How It Works/Security/index.md +++ b/site/pages/Docs/Docs API/Get Started/How It Works/Security/index.md @@ -16,4 +16,4 @@ See the [Signature](../../../Additional%20API/Signature/index.md) configuration > Please note that using the **local links** by the integrator requires the *JWT* in the config. Otherwise, an error will occur. > -> Be sure to add a token when using local links in the following methods: [insertImage](../../../Usage%20API/Methods/index.md#insertimage), [setHistoryData](../../../Usage%20API/Methods/index.md#sethistorydata), [setMailMergeRecipients](../../../Usage%20API/Methods/index.md#setmailmergerecipients), [setReferenceData](../../../Usage%20API/Methods/index.md#setreferencedata), [setReferenceSource](../../../Usage%20API/Methods/index.md#setreferencesource), [setRequestedDocument](../../../Usage%20API/Methods/index.md#setrequesteddocument), [setRequestedSpreadsheet](../../../Usage%20API/Methods/index.md#setrequestedspreadsheet), [setRevisedFile](../../../Usage%20API/Methods/index.md#setrevisedfile). Moreover, it is necessary when defining the local url for [opening](../../../Usage%20API/Config/Document/index.md#url) or [conversion](../../../Additional%20API/Conversion%20API/index.md#url). +> Be sure to add a token when using local links in the following methods: [insertImage](../../../Usage%20API/Methods/index.md#insertimage), [setHistoryData](../../../Usage%20API/Methods/index.md#sethistorydata), [setMailMergeRecipients](../../../Usage%20API/Methods/index.md#setmailmergerecipients), [setReferenceData](../../../Usage%20API/Methods/index.md#setreferencedata), [setReferenceSource](../../../Usage%20API/Methods/index.md#setreferencesource), [setRequestedDocument](../../../Usage%20API/Methods/index.md#setrequesteddocument), [setRequestedSpreadsheet](../../../Usage%20API/Methods/index.md#setrequestedspreadsheet), [setRevisedFile](../../../Usage%20API/Methods/index.md#setrevisedfile). Moreover, it is necessary when defining the local url for [opening](../../../Usage%20API/Config/Document/index.md#url) or [conversion](../../../Additional%20API/Conversion%20API/Request/index.md#url). diff --git a/site/pages/Docs/Docs API/Get Started/Installation/Cloud/index.md b/site/pages/Docs/Docs API/Get Started/Installation/Cloud/index.md new file mode 100644 index 000000000..db90857df --- /dev/null +++ b/site/pages/Docs/Docs API/Get Started/Installation/Cloud/index.md @@ -0,0 +1,60 @@ +--- +order: -2 +--- + +To install ONLYOFFICE Docs in the cloud: + +1. Deploy ONLYOFFICE Docs Developer solution in the cloud using our [instructions](https://helpcenter.onlyoffice.com/installation/docs-developer-index.aspx?from=api) from ONLYOFFICE Help Center. + +2. In the target HTML file where the editors are to be embedded, specify a placeholder *div* tag, where all the information about the editor parameters will be passed: + + ```html +
          + + ``` + + Where **documentserver** is the public IP address or public DNS provided by your cloud. It is automatically allocated by the system and can be found in the **Instances** section of the cloud console. + + `https://documentserver/web-apps/apps/api/documents/api.js` is the address where the API JavaScript file can normally be found. + + Starting from version 8.1, it is recommended to add the [shardkey](../../How%20It%20Works/index.md#shard-key) parameter to the URL *QueryString* with the *key* value in it. For example, *?shardkey=Khirz6zTPdfd7*. This allows you to load balance requests. + +3. Specify the page code containing the changeable parameters: + + ``` ts + const docEditor = new DocsAPI.DocEditor("placeholder", config) + ``` + + Where *config* is an object: + + ``` 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.ashx", + }, + } + ``` + + Where **example.com** is the public IP address or public DNS provided by your cloud where **document manager** and **document storage service** are installed. See the [How it works](../../How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. + + From now the *docEditor* object can be used to call the **document editor** [Methods](../../../Usage%20API/Methods/index.md). + + The example above includes all the parameters necessary for ONLYOFFICE Docs correct startup. + +4. Specify the additional non-obligatory parameters that can be changed to achieve different goals with your document (change access rights for the document, display different information about the document, etc.). See the [Advanced parameters](../../../Usage%20API/Advanced%20parameters/index.md) section to find out what these parameters are and how you can change them. + +5. Add an encrypted signature to the requests in the form of [token](../../../Additional%20API/Signature/index.md) to prevent the substitution of important parameters. + +## Next steps + +- [How to enable document forcesaving](../../How%20It%20Works/Saving%20file/index.md#force-saving) +- [How to customize the editor](../../../Usage%20API/Config/Editor/Customization/index.md) +- [How to manage the editor through Automation API](../../../Usage%20API/Automation%20API/index.md) +- [How to install / disable plugins](../../../Usage%20API/Config/Editor/Plugins/index.md) diff --git a/site/pages/Docs/Docs API/Get Started/Installation/Self-hosted/index.md b/site/pages/Docs/Docs API/Get Started/Installation/Self-hosted/index.md new file mode 100644 index 000000000..c14b6398e --- /dev/null +++ b/site/pages/Docs/Docs API/Get Started/Installation/Self-hosted/index.md @@ -0,0 +1,84 @@ +--- +order: -1 +--- + +ONLYOFFICE Docs is available for Windows, Linux and Docker. + +To install it on your local server: + +1. [Download](https://www.onlyoffice.com/download-docs.aspx?from=api#docs-developer) ONLYOFFICE Docs Developer solution and install it on your local server following the instructions in ONLYOFFICE Help Center: + + - [Install ONLYOFFICE Docs for Windows](https://helpcenter.onlyoffice.com/installation/docs-developer-install-windows.aspx?from=api) + - [Install ONLYOFFICE Docs for Linux](https://helpcenter.onlyoffice.com/installation/docs-developer-install-ubuntu.aspx?from=api) + - [Install ONLYOFFICE Docs for Docker](https://helpcenter.onlyoffice.com/installation/docs-developer-install-docker.aspx?from=api) + +2. In the target HTML file where the editors are to be embedded, specify a placeholder *div* tag, where all the information about the editor parameters will be passed: + + ```html +
          + + ``` + + Where **documentserver** is the name of the server with the ONLYOFFICE Docs installed. In this case, this is an address of you local server (`http://localhost`). + + `https://documentserver/web-apps/apps/api/documents/api.js` is the address where the API JavaScript file can normally be found. + + Starting from version 8.1, it is recommended to add the [shardkey](../../How%20It%20Works/index.md#shard-key) parameter to the URL *QueryString* with the *key* value in it. For example, *?shardkey=Khirz6zTPdfd7*. This allows you to load balance requests. + +3. Specify the page code containing the changeable parameters: + + ``` ts + const docEditor = new DocsAPI.DocEditor("placeholder", config) + ``` + + Where *config* is an object: + + ``` 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.ashx", + }, + } + ``` + + Where **example.com** is the name of the server where **document manager** and **document storage service** are installed. See the [How it works](../../How%20It%20Works/index.md) section to find out more on ONLYOFFICE Docs service client-server interactions. + + From now the *docEditor* object can be used to call the **document editor** [Methods](../../../Usage%20API/Methods/index.md). + + The example above includes all the parameters necessary for ONLYOFFICE Docs correct startup. + +4. Specify the additional non-obligatory parameters that can be changed to achieve different goals with your document (change access rights for the document, display different information about the document, etc.). See the [Advanced parameters](../../../Usage%20API/Advanced%20parameters/index.md) section to find out what these parameters are and how you can change them. + +5. Add an encrypted signature to the requests in the form of [token](../../../Additional%20API/Signature/index.md) to prevent the substitution of important parameters. + +## Before you start + +Before working with ONLYOFFICE Docs API documentation, it is recommended to make the following settings if necessary: + +- open additional [ports](https://helpcenter.onlyoffice.com/installation/docs-developer-open-ports.aspx?from=api); +- configure [ONLYOFFICE Docs server settings](https://helpcenter.onlyoffice.com/installation/docs-developer-configuring.aspx?from=api) in ONLYOFFICE Docs configuration file; +- switch ONLYOFFICE Docs to the HTTPS protocol for secure connection using [SSL Certificates](https://helpcenter.onlyoffice.com/installation/docs-community-https-linux.aspx?from=api); +- add additional [fonts](https://helpcenter.onlyoffice.com/installation/docs-community-install-fonts-linux.aspx?from=api) to ONLYOFFICE Docs to enhance the work with the editors; +- add your own [color themes](https://helpcenter.onlyoffice.com/installation/docs-developer-change-theme.aspx?from=api) for the application interface. + +## Health check + +To check if the editors are available, send the GET request to */healthcheck*. This request checks the availability of the databases, message broker, Redis connection, and storage. + +The response must be **true**, which means that the editors are ready to use. + +If something went wrong, make sure that you have followed the installation instructions above. + +## Next steps + +- [How to enable document forcesaving](../../How%20It%20Works/Saving%20file/index.md#force-saving) +- [How to customize the editor](../../../Usage%20API/Config/Editor/Customization/index.md) +- [How to manage the editor through Automation API](../../../Usage%20API/Automation%20API/index.md) +- [How to install / disable plugins](../../../Usage%20API/Config/Editor/Plugins/index.md) diff --git a/site/pages/Docs/Docs API/Get Started/Installation/index.md b/site/pages/Docs/Docs API/Get Started/Installation/index.md new file mode 100644 index 000000000..0cb782395 --- /dev/null +++ b/site/pages/Docs/Docs API/Get Started/Installation/index.md @@ -0,0 +1,8 @@ +--- +order: -7 +--- + +Learn how to install ONLYOFFICE Docs Developer Edition: + +- [Cloud solution](Cloud/index.md) +- [Self-hosted solution](Self-hosted/index.md) diff --git a/site/pages/Docs/Docs API/More Information/Changelog/index.md b/site/pages/Docs/Docs API/More Information/Changelog/index.md index 082c40eb8..38eb04b81 100644 --- a/site/pages/Docs/Docs API/More Information/Changelog/index.md +++ b/site/pages/Docs/Docs API/More Information/Changelog/index.md @@ -2,16 +2,17 @@ The list of changes of ONLYOFFICE Docs API. ## Version 8.2 +- The [editorConfig.customization.mobileForceView](../../Usage%20API/Config/Editor/Customization/index.md#mobileforceview) parameter is deprecated, please use the [editorConfig.customization.mobile](../../Usage%20API/Config/Editor/Customization/index.md#mobile) parameter instead. - Added the *Password* and *PasswordToOpen* request parameters to the [WOPI conversion API](../../Using%20WOPI/Conversion%20API/index.md). - The [editorConfig.region](../../Usage%20API/Config/Editor/index.md#region) field is now used to define the default measurement units in all editor types. -- The [editorConfig.location](../../Usage%20API/Config/Editor/index.md#location) field is deprecated, please use the [editorConfig.region](../../Usage%20API/Config/Editor/index.md#region) field instead. -- Added the *insert-text* type of document selection to the *c* parameter of the [setRequestedDocument](../../Usage%20API/Methods/index.md#setrequesteddocument) method. +- The [editorConfig.location](../../Usage%20API/Config/Editor/index.md#location) field is deprecated, please use the [editorConfig.region](../../Usage%20API/Config/Editor/index.md#region) field instead. +- Added the *insert-text* type of document selection to the *c* parameter of the [setRequestedDocument](../../Usage%20API/Methods/index.md#setrequesteddocument) method. - The `https://documentserver/coauthoring/CommandService.ashx` address of the [command service](../../Additional%20API/Command%20service/index.md) is replaced with `https://documentserver/command`. - Added the *users* parameter to the response of the [info](../../Additional%20API/Command%20service/info/index.md) command. - Added the [tabBackground](../../Usage%20API/Config/Editor/Customization/index.md#featurestabbackground) field to the *editorConfig.customization.features* parameter. - Added the [tabStyle](../../Usage%20API/Config/Editor/Customization/index.md#featurestabstyle) field to the *editorConfig.customization.features* parameter. - Added the [imageLight](../../Usage%20API/Config/Editor/Customization/index.md#logoimagelight) field to the *editorConfig.customization.logo* parameter. -- The [editorConfig.customization.toolbarNoTabs](../../Usage%20API/Config/Editor/Customization/index.md#toolbarnotabs) field is deprecated, please use the [editorConfig.customization.features.tabStyle](../../Usage%20API/Config/Editor/Customization/index.md#featurestabstyle) and [editorConfig.customization.features.tabBackground](../../Usage%20API/Config/Editor/Customization/index.md#featurestabbackground) fields instead. +- The [editorConfig.customization.toolbarNoTabs](../../Usage%20API/Config/Editor/Customization/index.md#toolbarnotabs) field is deprecated, please use the [editorConfig.customization.features.tabStyle](../../Usage%20API/Config/Editor/Customization/index.md#featurestabstyle) and [editorConfig.customization.features.tabBackground](../../Usage%20API/Config/Editor/Customization/index.md#featurestabbackground) fields instead. ## Version 8.1 @@ -20,14 +21,14 @@ The list of changes of ONLYOFFICE Docs API. - Added the [startFilling](../../Usage%20API/Methods/index.md#startfilling) method. - Added the [events.onRequestStartFilling](../../Usage%20API/Config/Events/index.md#onrequeststartfilling) event. - Added the [docs\_api\_config](../../Using%20WOPI/Host%20page/index.md#parameters) parameter to the *form* element of the WOPI host page. -- Added the [pdf](../../Additional%20API/Conversion%20API/index.md#pdf) field to the conversion request. +- Added the [pdf](../../Additional%20API/Conversion%20API/Request/index.md#pdf) field to the conversion request. - Added the [events.onSubmit](../../Usage%20API/Config/Events/index.md#onsubmit) event. - The *docxf* format is deprecated, please use the *pdf* format to create and edit forms. - Changed the [documentType](../../Usage%20API/Config/index.md#documenttype) of the *docxf* and *oform* formats to *pdf*. - Added the *roles* field to the [editorConfig.customization.features](../../Usage%20API/Config/Editor/Customization/index.md#features) parameter. - Added the [shardkey](../../Get%20Started/How%20It%20Works/index.md#shard-key) parameter to the URL query string when sending requests to the ONLYOFFICE Docs API, document command service, document conversion service, or document builder service. - Added the [addContextMenuItem](../../Usage%20API/Automation%20API/index.md#addcontextmenuitem), [addToolbarMenuItem](../../Usage%20API/Automation%20API/index.md#addtoolbarmenuitem) and [updateContextMenuItem](../../Usage%20API/Automation%20API/index.md#updatecontextmenuitem) methods to the *Automation API*. -- Added the [-10 error code](../../Additional%20API/Conversion%20API/index.md#possible-error-codes-and-their-description) to the Conversion API. +- Added the [-10 error code](../../Additional%20API/Conversion%20API/Error%20codes/index.md) to the Conversion API. - The [editorConfig.customization.logo](../../Usage%20API/Config/Editor/Customization/index.md#logo) parameter is now available for the mobile editors. - Added the *visible* field to the [editorConfig.customization.logo](../../Usage%20API/Config/Editor/Customization/index.md#logo) parameter. - Added the [formsubmit](../../Using%20WOPI/WOPI%20discovery/index.md#wopi-actions) action to the WOPI discovery. @@ -38,7 +39,7 @@ The list of changes of ONLYOFFICE Docs API. ## Version 8.0 - Added the [WOPISrc](../../Using%20WOPI/Overview/index.md#wopisrc) query parameter to the requests from the browser to the server. -- Added the [watermark](../../Additional%20API/Conversion%20API/index.md#watermark) field to the conversion request. +- Added the [watermark](../../Additional%20API/Conversion%20API/Request/index.md#watermark) field to the conversion request. - Added the *pdf* document type to the [documentType](../../Usage%20API/Config/index.md#documenttype) parameter. - Added the [formsdataurl](../../Usage%20API/Callback%20handler/index.md#formsdataurl) parameter to the *Callback handler*. - Added the *data.id* parameter to the [events.onRequestUsers](../../Usage%20API/Config/Events/index.md#onrequestusers) event. @@ -56,7 +57,7 @@ The list of changes of ONLYOFFICE Docs API. - The [setMailMergeRecipients](../../Usage%20API/Methods/index.md#setmailmergerecipients) method is deprecated, please use the [setRequestedSpreadsheet](../../Usage%20API/Methods/index.md#setrequestedspreadsheet) method instead. - Added the [setReferenceSource](../../Usage%20API/Methods/index.md#setreferencesource) method. - Added the [events.onRequestReferenceSource](../../Usage%20API/Config/Events/index.md#onrequestreferencesource) event. -- Added the [-9 error code](../../Additional%20API/Conversion%20API/index.md#possible-error-codes-and-their-description) to the Conversion API. +- Added the [-9 error code](../../Additional%20API/Conversion%20API/Error%20codes/index.md) to the Conversion API. - Added the *key* field to the [document.referenceData](../../Usage%20API/Config/Document/index.md#referencedata) parameter. - The [events.onRequestCompareFile](../../Usage%20API/Config/Events/index.md#onrequestcomparefile) event is deprecated, please use the [events.onRequestSelectDocument](../../Usage%20API/Config/Events/index.md#onrequestselectdocument) event instead. - The [setRevisedFile](../../Usage%20API/Methods/index.md#setrevisedfile) method is deprecated, please use the [setRequestedDocument](../../Usage%20API/Methods/index.md#setrequesteddocument) method instead. @@ -65,6 +66,7 @@ The list of changes of ONLYOFFICE Docs API. ## Version 7.4 +- Added the [mobileView](../../Using%20WOPI/WOPI%20discovery/index.md#wopi-actions) actions to the WOPI discovery. - Added opening for [dps, dpt, et, ett, mhtml, stw, sxc, sxi, sxw, wps, wpt](../../Usage%20API/Config/index.md#documenttype) formats. - Added the *users.id* field to the [setUsers](../../Usage%20API/Methods/index.md#setusers) method. - Added the *c* parameter to the [setUsers](../../Usage%20API/Methods/index.md#setusers) method and [events.onRequestUsers](../../Usage%20API/Config/Events/index.md#onrequestusers) event. @@ -96,22 +98,22 @@ The list of changes of ONLYOFFICE Docs API. - The *services.CoAuthoring.token.inbox.inBody* and *services.CoAuthoring.token.outbox.inBody* parameters for enabling [token in body](../../Additional%20API/Signature/Request/Token%20in%20body/index.md) are deprecated. - Added the *X-LOOL-WOPI-IsModifiedByUser*, *X-LOOL-WOPI-IsAutosave* and *X-LOOL-WOPI-IsExitSave* request headers to the [PutFile](../../Using%20WOPI/WOPI%20REST%20API/PutFile/index.md) WOPI operation to distinguish between the type of document saving. - The [editorConfig.customization.chat](../../Usage%20API/Config/Editor/Customization/index.md#chat) parameter is deprecated, please use the [document.permissions.chat](../../Usage%20API/Config/Document/Permissions/index.md#chat) parameter instead. -- Added conversion from [dps, dpt, et, ett, htm, mhtml, stw, sxc, sxi, sxw, wps, wpt, xlsb, xml](../../Additional%20API/Conversion%20API/index.md#text-document-file-formats) format. +- Added conversion from [dps, dpt, et, ett, htm, mhtml, stw, sxc, sxi, sxw, wps, wpt, xlsb, xml](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md) format. - Added opening for [xlsb](../../Usage%20API/Config/index.md#documenttype) format. - The parameter list in the initialization config [signature](../../Additional%20API/Signature/Browser/index.md#opening-file) has become strictly regulated. - The [editorConfig.customization.spellcheck](../../Usage%20API/Config/Editor/Customization/index.md#spellcheck) field is deprecated, please use the [editorConfig.customization.features.spellcheck](../../Usage%20API/Config/Editor/Customization/index.md#features) field instead. - Added the [editorConfig.customization.features](../../Usage%20API/Config/Editor/Customization/index.md#features) parameter section. -- Added the [documentLayout](../../Additional%20API/Conversion%20API/index.md#documentlayout) parameter to the conversion request. -- Added the [documentRenderer](../../Additional%20API/Conversion%20API/index.md#documentrenderer) parameter to the conversion request. -- Added conversion from [pdf/xps/oxps](../../Additional%20API/Conversion%20API/index.md#text-document-file-formats) formats to *docx*. +- Added the [documentLayout](../../Additional%20API/Conversion%20API/Request/index.md#documentlayout) parameter to the conversion request. +- Added the [documentRenderer](../../Additional%20API/Conversion%20API/Request/index.md#documentrenderer) parameter to the conversion request. +- Added conversion from [pdf/xps/oxps](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md#text-document-file-formats) formats to *docx*. - Added the [document.permissions.userInfoGroups](../../Usage%20API/Config/Document/Permissions/index.md#userinfogroups) parameter. -- Added conversion from [djvu](../../Additional%20API/Conversion%20API/index.md#text-document-file-formats) format to *pdf*. -- Added conversion to [ppsm, ppsx](../../Additional%20API/Conversion%20API/index.md#presentation-file-formats) formats. +- Added conversion from [djvu](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md#text-document-file-formats) format to *pdf*. +- Added conversion to [ppsm, ppsx](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md#presentation-file-formats) formats. ## Version 7.0 - Added the *.docxf* and *.oform* [document formats](../../Usage%20API/Config/index.md#documenttype). -- Added conversion to and from [docxf](../../Additional%20API/Conversion%20API/index.md#text-document-file-formats) format. +- Added conversion to and from [docxf](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md#text-document-file-formats) format. - The [callbackUrl](../../Usage%20API/Callback%20handler/index.md) is used from the last tab of the same user. - Added the *logoDark* field to the [editorConfig.customization.customer](../../Usage%20API/Config/Editor/Customization/index.md#customer) parameter. - Added the *imageDark* field to the [editorConfig.customization.logo](../../Usage%20API/Config/Editor/Customization/index.md#logo) parameter. @@ -121,11 +123,11 @@ The list of changes of ONLYOFFICE Docs API. - Added the *fileType* parameter to the [onDownloadAs](../../Usage%20API/Config/Events/index.md#ondownloadas), [onRequestRestore](../../Usage%20API/Config/Events/index.md#onrequestrestore) and [onRequestSaveAs](../../Usage%20API/Config/Events/index.md#onrequestsaveas) events. - Added the possibility to insert several images via the [insertImage](../../Usage%20API/Methods/index.md#insertimage) method. - The [assemblyFormatAsOrigin](../../Get%20Started/How%20It%20Works/Saving%20file/index.md#saving-in-original-format) server setting is enabled by default. -- Added the *ooxml* and *odf* values to the [outputtype](../../Additional%20API/Conversion%20API/index.md#outputtype) parameter of the conversion request. +- Added the *ooxml* and *odf* values to the [outputtype](../../Additional%20API/Conversion%20API/Request/index.md#outputtype) parameter of the conversion request. - Added the *fileType* and *previous.fileType* parameters to the [setHistoryData](../../Usage%20API/Methods/index.md#sethistorydata) method. - Added the [filetype](../../Usage%20API/Callback%20handler/index.md#filetype) parameter to the *Callback handler*. -- Added the [fileType](../../Additional%20API/Conversion%20API/index.md#filetype) field to the conversion response. -- Added conversion to [docm, dotm, xlsm, xltm, pptm, potm](../../Additional%20API/Conversion%20API/index.md#text-document-file-formats) formats. +- Added the [fileType](../../Additional%20API/Conversion%20API/Response/index.md#filetype) field to the conversion response. +- Added conversion to [docm, dotm, xlsm, xltm, pptm, potm](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md) formats. - The [editorConfig.customization.reviewDisplay](../../Usage%20API/Config/Editor/Customization/index.md#reviewdisplay), [editorConfig.customization.showReviewChanges](../../Usage%20API/Config/Editor/Customization/index.md#showreviewchanges), [editorConfig.customization.trackChanges](../../Usage%20API/Config/Editor/Customization/index.md#trackchanges) parameters are deprecated, please use the [editorConfig.customization.review](../../Usage%20API/Config/Editor/Customization/index.md#review) parameter instead. - Added the [editorConfig.customization.review.hideReviewDisplay](../../Usage%20API/Config/Editor/Customization/index.md#review) field. - Added the [editorConfig.customization.review.hoverMode](../../Usage%20API/Config/Editor/Customization/index.md#review) field. @@ -156,8 +158,8 @@ The list of changes of ONLYOFFICE Docs API. - Added the *data.favorite* parameter to the [events.onMetaChange](../../Usage%20API/Config/Events/index.md#onmetachange) event. - Added the [document.info.favorite](../../Usage%20API/Config/Document/Info/index.md#favorite) field. - Added the [document.permissions.reviewGroups](../../Usage%20API/Config/Document/Permissions/index.md#reviewgroups) field. -- Added conversion to [epub, fb2, html](../../Additional%20API/Conversion%20API/index.md#text-document-file-formats) formats. -- Added conversion from [xml](../../Additional%20API/Conversion%20API/index.md#text-document-file-formats) format. +- Added conversion to [epub, fb2, html](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md#text-document-file-formats) formats. +- Added conversion from [xml](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md#text-document-file-formats) format. ## Version 6.2 @@ -171,7 +173,7 @@ The list of changes of ONLYOFFICE Docs API. - The *text*, *spreadsheet* and *presentation* values for [documentType](../../Usage%20API/Config/index.md#documenttype) parameter is deprecated, please use *word*, *cell* and *slide* values instead. - Added the *group* field to the [editorConfig.user](../../Usage%20API/Config/Editor/index.md#user). -- Added conversion from [fb2](../../Additional%20API/Conversion%20API/index.md#text-document-file-formats) format. +- Added conversion from [fb2](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md#text-document-file-formats) format. ## Version 6.0 @@ -186,9 +188,9 @@ The list of changes of ONLYOFFICE Docs API. ## Version 5.5 -- The `https://documentserver/ConvertService.ashx` address of the [conversion service](../../Additional%20API/Conversion%20API/index.md) is replaced with `https://documentserver/converter`. +- The `https://documentserver/ConvertService.ashx` address of the [conversion service](../../Additional%20API/Conversion%20API/Request/index.md) is replaced with `https://documentserver/converter`. - Added the [editorConfig.customization.spellcheck](../../Usage%20API/Config/Editor/Customization/index.md#spellcheck) field. -- Added conversion to [pdfa](../../Additional%20API/Conversion%20API/index.md#text-document-file-formats) format. +- Added conversion to [pdfa](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md#text-document-file-formats) format. - Added the [events.onRequestCompareFile](../../Usage%20API/Config/Events/index.md#onrequestcomparefile) event. - Added the [setRevisedFile](../../Usage%20API/Methods/index.md#setrevisedfile) method. - Token in [methods](../../Additional%20API/Signature/Browser/index.md#methods) parameters. @@ -196,9 +198,9 @@ The list of changes of ONLYOFFICE Docs API. - Added the [editorConfig.customization.goback.requestClose](../../Usage%20API/Config/Editor/Customization/index.md#goback) field. - Added the [events.onRequestSharingSettings](../../Usage%20API/Config/Events/index.md#onrequestsharingsettings) event. - Added the [editorConfig.customization.unit](../../Usage%20API/Config/Editor/Customization/index.md#unit) field. -- Added the [region](../../Additional%20API/Conversion%20API/index.md#region) field. -- Added the [spreadsheetLayout](../../Additional%20API/Conversion%20API/index.md#spreadsheetlayout) field. -- Added [input error](../../Additional%20API/Conversion%20API/index.md#possible-error-codes-and-their-description) for conversion. +- Added the [region](../../Additional%20API/Conversion%20API/Request/index.md#region) field. +- Added the [spreadsheetLayout](../../Additional%20API/Conversion%20API/Request/index.md#spreadsheetlayout) field. +- Added [input error](../../Additional%20API/Conversion%20API/Error%20codes/index.md) for conversion. - The [events.onRequestSendNotify](../../Usage%20API/Config/Events/index.md#onrequestsendnotify) event and the [events.onRequestUsers](../../Usage%20API/Config/Events/index.md#onrequestusers) event can be set independently. - Added the [editorConfig.customization.mentionShare](../../Usage%20API/Config/Editor/Customization/index.md#mentionshare) field. - The *callbackUrl* is selected based on [status](../../Usage%20API/Callback%20handler/index.md). @@ -223,13 +225,13 @@ The list of changes of ONLYOFFICE Docs API. ## Version 5.3 -- Added [conversion](../../Additional%20API/Conversion%20API/index.md#text-document-file-formats) to the OOXML (dotx, xltx, potx) and ODF (ott, ots, otp) templates. +- Added [conversion](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md) to the OOXML (dotx, xltx, potx) and ODF (ott, ots, otp) templates. - Added the [editorConfig.customization.reviewDisplay](../../Usage%20API/Config/Editor/Customization/index.md#reviewdisplay) field. - The [editorConfig.customization.commentAuthorOnly](../../Usage%20API/Config/Editor/Customization/index.md#commentauthoronly) field is now used to restrict comment deletion as well. - Added the [editorConfig.customization.compactHeader](../../Usage%20API/Config/Editor/Customization/index.md#compactheader) field. - Added the [editorConfig.customization.hideRightMenu](../../Usage%20API/Config/Editor/Customization/index.md#hiderightmenu) field. - Added the [editorConfig.customization.toolbarNoTabs](../../Usage%20API/Config/Editor/Customization/index.md#toolbarnotabs) field. -- Added [conversion error](../../Additional%20API/Conversion%20API/index.md#possible-error-codes-and-their-description) for password protected documents. +- Added [conversion error](../../Additional%20API/Conversion%20API/Error%20codes/index.md) for password protected documents. - Added the [editorConfig.actionLink](../../Usage%20API/Config/Editor/index.md#actionlink) field. - Added the [setActionLink](../../Usage%20API/Methods/index.md#setactionlink) method. - Added the [events.onMakeActionLink](../../Usage%20API/Config/Events/index.md#onmakeactionlink) event. @@ -241,20 +243,20 @@ The list of changes of ONLYOFFICE Docs API. - Added the [document.permissions.fillForms](../../Usage%20API/Config/Document/Permissions/index.md#fillforms) field. - Added the [editorConfig.customization.help](../../Usage%20API/Config/Editor/Customization/index.md#help) field. - Added the possibility to make the [editorConfig.customization.logo](../../Usage%20API/Config/Editor/Customization/index.md#logo) not clickable. -- Added for the [aspect](../../Additional%20API/Conversion%20API/index.md#thumbnailaspect) field value *2* for the conversion. +- Added for the [aspect](../../Additional%20API/Conversion%20API/Request/index.md#thumbnailaspect) field value *2* for the conversion. ## Version 5.1 - Added the *format* parameter to the [downloadAs](../../Usage%20API/Methods/index.md#downloadas) method. - Added the [document.permissions.modifyContentControl](../../Usage%20API/Config/Document/Permissions/index.md#modifycontentcontrol) field. -- Added conversion for [OpenDocument Template](../../Additional%20API/Conversion%20API/index.md#text-document-file-formats) formats. +- Added conversion for [OpenDocument Template](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md) formats. - Added the [events.onRequestClose](../../Usage%20API/Config/Events/index.md#onrequestclose) event. - Added the [editorConfig.customization.goback.blank](../../Usage%20API/Config/Editor/Customization/index.md#goback) field. ## Version 5.0 - Added the [document.permissions.modifyFilter](../../Usage%20API/Config/Document/Permissions/index.md#modifyfilter) field. -- Added conversion for macro-enabled document, document template and flat document [formats](../../Additional%20API/Conversion%20API/index.md#text-document-file-formats). +- Added conversion for macro-enabled document, document template and flat document [formats](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md). - The [events.onReady](../../Usage%20API/Config/Events/index.md#onready) event is deprecated, please use the [events.onAppReady](../../Usage%20API/Config/Events/index.md#onappready) events instead. - Added the [events.onDocumentReady](../../Usage%20API/Config/Events/index.md#ondocumentready) event. - Added the [editorConfig.plugins.autostart](../../Usage%20API/Config/Editor/Plugins/index.md#autostart) field. @@ -264,7 +266,7 @@ The list of changes of ONLYOFFICE Docs API. ## Version 4.4 - Changed the [showMessage](../../Usage%20API/Methods/index.md#showmessage) method. -- Added conversion to [odp](../../Additional%20API/Conversion%20API/index.md#presentation-file-formats) format. +- Added conversion to [odp](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md#presentation-file-formats) format. - Added the [document.permissions.comment](../../Usage%20API/Config/Document/Permissions/index.md#comment) field. - Added the [document.permissions.changeHistory](../../Usage%20API/Config/Document/Permissions/index.md#changehistory) field. - Added the [events.onRequestRestore](../../Usage%20API/Config/Events/index.md#onrequestrestore) event. @@ -283,7 +285,7 @@ The list of changes of ONLYOFFICE Docs API. - Added the [editorConfig.customization.forcesave](../../Usage%20API/Config/Editor/Customization/index.md#forcesave) field. - Added the [editorConfig.customization.showReviewChanges](../../Usage%20API/Config/Editor/Customization/index.md#showreviewchanges) field. - Added the [forcesavetype](../../Usage%20API/Callback%20handler/index.md#forcesavetype) field in the callback handler request when force saving the file. -- Added the [JSON format for response](../../Additional%20API/Conversion%20API/index.md#response-parameters-and-their-description) from document conversion service. +- Added the [JSON format for response](../../Additional%20API/Conversion%20API/Response/index.md) from document conversion service. ## Version 4.2 @@ -294,7 +296,7 @@ The list of changes of ONLYOFFICE Docs API. - Added the [editorConfig.customization.autosave](../../Usage%20API/Config/Editor/Customization/index.md#autosave) field. - The [changeshistory](../../Usage%20API/Callback%20handler/index.md#changeshistory) field is removed, please use the [history](../../Usage%20API/Callback%20handler/index.md#history) field instead. - Changed the [setHistoryData](../../Usage%20API/Methods/index.md#sethistorydata) method. -- Added the possibility to convert files to [thumbnail](../../Additional%20API/Conversion%20API/index.md#sample-of-json-object-sent-to-document-conversion-service-used-to-generate-png-thumbnail-of-file-in-docx-format) in the [document conversion service](../../Additional%20API/Conversion%20API/index.md). -- The POST requests are now used for the interaction with the [document command service](../../Additional%20API/Command%20service/index.md) and the [document conversion service](../../Additional%20API/Conversion%20API/index.md). +- Added the possibility to convert files to [thumbnail](../../Additional%20API/Conversion%20API/Request/index.md#sample-of-json-object-sent-to-document-conversion-service-used-to-generate-png-thumbnail-of-file-in-docx-format) in the [document conversion service](../../Additional%20API/Conversion%20API/Request/index.md). +- The POST requests are now used for the interaction with the [document command service](../../Additional%20API/Command%20service/index.md) and the [document conversion service](../../Additional%20API/Conversion%20API/Request/index.md). - Added the [version](../../Additional%20API/Command%20service/version/index.md) command. - Added the [signature](../../Additional%20API/Signature/index.md) for the editor opening and for the incoming and outgoing requests. diff --git a/site/pages/Docs/Docs API/More Information/FAQ/Saving/index.md b/site/pages/Docs/Docs API/More Information/FAQ/Saving/index.md index a7c746b62..a9cd73f11 100644 --- a/site/pages/Docs/Docs API/More Information/FAQ/Saving/index.md +++ b/site/pages/Docs/Docs API/More Information/FAQ/Saving/index.md @@ -116,4 +116,4 @@ For this purpose the POST request with the parameters set in the request body is } ``` -Further information about using the codepage during conversion can be found [at this page](../../../Additional%20API/Conversion%20API/index.md#codepage). +Further information about using the codepage during conversion can be found [at this page](../../../Additional%20API/Conversion%20API/Request/index.md#codepage). diff --git a/site/pages/Docs/Docs API/Usage API/Advanced parameters/index.md b/site/pages/Docs/Docs API/Usage API/Advanced parameters/index.md index 5ee837ceb..2a9e7db72 100644 --- a/site/pages/Docs/Docs API/Usage API/Advanced parameters/index.md +++ b/site/pages/Docs/Docs API/Usage API/Advanced parameters/index.md @@ -194,7 +194,10 @@ const config = { macros: true, macrosMode: "warn", mentionShare: true, - mobileForceView: true, + mobile: { + forceView: true, + standardView: false, + }, plugins: true, review: { hideReviewDisplay: false, diff --git a/site/pages/Docs/Docs API/Usage API/Automation API/index.md b/site/pages/Docs/Docs API/Usage API/Automation API/index.md index e57caf439..4a3fedc72 100644 --- a/site/pages/Docs/Docs API/Usage API/Automation API/index.md +++ b/site/pages/Docs/Docs API/Usage API/Automation API/index.md @@ -144,7 +144,7 @@ connector.addToolbarMenuItem({ ## attachEvent -The function called to add an event listener, a function that will be called whenever the specified event is delivered to the target. The list of all the available events is the same as for the plugins. It can be found here. +The function called to add an event listener, a function that will be called whenever the specified event is delivered to the target. The list of all the available events is the same as for the plugins. Parameters: @@ -240,7 +240,7 @@ connector.disconnect() ## executeMethod -The function called to execute certain editor methods using the connector. The full list of these methods is the same as for the plugins. It can be found here. +The function called to execute certain editor methods using the connector. The full list of these methods is the same as for the plugins. Parameters: @@ -285,7 +285,7 @@ Example: const items = [ { id: "onConvert", - text: getMessage("Convert to Markdown or HTML"), + text: "Convert to Markdown or HTML", }, ] @@ -300,7 +300,7 @@ Below you can find methods that are available for this class. ### attachEvent -The function called to add an event listener to the modal window frame. This function will be called whenever the specified event is delivered to the target. The list of all the available events is the same as for the plugins. It can be found [here](../../../Plugin%20and%20Macros/Interacting%20with%20editors/Events/index.md). +The function called to add an event listener to the modal window frame. This function will be called whenever the specified event is delivered to the target. The list of all the available events is the same as for the plugins. Parameters: @@ -319,7 +319,7 @@ testConnectorWindow.attachEvent("onWindowMessage", (message) => { ### dispatchEvent -The function called to send an event to the modal window frame. The list of all the available events is the same as for the plugins. It can be found [here](../../../Plugin%20and%20Macros/Interacting%20with%20editors/Events/index.md). +The function called to send an event to the modal window frame. The list of all the available events is the same as for the plugins. Parameters: @@ -336,23 +336,6 @@ testConnectorWindow.dispatchEvent("messageName", { }) ``` -### sendToPlugin - -The function called to send a message to the editor from the modal window. - -Parameters: - -| Name | Type | Description | -| ---- | ------ | --------------- | -| name | string | The event name. | -| data | object | The event data. | - -Example: - -``` ts -testConnectorWindow.sendToPlugin("onWindowMessage", {type: "onWindowReady"}) -``` - ### show The function called to show a modal window inside the editor. @@ -374,3 +357,43 @@ testConnectorWindow.show({ icons: "./icon.svg", }) ``` + +In the connector window code, you can also use the following methods: + +### attachEvent + +The function called to subscribe to the messages from the plugin. + +Parameters: + +| Name | Type | Description | +| -------- | -------- | ------------------- | +| *id* | string | The event name. | +| *action* | function | The event listener. | + +Returns: This method doesn't return any data. + +Example: + +``` ts +window.Asc.plugin.attachEvent("messageName", (message) => { + console.log(message) +}) +``` + +### sendToPlugin + +The function called to send a message to the editor from the modal window. + +Parameters: + +| Name | Type | Description | +| ---- | ------ | --------------- | +| name | string | The event name. | +| data | object | The event data. | + +Example: + +``` ts +window.Asc.plugin.sendToPlugin("onWindowMessage", {type: "onWindowReady"}) +``` diff --git a/site/pages/Docs/Docs API/Usage API/Callback handler/index.md b/site/pages/Docs/Docs API/Usage API/Callback handler/index.md index d9168f327..9065ad81d 100644 --- a/site/pages/Docs/Docs API/Usage API/Callback handler/index.md +++ b/site/pages/Docs/Docs API/Usage API/Callback handler/index.md @@ -6,7 +6,7 @@ The **document editing service** informs the **document storage service** about ## actions -Defines the object received when the user takes an action with the document. The *type* field value can have the following values: +Defines the array of object received when the user takes an action with the document. The *type* field value can have the following values: - **0** - the user disconnects from the document co-editing; - **1** - the new user connects to the document co-editing; diff --git a/site/pages/Docs/Docs API/Usage API/Config/Editor/Customization/index.md b/site/pages/Docs/Docs API/Usage API/Config/Editor/Customization/index.md index 33f6fa0d1..ec20b386d 100644 --- a/site/pages/Docs/Docs API/Usage API/Config/Editor/Customization/index.md +++ b/site/pages/Docs/Docs API/Usage API/Config/Editor/Customization/index.md @@ -29,7 +29,7 @@ The customization section allows to customize the editor interface so that it lo - [macros](#macros) - [macrosMode](#macrosmode) - [mentionShare](#mentionshare) -- [mobileForceView](#mobileforceview) +- [mobile](#mobile) - [plugins](#plugins) - [review](#review) - [reviewDisplay](#reviewdisplay) @@ -45,7 +45,7 @@ The customization section allows to customize the editor interface so that it lo - [unit](#unit) - [zoom](#zoom) -> Please note that only the following parameters are available for the mobile editors: [close](#close), [feedback](#feedback), [goback](#goback), [help](#help), [logo](#logo), [macrosMode](#macrosmode), [mobileForceView](#mobileforceview). +> Please note that only the following parameters are available for the mobile editors: [close](#close), [feedback](#feedback), [goback](#goback), [help](#help), [logo](#logo), [macrosMode](#macrosmode), [mobile](#mobile). ## about @@ -1104,6 +1104,39 @@ Example: true Mention share +## mobile + +Defines the mobile document editor settings. + +Type: object + +Example: + +``` ts +const mobile = { + forceView: true, + standardView: false, +} +``` + +> Please note that this parameter is only available for the mobile editors. + +### mobile.forceView + +Defines whether the view mode is enabled on launch in the mobile document editor. The default value is **true**. + +Type: boolean + +Example: true + +### mobile.standardView + +Defines whether the editor will be opened in **Standard view** instead of **Mobile view**. The default value is **false**. + +Type: boolean + +Example: false + ## mobileForceView Defines if the mobile document editor is opened in the view/edit mode on launch. The default value is **true**. @@ -1114,6 +1147,8 @@ Example: true > Please note that this parameter is only available for the mobile editors. +> Deprecated since version 8.2. Please use the [mobile](#mobile) parameter instead. + ## plugins Defines if [plugins](../../../../../Plugin%20and%20Macros/Get%20Started/Overview/index.md) will be launched and available. The default value is **true**. @@ -1472,7 +1507,10 @@ const docEditor = new DocsAPI.DocEditor("placeholder", { macros: true, macrosMode: "warn", mentionShare: true, - mobileForceView: true, + mobile: { + forceView: true, + standardView: false, + }, plugins: true, review: { hideReviewDisplay: false, diff --git a/site/pages/Docs/Docs API/Usage API/Config/Events/index.md b/site/pages/Docs/Docs API/Usage API/Config/Events/index.md index 588935e2a..5f4753a43 100644 --- a/site/pages/Docs/Docs API/Usage API/Config/Events/index.md +++ b/site/pages/Docs/Docs API/Usage API/Config/Events/index.md @@ -521,6 +521,8 @@ To refresh data by a link to a file which is specified with the event parameters Update values +This event also fires when the user runs the [IMPORTRANGE](https://helpcenter.onlyoffice.com/onlyoffice-editors/onlyoffice-spreadsheet-editor/Functions/importrange.aspx?from=api) function. The URL of the source spreadsheet which is used in the *IMPORTRANGE* parameters is passed to the *onRequestReferenceData* event in the *event.data.link* parameter. + Example: ``` ts diff --git a/site/pages/Docs/Docs API/Usage API/Methods/index.md b/site/pages/Docs/Docs API/Usage API/Methods/index.md index 8f8cdeedb..bb6ade5df 100644 --- a/site/pages/Docs/Docs API/Usage API/Methods/index.md +++ b/site/pages/Docs/Docs API/Usage API/Methods/index.md @@ -67,9 +67,9 @@ Download the edited file. This method can be called only when the existence of t docEditor.downloadAs(format) ``` -| Parameter | Type | Presence | Description | -| --------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| format | string | optional | Defines the format in which a file will be downloaded. All the possible formats you can find in the [conversion tables](../../Additional%20API/Conversion%20API/index.md#text-matrix). But you cannot download a file in the image formats such as *bmp*, *gif*, *jpg*, *png*. If this parameter is undefined, the file will be downloaded in the OOXML format according to the file type. | +| Parameter | Type | Presence | Description | +| --------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| format | string | optional | Defines the format in which a file will be downloaded. All the possible formats you can find in the [conversion tables](../../Additional%20API/Conversion%20API/Conversion%20tables/index.md). But you cannot download a file in the image formats such as *bmp*, *gif*, *jpg*, *png*. If this parameter is undefined, the file will be downloaded in the OOXML format according to the file type. | > Please note that conversion from the *djvu*, *pdf*, *xps* formats are not available. The original format will be downloaded. diff --git a/site/pages/Docs/Docs API/Using WOPI/WOPI discovery/index.md b/site/pages/Docs/Docs API/Using WOPI/WOPI discovery/index.md index e695d11b4..88111f7a8 100644 --- a/site/pages/Docs/Docs API/Using WOPI/WOPI discovery/index.md +++ b/site/pages/Docs/Docs API/Using WOPI/WOPI discovery/index.md @@ -21,6 +21,7 @@ The **action** element of the discovery XML provides the important characteristi | embedview | Renders a non-editable view of a document that is optimized for embedding in a web page. This action is available starting from version 7.2. | | convert | Converts a document in a [binary format](../Editing%20binary%20documents/index.md) (*doc, ppt, xls*) into a modern format (*docx, pptx, xlsx*) so that it can be edited in the online office. This action is available starting from version 7.3. | | formsubmit | Supports opening *pdf* files in the form filling mode. In this case, a user might be able to make changes to a *pdf* file even if they didn't have permission to use the *edit* action. This action is available starting from version 8.1. | +| mobileView | Renders a non-editable view of a document that is optimized for viewing on mobile devices such as smartphones. This action is available starting from version 7.4. | ### Attributes diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/CloseFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/CloseFile/index.md index 8bdaa3753..990c9acc3 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/CloseFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/CloseFile/index.md @@ -1,6 +1,14 @@ -`void CloseFile();` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: CloseFile} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Closes the file to stop working with it. You can use a single **ONLYOFFICE Document Builder** instance to work with all your files, but you need to close the previous file before you can start working with the next one in this case. +Closes the file to stop working with it. You can use a single ONLYOFFICE Document Builder instance to work with all your files, but you need to close the previous file before you can start working with the next one in this case. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/CreateFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/CreateFile/index.md index 003197669..c2472097f 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/CreateFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/CreateFile/index.md @@ -1,12 +1,31 @@ -`bool CreateFile(nType);` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: CreateFile} +- {type: text, text: (} +- {type: parameter, text: nType} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: )} +``` + +## Description Creates a new file. The type of the file which will be created needs to be set. ## Parameters -| Name | Type | Description | -| ------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *nType* | int | The type of the file to be created set as a hexadecimal integer for the .Net code or **docx**, **xlsx**, **pptx**, or **pdf** for the *.docbuilder* script file (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). | + + +- nType + + ```yml signature.variant="inline" + - {type: type, text: int} + ``` + + - : The type of the file to be created set as a hexadecimal integer for the .Net code or `docx`, `xlsx`, `pptx`, or `pdf` for the `.docbuilder` script file (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/Destroy/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/Destroy/index.md index 8d42c162d..63fae9330 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/Destroy/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/Destroy/index.md @@ -1,8 +1,18 @@ -`static void Destroy();` +```yml signature +- {type: keyword, text: static} +- {type: text, text: " "} +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: Destroy} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Unloads the **ONLYOFFICE Document Builder** from the application memory when it is no longer needed. Generally, there is no need to dispose JS before exiting the process, it should happen automatically. It should only be used if the process needs the resources taken up by JS. +Unloads the ONLYOFFICE Document Builder from the application memory when it is no longer needed. Generally, there is no need to dispose JS before exiting the process, it should happen automatically. It should only be used if the process needs the resources taken up by JS. -> Please note, that for the *.docbuilder* file the *CDocBuilder.Destroy* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.Destroy` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/ExecuteCommand/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/ExecuteCommand/index.md index 6521d1302..c994341cc 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/ExecuteCommand/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/ExecuteCommand/index.md @@ -1,15 +1,47 @@ -`bool ExecuteCommand(sCommand, oRetValue = 0);` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: ExecuteCommand} +- {type: text, text: (} +- {type: parameter, text: sCommand} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: ", "} +- {type: parameter, text: oRetValue} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^%}} +- {type: text, text: " = "} +- {type: text, text: 0} +- {type: text, text: )} +``` + +## Description Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). See the [Text document API](../../../../../Office%20API/Usage%20API/Text%20Document%20API/index.md), [Spreadsheet API](../../../../../Office%20API/Usage%20API/Presentation%20API/index.md), [Presentation API](../../../../../Office%20API/Usage%20API/Presentation%20API/index.md), or [Form API](../../../../../Office%20API/Usage%20API/Form%20API/index.md) sections for more information which commands are available for various document types. -> Please note, that for the *.docbuilder* file the *CDocBuilder.ExecuteCommand* method is not used explicitly. The command itself is used instead. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilder.ExecuteCommand` method is not used explicitly. The command itself is used instead. See the example below. ## Parameters -| Name | Type | Description | -| ----------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *sCommand* | String^ | The command in the form of JavaScript code which will be used to create the document file (in .Net, the escape character must be used when the command contains quotation symbols). | -| *oRetValue* | CDocBuilderValue^% | The command return value. | + + +- sCommand + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The command in the form of JavaScript code which will be used to create the document file (in .Net, the escape character must be used when the command contains quotation symbols). + +- oRetValue, default: 0 + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^%}} + ``` + + - : The command return value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/GetContext/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/GetContext/index.md index beecc8511..9fbb6b2c3 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/GetContext/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/GetContext/index.md @@ -1,8 +1,16 @@ -`CDocBuilderContext^ GetContext();` +```yml signature +- {id: ../../CDocBuilderContext/index.md, token: {type: type, text: CDocBuilderContext^}} +- {type: text, text: " "} +- {type: entity, text: GetContext} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Returns the current JS [context](../../CDocBuilderContext/index.md). -> Please note, that for the *.docbuilder* file the *CDocBuilder.GetContext* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.GetContext` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/GetVersion/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/GetVersion/index.md index abe9674a6..d3d575e89 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/GetVersion/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/GetVersion/index.md @@ -1,8 +1,16 @@ -`String^ GetVersion();` +```yml signature +- {type: type, text: String^} +- {type: text, text: " "} +- {type: entity, text: GetVersion} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns the **ONLYOFFICE Document Builder** engine version. +Returns the ONLYOFFICE Document Builder engine version. -> Please note, that for the *.docbuilder* file the *CDocBuilder.GetVersion* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.GetVersion` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/Initialize/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/Initialize/index.md index eb42b3b30..1462e49f9 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/Initialize/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/Initialize/index.md @@ -1,14 +1,37 @@ -`static void Initialize(sDirectory=0);` +```yml signature +- {type: keyword, text: static} +- {type: text, text: " "} +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: Initialize} +- {type: text, text: (} +- {type: parameter, text: sDirectory} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: " = "} +- {type: text, text: 0} +- {type: text, text: )} +``` + +## Description -Initializes the **ONLYOFFICE Document Builder** as a library for the application to be able to work with it. This method just sets the directory to the main Document Builder resources (icu files, etc). If this method is not called, the Document Builder will find resources from the current process directory. +Initializes the ONLYOFFICE Document Builder as a library for the application to be able to work with it. This method just sets the directory to the main Document Builder resources (icu files, etc). If this method is not called, the Document Builder will find resources from the current process directory. -> Please note, that for the *.docbuilder* file the *CDocBuilder.Initialize* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.Initialize` method is not used. ## Parameters -| Name | Type | Description | -| ------------ | ------- | ------------------------------------------------ | -| *sDirectory* | String^ | The path to the main Document Builder resources. | + + +- sDirectory, default: 0 + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The path to the main Document Builder resources. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/IsSaveWithDoctrendererMode/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/IsSaveWithDoctrendererMode/index.md index 49ad0a35d..96a478a4f 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/IsSaveWithDoctrendererMode/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/IsSaveWithDoctrendererMode/index.md @@ -1,8 +1,16 @@ -`bool IsSaveWithDoctrendererMode();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsSaveWithDoctrendererMode} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. -> Please note, that for the *.docbuilder* file the *CDocBuilder.IsSaveWithDoctrendererMode* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.IsSaveWithDoctrendererMode` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/OpenFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/OpenFile/index.md index 64543f0c6..1df17e8a8 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/OpenFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/OpenFile/index.md @@ -1,13 +1,54 @@ -`int OpenFile(sPath, sParams);` +```yml signature +- {type: type, text: int} +- {type: text, text: " "} +- {type: entity, text: OpenFile} +- {type: text, text: (} +- {type: parameter, text: sPath} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: ", "} +- {type: parameter, text: sParams} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: )} +``` + +## Description Opens the document file which will be edited and saved afterwards. ## Parameters -| Name | Type | Attributes | Description | -| --------- | ------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *sPath* | String^ | | The path to the file to be opened together with its name and extension. | -| *sParams* | String^ | \ | The parameters needed for the correct file opening (most commonly, the encoding is used for the *txt* and *csv* file types or the delimiter for the *csv* files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where **m\_nCsvTxtEncoding** is used for the text encoding and **m\_nCsvDelimiter** is used for the **delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the *csv* delimiters include:

          **0** - no delimiter;

          **1** - tab;

          **2** - semicolon;

          **3** - colon;

          **4** - comma;

          **5** - space. | + + +- sPath + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : + + The path to the file to be opened together with its name and extension. + +- sParams + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : + + The parameters needed for the correct file opening (most commonly, the encoding is used for the `txt` and `csv` file types or the delimiter for the `csv` files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where `m_nCsvTxtEncoding` is used for the text encoding and `m_nCsvDelimiter` is used for the delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the `csv` delimiters include: + + - `0` - no delimiter; + - `1` - tab; + - `2` - semicolon; + - `3` - colon; + - `4` - comma; + - `5` - space. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/Run/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/Run/index.md index 58c882479..68c394989 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/Run/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/Run/index.md @@ -1,12 +1,31 @@ -`bool Run(sPath);` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: Run} +- {type: text, text: (} +- {type: parameter, text: sPath} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: )} +``` + +## Description -Runs the **ONLYOFFICE Document Builder** executable. If you do not want to write a .Net application, you can simply use the **docbuilder.exe** executable file and run it with the **.docbuilder** file as an argument, where all the code for the document file creation will be written. For .Net, create the *CDocBuilder* object and call the *Run* method with the path to the executable file from the *sPath* parameter. +Runs the ONLYOFFICE Document Builder executable. If you do not want to write a .Net application, you can simply use the `docbuilder.exe` executable file and run it with the `.docbuilder` file as an argument, where all the code for the document file creation will be written. For .Net, create the `CDocBuilder` object and call the `Run` method with the path to the executable file from the `sPath` parameter. ## Parameters -| Name | Type | Description | -| ------- | ------- | ----------------------------------------------------------- | -| *sPath* | String^ | The path to the **ONLYOFFICE Document Builder** executable. | + + +- sPath + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The path to the ONLYOFFICE Document Builder executable. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/RunText/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/RunText/index.md index 9e6fc87b2..705bbdece 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/RunText/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/RunText/index.md @@ -1,14 +1,33 @@ -`bool RunText(sCommands);` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: RunText} +- {type: text, text: (} +- {type: parameter, text: sCommands} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: )} +``` + +## Description -Runs all the commands for the document creation using a single command. Compared to [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) where only one command at a time is allowed, *CDocBuilder.RunText* makes it possible to enter all the commands for the document creation at once. +Runs all the commands for the document creation using a single command. Compared to [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) where only one command at a time is allowed, `CDocBuilder.RunText` makes it possible to enter all the commands for the document creation at once. -> Please note, that for the *.docbuilder* file the *CDocBuilder.RunText* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.RunText` method is not used. ## Parameters -| Name | Type | Description | -| ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *sCommands* | String^ | The commands which will be used to create the document file (in .Net, the escape character must be used when the command contains quotation symbols). All the commands containing *builder.* are line separated, i.e. you cannot write them in one line, each command **must** start with its own line. | + + +- sCommands + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The commands which will be used to create the document file (in .Net, the escape character must be used when the command contains quotation symbols). All the commands containing `builder.` are line separated, i.e. you cannot write them in one line, each command must start with its own line. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/SaveFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/SaveFile/index.md index 7cf9440f8..3803431bb 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/SaveFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/SaveFile/index.md @@ -1,14 +1,70 @@ -`bool SaveFile(nType, sPath, sParams);` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: SaveFile} +- {type: text, text: (} +- {type: parameter, text: nType} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: ", "} +- {type: parameter, text: sPath} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: ", "} +- {type: parameter, text: sParams} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: )} +``` + +## Description Saves the file after all the changes are made. The type of the file which will be saved needs to be set. ## Parameters -| Name | Type | Description | -| --------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *nType* | int | The type of the file to be saved set as a hexadecimal integer for the .Net code. For the *.docbuilder* script file the following values are possible: **docx**, **odt**, **rtf**, **txt**, **pptx**, **xlsx**, **ods**, **csv**, **pdf** (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). | -| *sPath* | String^ | The path to the file to be saved together with its name and extension. | -| *sParams* | String^ | The parameters needed for the correct file saving (most commonly, the encoding is used for the *txt* and *csv* file types or the delimiter for the *csv* files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where **m\_nCsvTxtEncoding** is used for the text encoding and **m\_nCsvDelimiter** is used for the *csv* delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the *csv* delimiters include:

          **0** - no delimiter;

          **1** - tab;

          **2** - semicolon;

          **3** - colon;

          **4** - comma;

          **5** - space.

          When saving into an image file (*png* or *jpg*) for creating thumbnails, the additional parameters are used. [See below](#saving-into-images) to find them out. | + + +- nType + + ```yml signature.variant="inline" + - {type: type, text: int} + ``` + + - : + + The type of the file to be saved set as a hexadecimal integer for the .Net code. For the `.docbuilder` script file the following values are possible: `docx`, `odt`, `rtf`, `txt`, `pptx`, `xlsx`, `ods`, `csv`, `pdf` (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). + +- sPath + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : + + The path to the file to be saved together with its name and extension. + +- sParams + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : + + The parameters needed for the correct file saving (most commonly, the encoding is used for the `txt` and `csv` file types or the delimiter for the `csv` files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where `m_nCsvTxtEncoding` is used for the text encoding and `m_nCsvDelimiter` is used for the `csv` delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the `csv` delimiters include: + + - `0` - no delimiter; + - `1` - tab; + - `2` - semicolon; + - `3` - colon; + - `4` - comma; + - `5` - space. + + When saving into an image file (`png` or `jpg`) for creating thumbnails, the additional parameters are used. [See below](#saving-into-images) to find them out. + + ## Example @@ -32,14 +88,14 @@ builder.SaveFile("docx", "result.docx") ## Saving into images -**ONLYOFFICE Document Builder** allows to save your document files into image files creating thumbnails of the first page or of all the pages in the document. This is done using the parameters of the *SaveFile()* method. The parameters are added in the form of XML tags, where the following tags can be used: +ONLYOFFICE Document Builder allows to save your document files into image files creating thumbnails of the first page or of all the pages in the document. This is done using the parameters of the `SaveFile()` method. The parameters are added in the form of XML tags, where the following tags can be used: -- **m\_oThumbnail** - the core tag showing that the inner nodes will be used to create a thumbnail out of the document file; -- **format** - the image file format used to create a thumbnail (can be of the following values: **3** - for a JPG file, **4** - for a PNG file); -- **aspect** - the image aspect when creating a thumbnail from the document file (can be of the following values: **1** - will keep the original aspect, **0** - will stretch the image to fit the width and the height set below); -- **first** - whether only the first page or all the pages should be converted into a thumbnail (can be of the following values: **true** - only the first page will be converted, **false** - all the document pages will be used to create thumbnails, in this case the file will be saved as an archive of images, one for each page); -- **width** - the image width in pixels; -- **height** - the image height in pixels. +- `m_oThumbnail` - the core tag showing that the inner nodes will be used to create a thumbnail out of the document file; +- `format` - the image file format used to create a thumbnail (can be of the following values: `3` - for a JPG file, `4` - for a PNG file); +- `aspect` - the image aspect when creating a thumbnail from the document file (can be of the following values: `1` - will keep the original aspect, `0` - will stretch the image to fit the width and the height set below); +- `first` - whether only the first page or all the pages should be converted into a thumbnail (can be of the following values: `true` - only the first page will be converted, `false` - all the document pages will be used to create thumbnails, in this case the file will be saved as an archive of images, one for each page); +- `width` - the image width in pixels; +- `height` - the image height in pixels. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/SetProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/SetProperty/index.md index d33151d2a..d293833a0 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/SetProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/SetProperty/index.md @@ -1,31 +1,125 @@ -`void SetProperty(sParam, sValue);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: SetProperty} +- {type: text, text: (} +- {type: parameter, text: sParam} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: ", "} +- {type: parameter, text: sValue} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: )} +``` + +## Description -Sets an argument to the builder class which can be trasferred to the program outside the [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) method, i.e. either as an additional property when running **ONLYOFFICE Document Builder** executable file or as a part of program code, but not included into the document file script. +Sets an argument to the builder class which can be trasferred to the program outside the [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) method, i.e. either as an additional property when running ONLYOFFICE Document Builder executable file or as a part of program code, but not included into the document file script. -> Please note, that for the *.docbuilder* file the *CDocBuilder.SetProperty* method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilder.SetProperty` method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below. ## Parameters -| Name | Type | Description | -| -------- | ------- | ------------------------------------------------------- | -| *sParam* | String^ | The parameter name, the value is always *--argument*. | -| *sValue* | String^ | The parameter value which will be used in the document. | + + +- sParam + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The parameter name, the value is always `--argument`. + +- sValue + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The parameter value which will be used in the document. + + ## Supported properties -| Name | Type | Default | Description | -| --------------------------- | ------- | ------- | -------------------------------------------------------------------------------------------------------------------------- | -| *--use-doctrenderer-scheme* | bool | false | Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. | -| *--check-fonts* | bool | true | Specifies if the system fonts are cached for faster work. | -| *--work-directory* | String^ | "" | The path to the temporary directory. | -| *--cache-scripts* | bool | true | Specifies if the sdkjs scripts are cached. | -| *--save-use-only-names* | bool | false | Specifies if the destination paths are used (for server work). For example: /home/user/1.txt => /tmp/1.txt | -| *--all-fonts-path* | String^ | "" | The path to the *AllFonts.js* script. | -| *--argument* | String^ | "" | The JSON argument which is sent to the global parameters of all the opened JS context. | -| *--fonts-system* | bool | true | Specifies if the system fonts are used. | -| *--fonts-dir* | String^ | "" | The path to the additional fonts directory (may be many records). | + + +- --use-doctrenderer-scheme, default: false + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. + +- --check-fonts, default: true + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the system fonts are cached for faster work. + +- --work-directory, default: "" + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The path to the temporary directory. + +- --cache-scripts, default: true + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the sdkjs scripts are cached. + +- --save-use-only-names, default: false + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the destination paths are used (for server work). For example: `/home/user/1.txt` => `/tmp/1.txt`. + +- --all-fonts-path, default: "" + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The path to the `AllFonts.js` script. + +- --argument, default: "" + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The JSON argument which is sent to the global parameters of all the opened JS context. + +- --fonts-system, default: true + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the system fonts are used. + +- --fonts-dir, default: "" + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The path to the additional fonts directory (may be many records). + + -Once added, the argument will be available as the **Argument** variable with its parameter values set: +Once added, the argument will be available as the `Argument` variable with its parameter values set: ```cs Argument.name === "ONLYOFFICE" // true @@ -51,7 +145,7 @@ docbuilder.exe "--argument={\"name\":\"ONLYOFFICE\"}" test.docbuilder ## Adding or removing fonts -It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the **check-fonts** variable is used: +It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the `check-fonts` variable is used: ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/SetTmpFolder/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/SetTmpFolder/index.md index 2a29fa45d..f278cbc56 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/SetTmpFolder/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/SetTmpFolder/index.md @@ -1,12 +1,31 @@ -`void SetTmpFolder(sFolder);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: SetTmpFolder} +- {type: text, text: (} +- {type: parameter, text: sFolder} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: )} +``` + +## Description Sets the path to the folder where the program will temporarily save files needed for the program correct work. After the successful document file creation, all the files will be deleted from the folder. If no temporary folder is set, the system one will be used. ## Parameters -| Name | Type | Description | -| --------- | ------- | --------------------------------------------------------------- | -| *sFolder* | String^ | The path to the folder where the temporary files will be saved. | + + +- sFolder + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The path to the folder where the temporary files will be saved. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/WriteData/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/WriteData/index.md index 54123e72e..f9eb9d408 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/WriteData/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/WriteData/index.md @@ -1,16 +1,57 @@ -`void WriteData(sPath, sValue, bAppend);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: WriteData} +- {type: text, text: (} +- {type: parameter, text: sPath} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: ", "} +- {type: parameter, text: sValue} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: ", "} +- {type: parameter, text: bAppend} +- {type: text, text: ": "} +- {type: type, text: bool} +- {type: text, text: )} +``` + +## Description Writes data to the log file. It is used for logs in JS code. -> Please note, that for the *.docbuilder* file the *CDocBuilder.WriteData* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.WriteData` method is not used. ## Parameters -| Name | Type | Description | -| --------- | ------- | ---------------------------------------------------------------------------------------------------------- | -| *sPath* | String^ | The path to the file where all the logs will be written. | -| *sValue* | String^ | The data which will be written to the log file. | -| *bAppend* | bool | Specifies if the new data will be appended to the already existing log file or a new file will be created. | + + +- sPath + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The path to the file where all the logs will be written. + +- sValue + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The data which will be written to the log file. + +- bAppend + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the new data will be appended to the already existing log file or a new file will be created. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/index.md index 62a9c1b4d..3e8d9f8ec 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilder/index.md @@ -1,23 +1,46 @@ -`new CDocBuilder` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilder} +``` -Base class used by **ONLYOFFICE Document Builder** for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. +## Description -## Methods +Base class used by ONLYOFFICE Document Builder for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. -| Name | Description | -| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| [CloseFile](CloseFile/index.md) | Closes the file to stop working with it. | -| [CreateFile](CreateFile/index.md) | Creates a new file. | -| [Destroy](Destroy/index.md) | Unloads the **ONLYOFFICE Document Builder** from the application memory when it is no longer needed. | -| [ExecuteCommand](ExecuteCommand/index.md) | Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). | -| [GetContext](GetContext/index.md) | Returns the current JS context. | -| [GetVersion](GetVersion/index.md) | Returns the **ONLYOFFICE Document Builder** engine version. | -| [Initialize](Initialize/index.md) | Initializes the **ONLYOFFICE Document Builder** as a library for the application to be able to work with it. | -| [IsSaveWithDoctrendererMode](IsSaveWithDoctrendererMode/index.md) | Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. | -| [OpenFile](OpenFile/index.md) | Opens the document file which will be edited and saved afterwards. | -| [Run](Run/index.md) | Runs the **ONLYOFFICE Document Builder** executable. | -| [RunText](RunText/index.md) | Runs all the commands for the document creation using a single command. | -| [SaveFile](SaveFile/index.md) | Saves the file after all the changes are made. | -| [SetProperty](SetProperty/index.md) | Sets an argument which can be transferred to the program outside the [CDocBuilder.ExecuteCommand](ExecuteCommand/index.md) method. | -| [SetTmpFolder](SetTmpFolder/index.md) | Sets the path to the folder where the program will temporarily save files needed for the program's correct work. | -| [WriteData](WriteData/index.md) | Writes data to the log file. | +## Instance Methods + + + +- [CloseFile](CloseFile/index.md) + - : Closes the file to stop working with it. +- [CreateFile](CreateFile/index.md) + - : Creates a new file. +- [Destroy](Destroy/index.md) + - : Unloads the ONLYOFFICE Document Builder from the application memory when it is no longer needed. +- [ExecuteCommand](ExecuteCommand/index.md) + - : Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). +- [GetContext](GetContext/index.md) + - : Returns the current JS context. +- [GetVersion](GetVersion/index.md) + - : Returns the ONLYOFFICE Document Builder engine version. +- [Initialize](Initialize/index.md) + - : Initializes the ONLYOFFICE Document Builder as a library for the application to be able to work with it. +- [IsSaveWithDoctrendererMode](IsSaveWithDoctrendererMode/index.md) + - : Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. +- [OpenFile](OpenFile/index.md) + - : Opens the document file which will be edited and saved afterwards. +- [Run](Run/index.md) + - : Runs the ONLYOFFICE Document Builder executable. +- [RunText](RunText/index.md) + - : Runs all the commands for the document creation using a single command. +- [SaveFile](SaveFile/index.md) + - : Saves the file after all the changes are made. +- [SetProperty](SetProperty/index.md) + - : Sets an argument which can be transferred to the program outside the [CDocBuilder.ExecuteCommand](ExecuteCommand/index.md) method. +- [SetTmpFolder](SetTmpFolder/index.md) + - : Sets the path to the folder where the program will temporarily save files needed for the program correct work. +- [WriteData](WriteData/index.md) + - : Writes data to the log file. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateArray/index.md index 6a4660250..fe38c4a55 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateArray/index.md @@ -1,14 +1,33 @@ -`CDocBuilderValue^ CreateArray(nLength);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: " "} +- {type: entity, text: CreateArray} +- {type: text, text: (} +- {type: parameter, text: nLength} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: )} +``` + +## Description -Creates an array value, an analogue of *new Array (length)* in JS. +Creates an array value, an analogue of `new Array (length)` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateArray` method is not used. ## Parameters -| Name | Type | Description | -| --------- | ---- | ----------------- | -| *nLength* | int | The array length. | + + +- nLength + + ```yml signature.variant="inline" + - {type: type, text: int} + ``` + + - : The array length. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateNull/index.md index e895499fb..684ea41fa 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateNull/index.md @@ -1,8 +1,16 @@ -`CDocBuilderValue^ CreateNull();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: " "} +- {type: entity, text: CreateNull} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Creates a null value, an analogue of *null* in JS. +Creates a null value, an analogue of `null` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateNull* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateNull` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateObject/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateObject/index.md index 59646e4d2..cd8c461e9 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateObject/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateObject/index.md @@ -1,8 +1,16 @@ -`CDocBuilderValue^ CreateObject();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: " "} +- {type: entity, text: CreateObject} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Creates an empty object, an analogue of *{}* in JS. +Creates an empty object, an analogue of `{}` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateObject* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateObject` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateScope/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateScope/index.md index 1fd64b4df..f88b6776a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateScope/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateScope/index.md @@ -1,8 +1,16 @@ -`CDocBuilderContextScope^ CreateScope();` +```yml signature +- {id: ../../CDocBuilderContextScope/index.md, token: {type: type, text: CDocBuilderContextScope^}} +- {type: text, text: " "} +- {type: entity, text: CreateScope} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Creates a [context scope](../../CDocBuilderContextScope/index.md) which sets the execution context for all operations executed within a local scope. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateScope* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateScope` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateTypedArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateTypedArray/index.md index 74aa497c5..cd9920ef2 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateTypedArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateTypedArray/index.md @@ -1,14 +1,37 @@ -`CDocBuilderValue^ CreateTypedArray(aBuffer);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: " "} +- {type: entity, text: CreateTypedArray} +- {type: text, text: (} +- {type: parameter, text: aBuffer} +- {type: text, text: ": "} +- {type: type, text: array} +- {type: text, text: " | "} +- {type: type, text: ^} +- {type: text, text: )} +``` + +## Description -Creates a Uint8Array value, an analogue of *Uint8Array* in JS. +Creates a Uint8Array value, an analogue of `Uint8Array` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateTypedArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateTypedArray` method is not used. ## Parameters -| Name | Type | Description | -| --------- | ------------- | ----------------- | -| *aBuffer* | array\^ | The array buffer. | + + +- aBuffer + + ```yml signature.variant="inline" + - {type: type, text: array} + - {type: text, text: " | "} + - {type: type, text: ^} + ``` + + - : The array buffer. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateUndefined/index.md index 3b2186fc0..1b08c3aaf 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/CreateUndefined/index.md @@ -1,8 +1,16 @@ -`CDocBuilderValue^ CreateUndefined();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: " "} +- {type: entity, text: CreateUndefined} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Creates an undefined value, an analogue of *undefined* in JS. +Creates an undefined value, an analogue of `undefined` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateUndefined` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/GetGlobal/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/GetGlobal/index.md index 5d7566c8f..39499bf49 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/GetGlobal/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/GetGlobal/index.md @@ -1,8 +1,16 @@ -`CDocBuilderValue^ GetGlobal();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: " "} +- {type: entity, text: GetGlobal} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Returns the global object for the current context. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.GetGlobal* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.GetGlobal` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/IsError/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/IsError/index.md index 61699469c..c46c94908 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/IsError/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/IsError/index.md @@ -1,8 +1,16 @@ -`bool IsError();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsError} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Checks for errors in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.IsError* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.IsError` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/index.md index e345b1a32..4e6118e86 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContext/index.md @@ -1,16 +1,32 @@ -`new CDocBuilderContext` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderContext} +``` -Class used by **ONLYOFFICE Document Builder** for getting JS context for working. +## Description -## Methods +Class used by ONLYOFFICE Document Builder for getting JS context for working. -| Name | Description | -| --------------------------------------------- | -------------------------------------------------------------- | -| [CreateArray](CreateArray/index.md) | Creates an array, an analogue of *new Array (length)* in JS. | -| [CreateNull](CreateNull/index.md) | Creates a null value, an analogue of *null* in JS. | -| [CreateObject](CreateObject/index.md) | Creates an empty object, an analogue of *{}* in JS. | -| [CreateScope](CreateScope/index.md) | Creates a context scope. | -| [CreateTypedArray](CreateTypedArray/index.md) | Creates a Uint8Array value, an analogue of *Uint8Array* in JS. | -| [CreateUndefined](CreateUndefined/index.md) | Creates an undefined value, an analogue of *undefined* in JS. | -| [GetGlobal](GetGlobal/index.md) | Returns the global object for the current context. | -| [IsError](IsError/index.md) | Checks for errors in JS. | +## Instance Methods + + + +- [CreateArray](CreateArray/index.md) + - : Creates an array, an analogue of `new Array (length)` in JS. +- [CreateNull](CreateNull/index.md) + - : Creates a null value, an analogue of `null` in JS. +- [CreateObject](CreateObject/index.md) + - : Creates an empty object, an analogue of `{}` in JS. +- [CreateScope](CreateScope/index.md) + - : Creates a context scope. +- [CreateTypedArray](CreateTypedArray/index.md) + - : Creates a Uint8Array value, an analogue of `Uint8Array` in JS. +- [CreateUndefined](CreateUndefined/index.md) + - : Creates an undefined value, an analogue of `undefined` in JS. +- [GetGlobal](GetGlobal/index.md) + - : Returns the global object for the current context. +- [IsError](IsError/index.md) + - : Checks for errors in JS. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContextScope/Close/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContextScope/Close/index.md index 81fdfc70e..60511d4ee 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContextScope/Close/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContextScope/Close/index.md @@ -1,8 +1,16 @@ -`void Close();` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: Close} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Closes the current scope. This method will be called automatically when the descructor is executed. -> Please note, that for the *.docbuilder* file the *CDocBuilderContextScope.Close* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContextScope.Close` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContextScope/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContextScope/index.md index 83f7cfb6e..cd60ed76c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContextScope/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderContextScope/index.md @@ -1,9 +1,18 @@ -`new CDocBuilderContextScope` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderContextScope} +``` -The stack-allocated class used by **ONLYOFFICE Document Builder** which sets the execution context for all operations executed within a local scope. All opened scopes will be closed automatically when the builder [CloseFile](../CDocBuilder/CloseFile/index.md) method is called. +## Description -## Methods +The stack-allocated class used by ONLYOFFICE Document Builder which sets the execution context for all operations executed within a local scope. All opened scopes will be closed automatically when the builder [CloseFile](../CDocBuilder/CloseFile/index.md) method is called. -| Name | Description | -| ----------------------- | ------------------------- | -| [Close](Close/index.md) | Closes the current scope. | +## Instance Methods + + + +- [Close](Close/index.md) + - : Closes the current scope. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Call/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Call/index.md index 59f46dbda..400a30d95 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Call/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Call/index.md @@ -1,15 +1,65 @@ -`CDocBuilderValue^ Call(sName, p1, p2, p3, p4, p5, p6);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: " "} +- {type: entity, text: Call} +- {type: text, text: (} +- {type: parameter, text: sName} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: ", "} +- {type: parameter, text: p1} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: ", "} +- {type: parameter, text: p2} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: ", "} +- {type: parameter, text: p3} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: ", "} +- {type: parameter, text: p4} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: ", "} +- {type: parameter, text: p5} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: ", "} +- {type: parameter, text: p6} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: )} +``` + +## Description Calls the specified Document Builder method. See the [Text document API](../../../../../Office%20API/Usage%20API/Text%20Document%20API/index.md), [Spreadsheet API](../../../../../Office%20API/Usage%20API/Spreadsheet%20API/index.md), [Presentation API](../../../../../Office%20API/Usage%20API/Presentation%20API/index.md) or [Form API](../../../../../Office%20API/Usage%20API/Form%20API/index.md) sections for more information which methods are available for various document types. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Call* method is not used explicitly. The method itself is used instead. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Call` method is not used explicitly. The method itself is used instead. See the example below. ## Parameters -| Name | Type | Description | -| ------- | -------------- | ------------------------------------------------------------------ | -| *sName* | String^ | The name of the Document Builder method. | -| *p1-p6* | CBuilderValue^ | The parameters that the Document Builder method takes as argumens. | + + +- sName + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The name of the Document Builder method. + +- p1-p6 + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} + ``` + + - : The parameters that the Document Builder method takes as argumens. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Clear/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Clear/index.md index 838c05684..bc897426c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Clear/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Clear/index.md @@ -1,8 +1,16 @@ -`void Clear();` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: Clear} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Clears the **CDocBuilderValue** object. +Clears the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Clear* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Clear` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/CreateNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/CreateNull/index.md index a23569ca8..6cf969abf 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/CreateNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/CreateNull/index.md @@ -1,8 +1,18 @@ -`static CDocBuilderValue^ CreateNull();` +```yml signature +- {type: keyword, text: static} +- {type: text, text: " "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: " "} +- {type: entity, text: CreateNull} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Creates a null value. This method returns the current [context](../../CDocBuilderContext/index.md) and calls its [CreateNull](../../CDocBuilderContext/CreateNull/index.md) method. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.CreateNull* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.CreateNull` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/CreateUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/CreateUndefined/index.md index 1021b07a9..58f4af69e 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/CreateUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/CreateUndefined/index.md @@ -1,8 +1,18 @@ -`static CDocBuilderValue^ CreateUndefined();` +```yml signature +- {type: keyword, text: static} +- {type: text, text: " "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: " "} +- {type: entity, text: CreateUndefined} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Creates an undefined value. This method returns the current [context](../../CDocBuilderContext/index.md) and calls its [CreateUndefined](../../CDocBuilderContext/CreateUndefined/index.md) method. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.CreateUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.CreateUndefined` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Get/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Get/index.md index 01bc6f80c..bdda7c672 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Get/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Get/index.md @@ -1,14 +1,33 @@ -`CDocBuilderValue^ Get(nIndex);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: " "} +- {type: entity, text: Get} +- {type: text, text: (} +- {type: parameter, text: nIndex} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: )} +``` + +## Description Returns an array value by its index. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Get* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Get` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ---- | ----------------------------- | -| *nIndex* | int | The index of the array value. | + + +- nIndex + + ```yml signature.variant="inline" + - {type: type, text: int} + ``` + + - : The index of the array value. + + ## Example @@ -27,7 +46,7 @@ CValue oChart = aCharts.Get(1); CDocBuilder.Destroy(); ``` -The **default\[]** postfix expression can be also used to get an array value by its index: +The `default[]` postfix expression can be also used to get an array value by its index: ```cs property CDocBuilderValue^ default[int] diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/GetLength/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/GetLength/index.md index 740971415..7ccae1abe 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/GetLength/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/GetLength/index.md @@ -1,8 +1,16 @@ -`unsigned int GetLength();` +```yml signature +- {type: type, text: unsigned int} +- {type: text, text: " "} +- {type: entity, text: GetLength} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns the length if the **CDocBuilderValue** object is an array/typed array. Otherwise, returns 0. +Returns the length if the `CDocBuilderValue` object is an array/typed array. Otherwise, returns 0. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.GetLength* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.GetLength` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/GetProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/GetProperty/index.md index 5940b3bef..d7af90730 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/GetProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/GetProperty/index.md @@ -1,14 +1,33 @@ -`CDocBuilderValue^ GetProperty(sName);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: " "} +- {type: entity, text: GetProperty} +- {type: text, text: (} +- {type: parameter, text: sName} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: )} +``` + +## Description -Returns a property of the **CDocBuilderValue** object. +Returns a property of the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.GetProperty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.GetProperty` method is not used. ## Parameters -| Name | Type | Description | -| ------- | ------- | ----------------------------------------------------- | -| *sName* | String^ | The name of the **CDocBuilderValue** object property. | + + +- sName + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The name of the `CDocBuilderValue` object property. + + ## Example @@ -26,9 +45,9 @@ CValue oDocPr = oDocument.GetProperty("color"); CDocBuilder.Destroy(); ``` -There are two more ways to get a property of the **CDocBuilderValue** object: +There are two more ways to get a property of the `CDocBuilderValue` object: -1. use the **Get** method that takes an argument in the string format: +1. use the `Get` method that takes an argument in the string format: ```cs CDocBuilderValue^ Get(String^ name); @@ -50,7 +69,7 @@ There are two more ways to get a property of the **CDocBuilderValue** object: CDocBuilder.Destroy(); ``` -2. use the **default\[]** postfix expression that takes an argument in the string format: +2. use the `default[]` postfix expression that takes an argument in the string format: ```cs property CDocBuilderValue^ default[String^] diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsArray/index.md index c0d55fe27..ce2c237ab 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsArray/index.md @@ -1,8 +1,16 @@ -`bool IsArray();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsArray} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an array. +Returns true if the `CDocBuilderValue` object is an array. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsArray` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsBool/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsBool/index.md index 598c73656..5c2434068 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsBool/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsBool/index.md @@ -1,8 +1,16 @@ -`bool IsBool();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsBool} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a boolean value. +Returns true if the `CDocBuilderValue` object is a boolean value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsBool* method is not used. +> Please note, that for the `.docbuilder` file the` CDocBuilderValue.IsBool` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsDouble/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsDouble/index.md index 51fc4fe95..58afa66f3 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsDouble/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsDouble/index.md @@ -1,8 +1,16 @@ -`bool IsDouble();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsDouble} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a double value. +Returns true if the `CDocBuilderValue` object is a double value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsDouble* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsDouble` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsEmpty/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsEmpty/index.md index 50b055501..6eeff9fd7 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsEmpty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsEmpty/index.md @@ -1,8 +1,16 @@ -`bool IsEmpty();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsEmpty} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is empty. +Returns true if the `CDocBuilderValue` object is empty. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsEmpty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsEmpty` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsFunction/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsFunction/index.md index a7f6e5e6e..f31281b11 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsFunction/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsFunction/index.md @@ -1,8 +1,16 @@ -`bool IsFunction();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsFunction} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a function. +Returns true if the `CDocBuilderValue` object is a function. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsFunction* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsFunction` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsInt/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsInt/index.md index 73602bd6f..7587a8f3d 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsInt/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsInt/index.md @@ -1,8 +1,16 @@ -`bool IsInt();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsInt} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an integer. +Returns true if the `CDocBuilderValue` object is an integer. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsInt* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsInt` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsNull/index.md index 058f77ffa..23544b176 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsNull/index.md @@ -1,8 +1,16 @@ -`bool IsNull();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsNull} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is null. +Returns true if the `CDocBuilderValue` object is null. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsNll* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsNll` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsObject/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsObject/index.md index 4c0b85c66..36af8cb0e 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsObject/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsObject/index.md @@ -1,8 +1,16 @@ -`bool IsObject();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsObject} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an object. +Returns true if the `CDocBuilderValue` object is an object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsObject* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsObject` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsString/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsString/index.md index 4d240be76..622a79916 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsString/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsString/index.md @@ -1,8 +1,16 @@ -`bool IsString();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsString} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a string. +Returns true if the `CDocBuilderValue` object is a string. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsString* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsString` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsTypedArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsTypedArray/index.md index ceddd5434..b9010e58a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsTypedArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsTypedArray/index.md @@ -1,8 +1,16 @@ -`bool IsTypedArray();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsTypedArray} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a typed array. +Returns true if the `CDocBuilderValue` object is a typed array. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsTypedArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsTypedArray` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsUndefined/index.md index c42a9c7a4..aeced6c4f 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/IsUndefined/index.md @@ -1,8 +1,16 @@ -`bool IsUndefined();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsUndefined} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is undefined. +Returns true if the `CDocBuilderValue` object is undefined. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsUndefined` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Set/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Set/index.md index 43df1ec6b..73e1f5692 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Set/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/Set/index.md @@ -1,15 +1,46 @@ -`void Set(nIndex, sValue);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: Set} +- {type: text, text: (} +- {type: parameter, text: nIndex} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: ", "} +- {type: parameter, text: sValue} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: )} +``` + +## Description Sets an array value by its index. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Set* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Set` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ----------------- | ----------------------------- | -| *nIndex* | int | The index of the array value. | -| *sValue* | CDocBuilderValue^ | The array value to be set. | + + +- nIndex + + ```yml signature.variant="inline" + - {type: type, text: int} + ``` + + - : The index of the array value. + +- sValue + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} + + ``` + + - : The array value to be set. + + ## Example @@ -32,7 +63,7 @@ aCharts.Set(1, oChart); CDocBuilder.Destroy(); ``` -The **default\[]** postfix expression can be also used to set an array value by its index: +The `default[]` postfix expression can be also used to set an array value by its index: ```cs property CDocBuilderValue^ default[int] diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/SetProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/SetProperty/index.md index b348b7e4b..deb7a56cd 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/SetProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/SetProperty/index.md @@ -1,15 +1,45 @@ -`void SetProperty(sName, sValue);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: SetProperty} +- {type: text, text: (} +- {type: parameter, text: sName} +- {type: text, text: ": "} +- {type: type, text: String^} +- {type: text, text: ", "} +- {type: parameter, text: sValue} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} +- {type: text, text: )} +``` + +## Description -Sets a property to the **CDocBuilderValue** object. +Sets a property to the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.SetProperty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.SetProperty` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ----------------- | ------------------------------------------------------ | -| *sName* | String^ | The name of the **CDocBuilderValue** object property. | -| *sValue* | CDocBuilderValue^ | The value of the **CDocBuilderValue** object property. | + + +- sName + + ```yml signature.variant="inline" + - {type: type, text: String^} + ``` + + - : The name of the `CDocBuilderValue` object property. + +- sValue + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue^}} + ``` + + - : The value of the `CDocBuilderValue` object property. + + ## Example @@ -27,9 +57,9 @@ oDocument.SetProperty("color", {"zX":{"red":112,"green":173,"blue":71,"alpha":25 CDocBuilder.Destroy(); ``` -There are two more ways to set a property to the **CDocBuilderValue** object: +There are two more ways to set a property to the `CDocBuilderValue` object: -1. use the **Set** method that takes the object property name and value as arguments: +1. use the `Set` method that takes the object property name and value as arguments: ```cs void Set(String^ name, CDocBuilderValue^ value); @@ -51,7 +81,7 @@ There are two more ways to set a property to the **CDocBuilderValue** object: CDocBuilder.Destroy(); ``` -2. use the **default\[]** postfix expression: +2. use the `default[]` postfix expression: ```cs property CDocBuilderValue^ default[String^] diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToBool/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToBool/index.md index fbbb00c5a..d9c700172 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToBool/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToBool/index.md @@ -1,8 +1,16 @@ -`bool ToBool();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: ToBool} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a boolean value. +Converts the `CDocBuilderValue` object to a boolean value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToBool* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToBool` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToDouble/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToDouble/index.md index c4323b677..8e49d142c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToDouble/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToDouble/index.md @@ -1,8 +1,16 @@ -`double ToDouble();` +```yml signature +- {type: type, text: double} +- {type: text, text: " "} +- {type: entity, text: ToDouble} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a double value. +Converts the `CDocBuilderValue` object to a double value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToDouble* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToDouble` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToInt/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToInt/index.md index a835c0975..2a5142d53 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToInt/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToInt/index.md @@ -1,8 +1,16 @@ -`int ToInt();` +```yml signature +- {type: type, text: int} +- {type: text, text: " "} +- {type: entity, text: ToInt} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to an integer. +Converts the `CDocBuilderValue` object to an integer. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToInt* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToInt` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToString/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToString/index.md index 4a44f1120..e1c774b81 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToString/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/ToString/index.md @@ -1,8 +1,17 @@ -`String^ ToString() override;` +```yml signature +- {type: type, text: String^} +- {type: text, text: " "} +- {type: entity, text: ToString} +- {type: text, text: (} +- {type: text, text: )} +- {type: keyword, text: " override"} +``` + +## Description -Converts the **CDocBuilderValue** object to a string. +Converts the `CDocBuilderValue` object to a string. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToString* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToString` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/index.md index 30c8749c9..b164309af 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/CDocBuilderValue/index.md @@ -1,8 +1,14 @@ -`new CDocBuilderValue` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderValue} +``` + +## Description -Class used by **ONLYOFFICE Document Builder** for getting the results of called JS commands. It represents a wrapper for a JS object. +Class used by ONLYOFFICE Document Builder for getting the results of called JS commands. It represents a wrapper for a JS object. -The **CDocBuilderValue** class can be created from the primitive data types: +The CDocBuilderValue class can be created from the primitive data types: ```cs CDocBuilderValue(bool value); @@ -12,31 +18,55 @@ CDocBuilderValue(double value); CDocBuilderValue(String^ value); ``` -## Methods + + +- [Call](Call/index.md) + - : Calls the specified Document Builder method. +- [Clear](Clear/index.md) + - : Clears the object. +- [CreateNull](CreateNull/index.md) + - : Creates a null value. +- [CreateUndefined](CreateUndefined/index.md) + - : Creates an undefined value. +- [Get](Get/index.md) + - : Returns an array value by its index. +- [GetLength](GetLength/index.md) + - : Returns the length if this object is an array/typed array. +- [GetProperty](GetProperty/index.md) + - : Returns a property of this object. +- [IsArray](IsArray/index.md) + - : Returns true if this object is an array. +- [IsBool](IsBool/index.md) + - : Returns true if this object is a boolean value. +- [IsDouble](IsDouble/index.md) + - : Returns true if this object is a double value. +- [IsEmpty](IsEmpty/index.md) + - : Returns true if this object is empty. +- [IsFunction](IsFunction/index.md) + - : Returns true if this object is a function. +- [IsInt](IsInt/index.md) + - : Returns true if this object is an integer. +- [IsNull](IsNull/index.md) + - : Returns true if this object is null +- [IsObject](IsObject/index.md) + - : Returns true if this object is an object. +- [IsString](IsString/index.md) + - : Returns true if this object is a string. +- [IsTypedArray](IsTypedArray/index.md) + - : Returns true if this object is a typed array. +- [IsUndefined](IsUndefined/index.md) + - : Returns true if this object is undefined. +- [Set](Set/index.md) + - : Sets an array value by its index. +- [SetProperty](SetProperty/index.md) + - : Sets a property to this object. +- [ToBool](ToBool/index.md) + - : Converts this object to a boolean value. +- [ToDouble](ToDouble/index.md) + - : Converts this object to a double value. +- [ToInt](ToInt/index.md) + - : Converts this object to an integer. +- [ToString](ToString/index.md) + - : Converts this object to a string. -| Name | Description | -| ------------------------------------------- | ---------------------------------------------------------- | -| [Call](Call/index.md) | Calls the specified Document Builder method. | -| [Clear](Clear/index.md) | Clears the object. | -| [CreateNull](CreateNull/index.md) | Creates a null value. | -| [CreateUndefined](CreateUndefined/index.md) | Creates an undefined value. | -| [Get](Get/index.md) | Returns an array value by its index. | -| [GetLength](GetLength/index.md) | Returns the length if this object is an array/typed array. | -| [GetProperty](GetProperty/index.md) | Returns a property of this object. | -| [IsArray](IsArray/index.md) | Returns true if this object is an array. | -| [IsBool](IsBool/index.md) | Returns true if this object is a boolean value. | -| [IsDouble](IsDouble/index.md) | Returns true if this object is a double value. | -| [IsEmpty](IsEmpty/index.md) | Returns true if this object is empty. | -| [IsFunction](IsFunction/index.md) | Returns true if this object is a function. | -| [IsInt](IsInt/index.md) | Returns true if this object is an integer. | -| [IsNull](IsNull/index.md) | Returns true if this object is null. | -| [IsObject](IsObject/index.md) | Returns true if this object is an object. | -| [IsString](IsString/index.md) | Returns true if this object is a string. | -| [IsTypedArray](IsTypedArray/index.md) | Returns true if this object is a typed array. | -| [IsUndefined](IsUndefined/index.md) | Returns true if this object is undefined. | -| [Set](Set/index.md) | Sets an array value by its index. | -| [SetProperty](SetProperty/index.md) | Sets a property to this object. | -| [ToBool](ToBool/index.md) | Converts this object to a boolean value. | -| [ToDouble](ToDouble/index.md) | Converts this object to a double value. | -| [ToInt](ToInt/index.md) | Converts this object to an integer. | -| [ToString](ToString/index.md) | Converts this object to a string. | + diff --git a/site/pages/Docs/Document Builder/Builder Framework/.Net/index.md b/site/pages/Docs/Document Builder/Builder Framework/.Net/index.md index 6cf0e75ea..df4c64765 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/.Net/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/.Net/index.md @@ -2,13 +2,24 @@ order: -3 --- -For the integration of **ONLYOFFICE Document Builder** into any application, the .Net **doctrenderer** library is used. The current application version contains five main classes: +For the integration of ONLYOFFICE Document Builder into any application, the .Net doctrenderer library is used. -- *CDoctrenderer* class - used by **ONLYOFFICE Document Builder** in the file conversion process. -- [CDocBuilder](CDocBuilder/index.md) class - used by **ONLYOFFICE Document Builder** for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. -- [CDocBuilderValue](CDocBuilderValue/index.md) class - used by **ONLYOFFICE Document Builder** for getting the results of called JS commands. It represents a wrapper for a JS object. -- [CDocBuilderContextScope](CDocBuilderContextScope/index.md) class - the stack-allocated class which sets the execution context for all operations executed within a local scope. -- [CDocBuilderContext](CDocBuilderContext/index.md) class - used by **ONLYOFFICE Document Builder** for getting JS context for working. +## Classes + +The current application version contains four main classes: + + + +- [CDocBuilder](CDocBuilder/index.md) + - : Used by ONLYOFFICE Document Builder for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. +- [CDocBuilderContext](CDocBuilderContext/index.md) + - : Used by ONLYOFFICE Document Builder for getting JS context for working. +- [CDocBuilderContextScope](CDocBuilderContextScope/index.md) + - : The stack-allocated class which sets the execution context for all operations executed within a local scope. +- [CDocBuilderValue](CDocBuilderValue/index.md) + - : Used by ONLYOFFICE Document Builder for getting the results of called JS commands. It represents a wrapper for a JS object. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/.Net samples guide/index.md b/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/.Net samples guide/index.md index 02dc0bf39..b3bf91bf8 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/.Net samples guide/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/.Net samples guide/index.md @@ -1,65 +1,135 @@ --- -order: -1 +order: -3 --- ## Before you start For the samples to work correctly, make sure that two conditions are met: -1. [ONLYOFFICE Document Builder](https://www.onlyoffice.com/download-builder.aspx?utm_source=api) is installed into default directory **"C:/Program Files/ONLYOFFICE/DocumentBuilder"** on your computer. -2. **The directory** in which you are going to store the downloaded samples **has general editing access** to save files created by the Document Builder. +1. [ONLYOFFICE Document Builder](https://www.onlyoffice.com/download-builder.aspx?utm_source=api) is installed into default directory `C:/Program Files/ONLYOFFICE/DocumentBuilder` on your computer. +2. The directory in which you are going to store the downloaded samples has general editing access to save files created by the Document Builder. -## Download a sample +## Download samples -Download one of the Builder .Net samples and copy it into a folder with general editing access. +Clone a repository with the Document Builder samples from [https://github.com/ONLYOFFICE/document-builder-samples](https://github.com/ONLYOFFICE/document-builder-samples). The created folder must have general editing access. -- [Filling spreadsheet](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/FillingSpreadsheet/FillingSpreadsheet/Program.cs) -- [Commenting spreadsheet errors](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/CommentingErrors/CommentingErrors/Program.cs) -- [Creating presentation](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/CreatingPresentation/CreatingPresentation/Program.cs) -- [Creating chart presentation](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/CreatingChartPresentation/CreatingChartPresentation/Program.cs) -- [Creating basic form](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/CreatingBasicForm/CreatingBasicForm/Program.cs) -- [Creating advanced form](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/CreatingAdvancedForm/CreatingAdvancedForm/Program.cs) -- [Filling form](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/FillingForm/FillingForm/Program.cs) +The project folder includes the `cs` folder with the C# samples. Each sample has its own folder with the `Program.cs` program file. -## Sample structure +## Program structure -![C# Builder sample structure](/assets/images/docbuilder/csharp/sample_structure.png) +To create the [C# sample](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cs/commenting_errors/Program.cs): -Each sample includes a **code folder**, an **sln file**, and a **template file** if the sample uses a template.\ -The code folder consists of two files: a **project file** and a **program file**. +1. Include the [.Net wrapper](../../.Net/index.md) doctrenderer library: -![C# Builder project file](/assets/images/docbuilder/csharp/project_file.png) + ```cs + using docbuilder_net; -Please note that the **path to the DocBuilder .dll file in the project file is set to default**. Here you can change the path if DocBuilder is located in a different directory on your computer. + using OfficeFileTypes = docbuilder_net.FileTypes; + using CValue = docbuilder_net.CDocBuilderValue; + using CContext = docbuilder_net.CDocBuilderContext; + using CContextScope = docbuilder_net.CDocBuilderContextScope; + ``` -## Program structure +2. Specify the path to the Document Builder work directory, the result path (where the generated file will be saved), and the optional file path (if a template file will be used): + + ```cs + string workDirectory = Constants.BUILDER_DIR; + string resultPath = "../../../result.xlsx"; + string filePath = "../../../../../../resources/docs/spreadsheet_with_errors.xlsx"; + ``` + +3. Add the `.dll` files to the environment: + + ```cs + System.Environment.SetEnvironmentVariable("PATH", System.Environment.GetEnvironmentVariable("PATH") + ";" + workDirectory); + ``` + +4. Create and call the builder function (this function is created by user and calls the DocBuilder method to work with documents): + + ```cs + CommentErrors(workDirectory, resultPath, filePath); + + public static void CommentErrors(string workDirectory, string resultPath, string filePath) {} + ``` + +- [Initialize](../../.Net/CDocBuilder/Initialize/index.md) the [DocBuilder](../../.Net/CDocBuilder/index.md) from the working directory: + + ```cs + // Init DocBuilder + CDocBuilder.Initialize(workDirectory); + CDocBuilder oBuilder = new CDocBuilder(); + ``` + +- Open or create a file so that [Context](../../.Net/CDocBuilderContext/index.md), [Scope](../../.Net/CDocBuilderContext/CreateScope/index.md) and [Global](../../.Net/CDocBuilderContext/GetGlobal/index.md) classes can be accessed: -![C# Builder program file](/assets/images/docbuilder/csharp/program_file.png) + ```cpp + // Open file and get context + oBuilder.OpenFile(filePath, "xlsx"); + CContext oContext = oBuilder.GetContext(); + CContextScope oScope = oContext.CreateScope(); + CValue oGlobal = oContext.GetGlobal(); + CValue oApi = oGlobal["Api"]; + ``` -- Include doctrenderer library [.Net wrapper](../../.Net/index.md) classes. -- Specify the paths to the Document Builder **work directory**, the **result path** (where the generated file will be saved), and the optional **file path** (if a template file will be used). -- Add **.dll** files to the environment. -- Call the **builder function** (this function is created by user and calls the DocBuilder method to work with documents). +- Edit file using Document Builder API methods. Use the [Call](../../.Net/CDocBuilderValue/Call/index.md) method with the name and parameters of the API method you call as arguments: -![C# Builder builder function](/assets/images/docbuilder/csharp/builder_function.png) + ```cpp + // Find and comment formula errors + CValue oWorksheet = oApi.Call("GetActiveSheet"); + CValue oRange = oWorksheet.Call("GetUsedRange"); + var data = oRange.Call("GetValue"); -- [Initialize](../../.Net/CDocBuilder/Initialize/index.md) the [DocBuilder](../../.Net/CDocBuilder/index.md) from the working directory. After that Builder opens or creates a file so that [Context](../../.Net/CDocBuilderContext/index.md), [Scope](../../.Net/CDocBuilderContext/CreateScope/index.md) and [Global](../../.Net/CDocBuilderContext/GetGlobal/index.md) classes can be accessed. -- Edit file using DocBuilder API methods. Use [Call](../../.Net/CDocBuilderValue/Call/index.md) method with the name and params of the API method you call as an arguments. -- [Save](../../.Net/CDocBuilder/SaveFile/index.md) and [close](../../.Net/CDocBuilder/CloseFile/index.md) file after editing, then call the [Destroy](../../.Net/CDocBuilder/Destroy/index.md) method to destroy DocBuilder. + for (int row = 0; row < data.GetLength(); row++) + { + for (int col = 0; col < data[0].GetLength(); col++) + { + CheckCell(oWorksheet, data[row][col].ToString(), row, col); + } + } + ``` + +- [Save](../../.Net/CDocBuilder/SaveFile/index.md) and [close](../../.Net/CDocBuilder/CloseFile/index.md) file after editing, then call the [Destroy](../../.Net/CDocBuilder/Destroy/index.md) method to destroy DocBuilder: + + ```cpp + // Save file and close DocBuilder + oBuilder.SaveFile(doctype, resultPath); + oBuilder.CloseFile(); + CDocBuilder.Destroy(); + ``` ## Run the sample -Open .sln file inside the sample folder to build the project.\ -Run the program when the project is built. +> Available only on Windows with Visual Studio and .NET SDK installed. + +To run the C# code samples, use the `configure/configure.py` python script which is able to generate the [Visual Studio project files](#visual-studio). + +To use `configure.py`, specify the following options: + +1. Type of project files to generate: `--vs`. In case you do not provide the type, all available projects will be generated. + +2. Test samples with `--test TEST`. Some available options: + + - `--test all` – generate projects for all samples; + - `--test cs` – generate projects only for C# samples; + - `--test cs/creating_basic_form` – generate only the project for the specified sample. + + Several test options are available at the same time. To see all available `TEST` options call `configure.py -l`. + +3. Directory to the Document Builder with `--dir DIR`. If Document Builder is not installed in the default path, you have to provide a path to it. + +The generated files will be located in the `out` directory inside the corresponding test folders. -![Visual Studio build and run sample](/assets/images/docbuilder/csharp/build_and_run.png) +### Visual Studio -## Check the result +1. Use `configure.py` to generate VS project files. For example: -After program execution the result file will be saved to the **result path**. It's sample folder root by default. + ```sh + cd ../document-builder-samples/configure + python configure.py --vs --test cs/creating_advanced_form + ``` -![C# Builder sample structure result file](/assets/images/docbuilder/csharp/sample_structure_after.png) ![C# Builder sample folder result file](/assets/images/docbuilder/csharp/folder_root_after.png) +1. Open the `document-builder-samples/out/cpp/creating_advanced_form` directory and run the `.sln` file in Visual Studio. Depending on the installed .NET SDK version, you may need to set a different target framework by specifying it in the Visual Studio project properties or editing it directly in the `.csproj` file. -Open **result file** and check the result. +2. The solution is ready to be built and run. Documents will be created in the project files directory. -![C# Builder result file](/assets/images/docbuilder/csharp/result_file.png) + ![Result file](/assets/images/docbuilder/cs-result-file.png) diff --git a/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/C++ samples guide/index.md b/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/C++ samples guide/index.md index ad9b3a53e..97e143f62 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/C++ samples guide/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/C++ samples guide/index.md @@ -1,64 +1,162 @@ --- -order: -2 +order: -4 --- ## Before you start For the samples to work correctly, make sure that two conditions are met: -1. [ONLYOFFICE Document Builder](https://www.onlyoffice.com/download-builder.aspx?utm_source=api) is installed into default directory **"C:/Program Files/ONLYOFFICE/DocumentBuilder"** on your computer. -2. **The directory** in which you are going to store the downloaded samples **has general editing access** to save files created by the Document Builder. +1. [ONLYOFFICE Document Builder](https://www.onlyoffice.com/download-builder.aspx?utm_source=api) is installed into default directory `C:/Program Files/ONLYOFFICE/DocumentBuilder` on your computer. +2. The directory in which you are going to store the downloaded samples has general editing access to save files created by the Document Builder. -## Download a sample +## Download samples -Download one of the Builder C++ samples and copy it into a folder with general editing access. +Clone a repository with the Document Builder samples from [https://github.com/ONLYOFFICE/document-builder-samples](https://github.com/ONLYOFFICE/document-builder-samples). The created folder must have general editing access. -- [Filling spreadsheet](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/FillingSpreadsheet/FillingSpreadsheet/FillingSpreadsheet.cpp) -- [Commenting spreadsheet errors](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/CommentingErrors/CommentingErrors/CommentingErrors.cpp) -- [Creating presentation](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/CreatingPresentation/CreatingPresentation/CreatingPresentation.cpp) -- [Creating chart presentation](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/CreatingChartPresentation/CreatingChartPresentation/CreatingChartPresentation.cpp) -- [Creating basic form](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/CreatingBasicForm/CreateBasicForm/CreateBasicForm.cpp) -- [Creating advanced form](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/CreatingAdvancedForm/CreateAdvancedForm/CreateAdvancedForm.cpp) -- [Filling form](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/FillingForm/FillForm/FillForm.cpp) +The project folder includes the `cpp` folder with the C++ samples. Each sample has its own folder with the `main.cpp` program file. -## Sample structure +## Program structure -![C++ Builder sample structure](/assets/images/docbuilder/cpp/sample_structure.png) +To create the [C++ sample](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/commenting_errors/main.cpp): + +1. Include the [C++ wrapper](../../C++/index.md) doctrenderer library: + + ```cpp + #include "common.h" + #include "docbuilder.h" + ``` + +2. Specify the path to the Document Builder work directory and the result path (where the generated file will be saved): + + ```cpp + const wchar_t* workDir = BUILDER_DIR; + const wchar_t* resultPath = L"result.xlsx"; + ``` + +3. Create the main function (this function works with the DocBuilder methods to edit documents): + + ```cpp + int main(){ } + ``` + +- [Initialize](../../C++/CDocBuilder/Initialize/index.md) the [DocBuilder](../../C++/CDocBuilder/index.md) from the working directory: + + ```cpp + // Init DocBuilder + CDocBuilder::Initialize(workDir); + CDocBuilder oBuilder; + oBuilder.SetProperty("--work-directory", workDir); + ``` + +- Open or create a file so that [Context](../../C++/CDocBuilderContext/index.md), [Scope](../../C++/CDocBuilderContext/CreateScope/index.md) and [Global](../../C++/CDocBuilderContext/GetGlobal/index.md) classes can be accessed: + + ```cpp + // Open file and get context + wstring templatePath = NSUtils::GetResourcesDirectory() + L"/docs/spreadsheet_with_errors.xlsx"; + oBuilder.OpenFile(templatePath.c_str(), L""); + CContext oContext = oBuilder.GetContext(); + CContextScope oScope = oContext.CreateScope(); + CValue oGlobal = oContext.GetGlobal(); + CValue oApi = oGlobal["Api"]; + ``` + +- Edit file using Document Builder API methods. Use the [Call](../../C++/CDocBuilderValue/Call/index.md) method with the name and parameters of the API method you call as arguments: + + ```cpp + // Find and comment formula errors + CValue oWorksheet = oApi.Call("GetActiveSheet"); + CValue oRange = oWorksheet.Call("GetUsedRange"); + CValue data = oRange.Call("GetValue"); + + for (int row = 0; row < (int)data.GetLength(); row++) + { + for (int col = 0; col < (int)data[0].GetLength(); col++) + { + CheckCell(oWorksheet, data[row][col].ToString().c_str(), row, col); + } + } + ``` + +- [Save](../../C++/CDocBuilder/SaveFile/index.md) and [close](../../C++/CDocBuilder/CloseFile/index.md) file after editing, then call the [Dispose](../../C++/CDocBuilder/Dispose/index.md) method to destroy DocBuilder: + + ```cpp + // Save and close + oBuilder.SaveFile(OFFICESTUDIO_FILE_SPREADSHEET_XLSX, resultPath); + oBuilder.CloseFile(); + CDocBuilder::Dispose(); + return 0; + ``` -Each sample includes a **code folder**, an **sln file**, and a **template file** if the sample uses a template.\ -The code folder consists of a **C++ program file** and **project files**. +## Run the sample -![C++ Builder project file](/assets/images/docbuilder/cpp/project_file.png) +To run the C++ code samples, use the `configure/configure.py` python script which is able to generate: -Please note that the **path to the DocBuilder .dll file in the project file is set to default**. You can change the path in the **Sample.vcxproj.user** file if DocBuilder is located in a different directory on your computer. +- [Visual Studio project files](#visual-studio); +- [Qt project files](#qt); +- [Makefile](#makefile). -## Program structure +To use `configure.py`, specify the following options: -![C# Builder program file](/assets/images/docbuilder/cpp/program_file.png) +1. Type of project files to generate: `--vs`, `--qt` or `--make`. Several options are available at the same time, but some of them are not supported on all platforms. In case you provide none of these options, all available projects will be generated. -- Include doctrenderer library [C++ wrapper](../../C++/index.md) -- Specify the paths to the Document Builder **work directory**, the **result path** (where the generated file will be saved), and the optional **template path** (if a template file will be used). -- Create the **main function** (this function works with the DocBuilder methods to edit documents). +2. Test samples with `--test TEST`. Some available options: -![C# Builder builder function](/assets/images/docbuilder/cpp/builder_function.png) + - `--test all` – generate projects for all samples; + - `--test cpp` – generate projects only for C++ samples; + - `--test cpp/creating_basic_form` – generate only the project for the specified sample. -- [Initialize](../../C++/CDocBuilder/Initialize/index.md) the [DocBuilder](../../C++/CDocBuilder/index.md) from the working directory. After that Builder opens or creates a file so that [Context](../../C++/CDocBuilderContext/index.md), [Scope](../../C++/CDocBuilderContext/CreateScope/index.md) and [Global](../../C++/CDocBuilderContext/GetGlobal/index.md) classes can be accessed. -- Edit file using DocBuilder API methods. Use [Call](../../C++/CDocBuilderValue/Call/index.md) method with the name and params of the API method you call as an arguments. -- [Save](../../C++/CDocBuilder/SaveFile/index.md) and [close](../../C++/CDocBuilder/CloseFile/index.md) file after editing, then call the [Dispose](../../C++/CDocBuilder/Dispose/index.md) method to destroy DocBuilder. + Several test options are available at the same time. To see all available `TEST` options call `configure.py -l`. -## Run the sample +3. Directory to the Document Builder with `--dir DIR`. If Document Builder is not installed in the default path, you have to provide a path to it. + +The generated files will be located in the `out` directory inside the corresponding test folders. + +### Visual Studio + +> Available only on Windows. + +1. Use `configure.py` to generate VS project files. For example: + + ```sh + cd ../document-builder-samples/configure + python configure.py --vs --test cpp/creating_advanced_form + ``` + +2. Open the `document-builder-samples/out/cpp/creating_advanced_form` directory and run the `.sln` file in Visual Studio. It will prompt you to retarget Windows SDK and VS toolset to your installed version. Click **OK**. + + ![Retarget projects](/assets/images/docbuilder/retarget-projects.png) + +3. The solution is ready to be built and run. Documents will be created in the project files directory. + + ![Result file](/assets/images/docbuilder/cpp-result-file.png) + +### Qt + +1. Use `configure.py` to generate Qt project files. For example: + + ```sh + cd ../document-builder-samples/configure + python configure.py --qt --test cpp/creating_advanced_form + ``` + +2. Open the `document-builder-samples/out/cpp/creating_advanced_form` directory and run the `.pro` file in Qt Creator. +3. The project is ready to be built and run. Documents will be created in the build directory. -Open .sln file inside the sample folder to build the project.\ -Run the program when the project is built. +### Makefile -![Visual Studio build and run sample](/assets/images/docbuilder/cpp/build_and_run.png) +> Available only on Linux and macOS. -## Check the result +1. Use `configure.py` to generate Makefile. For example: -After program execution the result file will be saved to the **result path**. It's sample folder root by default. + ```sh + cd ../document-builder-samples/configure + python configure.py --make --test cpp/creating_advanced_form + ``` -![C# Builder sample structure result file](/assets/images/docbuilder/cpp/sample_structure_after.png) ![C# Builder sample folder result file](/assets/images/docbuilder/cpp/folder_root_after.png) +2. Go to the directory with generated Makefile: -Open **result file** and check the result. + ```sh + cd ../out/cpp/creating_advanced_form + ``` -![C# Builder result file](/assets/images/docbuilder/csharp/result_file.png) +3. Call `make`, which will build and run the executable. Documents will be created in the same directory as Makefile. diff --git a/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/Java samples guide/index.md b/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/Java samples guide/index.md new file mode 100644 index 000000000..7617054f0 --- /dev/null +++ b/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/Java samples guide/index.md @@ -0,0 +1,124 @@ +--- +order: -1 +--- + +## Before you start + +For the samples to work correctly, make sure that two conditions are met: + +1. [ONLYOFFICE Document Builder](https://www.onlyoffice.com/download-builder.aspx?utm_source=api) is installed into default directory `C:/Program Files/ONLYOFFICE/DocumentBuilder` on your computer. +2. The directory in which you are going to store the downloaded samples has general editing access to save files created by the Document Builder. + +## Download samples + +Clone a repository with the Document Builder samples from [https://github.com/ONLYOFFICE/document-builder-samples](https://github.com/ONLYOFFICE/document-builder-samples). The created folder must have general editing access. + +The project folder includes the `java` folder with the Java samples. Each sample has its own folder with the `Program.java` program file. + +## Program structure + +To create the [Java sample](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/java/creating_basic_form/Program.java): + +1. Include the [Java wrapper](../../Java/index.md) doctrenderer library: + + ```java + import docbuilder.*; + ``` + +2. Specify the result path (where the generated file will be saved): + + ```java + String resultPath = "result.docx"; + ``` + +3. Create and call the builder function (this function is created by user and calls the DocBuilder method to work with documents): + + ```java + public static void createBasicForm(String resultPath) {} + ``` + +- [Initialize](../../Java/CDocBuilder/initialize/index.md) the [DocBuilder](../../Java/CDocBuilder/index.md) with `docbuilder.jar` directory by passing an empty string: + + ```java + // Initialize builder with docbuilder.jar directory by passing an empty string + CDocBuilder.initialize(""); + CDocBuilder builder = new CDocBuilder(); + ``` + +- Open or create a file so that [Context](../../Java/CDocBuilderContext/index.md) and [Global](../../Java/CDocBuilderContext/getGlobal/index.md) classes can be accessed: + + ```java + // Create file and get context + builder.createFile(doctype); + CDocBuilderContext context = builder.getContext(); + CDocBuilderValue global = context.getGlobal(); + CDocBuilderValue api = global.get("Api"); + ``` + +- Edit file using the Document Builder API methods. Use the [call](../../Java/CDocBuilderValue/call/index.md) method with the name and parameters of the API method you call as arguments: + + ```java + // Create basic form + CDocBuilderValue document = api.call("GetDocument"); + CDocBuilderValue paragraph = document.call("GetElement", 0); + CDocBuilderValue headingStyle = document.call("GetStyle", "Heading 3"); + + paragraph.call("AddText", "Employee pass card"); + paragraph.call("SetStyle", headingStyle); + document.call("Push", paragraph); + + CDocBuilderValue pictureForm = api.call("CreatePictureForm"); + setPictureFormProperties(pictureForm, "Photo", "Upload your photo", false, "Photo", "tooBig", true, false, 50, 50); + paragraph = api.call("CreateParagraph"); + paragraph.call("AddElement", pictureForm); + document.call("Push", paragraph); + + CDocBuilderValue textForm = api.call("CreateTextForm"); + setTextFormProperties(textForm, "First name", "Enter your first name", false, "First name", true, 13, 3, false, false); + paragraph = api.call("CreateParagraph"); + paragraph.call("AddElement", textForm); + document.call("Push", paragraph); + ``` + +- [Save](../../Java/CDocBuilder/saveFile/index.md) and [close](../../Java/CDocBuilder/closeFile/index.md) file after editing, then call the [dispose](../../Java/CDocBuilder/dispose/index.md) method to destroy DocBuilder: + + ```cpp + // Save file and close DocBuilder + builder.saveFile(doctype, resultPath); + builder.closeFile(); + CDocBuilder.dispose(); + ``` + +## Run the sample + +> JDK 8 or newer is required. + +To run the Java code samples: + +1. Go to the test directory: + + ```sh + cd ../document-builder-samples/java/creating_presentation + ``` + +2. Compile the `Program.java` providing the path to `docbuilder.jar` located in the Document Builder directory: + + ```sh + javac -cp "C:\Program Files\ONLYOFFICE\DocumentBuilder\docbuilder.jar" Program.java + ``` + +3. The `.class` file should appear in the directory. Run the program: + + ```sh + java -cp "C:\Program Files\ONLYOFFICE\DocumentBuilder\docbuilder.jar;." Program + ``` + + Note, that on UNIX systems the path separator is `:` instead of `;`. Thus, on Linux or macOS it should be: + + ```sh + java -cp "/opt/onlyoffice/documentbuilder/docbuilder.jar:." Program + ``` + + Documents will be created in the test directory. + +![Result file](/assets/images/docbuilder/java-result-file.png) diff --git a/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/Python samples guide/index.md b/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/Python samples guide/index.md new file mode 100644 index 000000000..0bce6ffbe --- /dev/null +++ b/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/Python samples guide/index.md @@ -0,0 +1,134 @@ +--- +order: -2 +--- + +## Before you start + +For the samples to work correctly, make sure that two conditions are met: + +1. [ONLYOFFICE Document Builder](https://www.onlyoffice.com/download-builder.aspx?utm_source=api) is installed into default directory `C:/Program Files/ONLYOFFICE/DocumentBuilder` on your computer. +2. The directory in which you are going to store the downloaded samples has general editing access to save files created by the Document Builder. + +## Download samples + +Clone a repository with the Document Builder samples from [https://github.com/ONLYOFFICE/document-builder-samples](https://github.com/ONLYOFFICE/document-builder-samples). The created folder must have general editing access. + +The project folder includes the `python` folder with the Python samples. Each sample has its own folder with the `main.py` program file. + +## Program structure + +To create the [Python sample](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/python/creating_basic_form/main.py): + +1. Include the [Python wrapper](../../Python/index.md) doctrenderer library: + + ```py + import docbuilder + ``` + +2. Specify the path to the Document Builder work directory and the result path (where the generated file will be saved): + + ```py + sys.path.append(constants.BUILDER_DIR) + sys.path.append('../../out/python') + resultPath = os.getcwd() + '/result.docx' + ``` + +3. Create and call the builder function (this function is created by user and calls the DocBuilder method to work with documents): + + ```py + if __name__ == '__main__': + ... + ``` + +- Specify the [DocBuilder](../../Python/CDocBuilder/index.md): + + ```py + builder = docbuilder.CDocBuilder() + ``` + +- Open or create a file so that [Context](../../Python/CDocBuilderContext/index.md) and [Global](../../Python/CDocBuilderContext/GetGlobal/index.md) classes can be accessed: + + ```py + # Create file and get context + builder.CreateFile(docbuilder.FileTypes.Document.DOCX) + + context = builder.GetContext() + globalObj = context.GetGlobal() + api = globalObj['Api'] + ``` + +- Edit file using Document Builder API methods. Use the [Call](../../Python/CDocBuilderValue/Call/index.md) method with the name and parameters of the API method you call as arguments: + + ```py + # Create basic form + document = api.Call('GetDocument') + paragraph = document.Call('GetElement', 0) + headingStyle = document.Call('GetStyle', 'Heading 3') + + paragraph.Call('AddText', 'Employee pass card') + paragraph.Call('SetStyle', headingStyle) + document.Call('Push', paragraph) + + pictureForm = api.Call('CreatePictureForm') + setPictureFormProperties(pictureForm, 'Photo', 'Upload your photo', False, 'Photo', 'tooBig', True, False, 50, 50) + paragraph = api.Call('CreateParagraph') + paragraph.Call('AddElement', pictureForm) + document.Call('Push', paragraph) + + textForm = api.Call('CreateTextForm') + setTextFormProperties(textForm, 'First name', 'Enter your first name', False, 'First name', True, 13, 3, False, False) + paragraph = api.Call('CreateParagraph') + paragraph.Call('AddElement', textForm) + document.Call('Push', paragraph) + ``` + +- [Save](../../Python/CDocBuilder/SaveFile/index.md) and [close](../../Python/CDocBuilder/CloseFile/index.md) file after editing: + + ```py + # Save file and close DocBuilder + builder.SaveFile(docbuilder.FileTypes.Document.DOCX, resultPath) + builder.CloseFile() + ``` + +## Run the sample + +To run the Python code samples, use the `configure/configure.py` python script. + +To use `configure.py`, specify the following options: + +1. Test samples with `--test TEST`. Some available options: + + - `--test all` – generate projects for all samples; + - `--test python` – generate projects only for Python samples; + - `--test python/creating_basic_form` – generate only the project for the specified sample. + + Several test options are available at the same time. To see all available `TEST` options call `configure.py -l`. + +2. Directory to the Document Builder with `--dir DIR`. If Document Builder is not installed in the default path, you have to provide a path to it. + +To run the Python sample: + +1. Execute `configure.py` with `--test python/creating_basic_form`: + + ```sh + cd ../document-builder-samples/configure + python configure.py --test python/creating_basic_form + ``` + + Provide a directory to the Document Builder with `--dir` if necessary to generate an auxiliary module containing the path to the Document Builder. + +2. Go to the test directory: + + ```sh + cd python/creating_basic_form + ``` + +3. Run the script: + + ```sh + python main.py + ``` + + Documents will be created in the test directory. + +![Result file](/assets/images/docbuilder/python-result-file.png) diff --git a/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/index.md b/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/index.md index 3bbedb28b..e72fd6106 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Builder framework samples/index.md @@ -2,47 +2,47 @@ order: -1 --- -Use the guides for [C++](C++%20samples%20guide/index.md) and [.Net](.Net%20samples%20guide/index.md) to run the samples. +Use the guides for [C++](C++%20samples%20guide/index.md), [.Net](.Net%20samples%20guide/index.md), [Python](Python%20samples%20guide/index.md), and [Java](Java%20samples%20guide/index.md) to run the samples. ## Filling spreadsheet Fills spreadsheet with array-based values. -See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/FillingSpreadsheet/FillingSpreadsheet/FillingSpreadsheet.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/FillingSpreadsheet/FillingSpreadsheet/Program.cs) +See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/filling_spreadsheet/main.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cs/filling_spreadsheet/Program.cs) / [Python](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/python/filling_spreadsheet/main.py) / [Java](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/java/filling_spreadsheet/Program.java) ## Commenting spreadsheet errors Comments spreadsheet cells with formula errors. -See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/CommentingErrors/CommentingErrors/CommentingErrors.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/CommentingErrors/CommentingErrors/Program.cs) +See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/commenting_errors/main.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cs/commenting_errors/Program.cs) ## Creating presentation Creates presentation with multiple slides, images and text. -See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/CreatingPresentation/CreatingPresentation/CreatingPresentation.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/CreatingPresentation/CreatingPresentation/Program.cs) +See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/creating_presentation/main.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cs/creating_presentation/Program.cs) / [Python](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/python/creating_presentation/main.py) / [Java](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/java/creating_presentation/Program.java) ## Creating chart presentation Creates single-slide chart presentation. -See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/CreatingChartPresentation/CreatingChartPresentation/CreatingChartPresentation.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/CreatingChartPresentation/CreatingChartPresentation/Program.cs) +See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/creating_chart_presentation/main.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cs/creating_chart_presentation/Program.cs) ## Creating basic form Creates basic form with text and image inputs. -See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/CreatingBasicForm/CreateBasicForm/CreateBasicForm.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/CreatingBasicForm/CreatingBasicForm/Program.cs) +See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/creating_basic_form/main.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cs/creating_basic_form/Program.cs) / [Python](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/python/creating_basic_form/main.py) / [Java](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/java/creating_basic_form/Program.java) ## Creating advanced form Creates advanced form with table structure. -See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/CreatingAdvancedForm/CreateAdvancedForm/CreateAdvancedForm.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/CreatingAdvancedForm/CreatingAdvancedForm/Program.cs) +See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/creating_advanced_form/main.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cs/creating_advanced_form/Program.cs) ## Filling form Fills form with text values and image. -See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/FillingForm/FillForm/FillForm.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/csharp/FillingForm/FillingForm/Program.cs) +See: [C++](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cpp/filling_form/main.cpp) / [.Net](https://github.com/ONLYOFFICE/document-builder-samples/blob/master/cs/filling_form/Program.cs) diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/CloseFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/CloseFile/index.md index 245b094a7..29199b176 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/CloseFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/CloseFile/index.md @@ -1,6 +1,14 @@ -`void CloseFile();` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: CloseFile} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Closes the file to stop working with it. You can use a single **ONLYOFFICE Document Builder** instance to work with all your files, but you need to close the previous file before you can start working with the next one in this case. +Closes the file to stop working with it. You can use a single ONLYOFFICE Document Builder instance to work with all your files, but you need to close the previous file before you can start working with the next one in this case. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/CreateFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/CreateFile/index.md index df15e9954..1cc146761 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/CreateFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/CreateFile/index.md @@ -1,12 +1,31 @@ -`bool CreateFile(nType);` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: CreateFile} +- {type: text, text: (} +- {type: parameter, text: sExtension} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: )} +``` + +## Description Creates a new file. The type of the file which will be created needs to be set. ## Parameters -| Name | Type | Description | -| ------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *sExtension* | const wchar\_t\* | The file extension. The following values are possible: **docx**, **xlsx**, **pptx**, or **pdf** (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). | + + +- sExtension + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The file extension. The following values are possible: `docx`, `xlsx`, `pptx`, or `pdf` (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/Dispose/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/Dispose/index.md index 613fbcc74..c908f90c6 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/Dispose/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/Dispose/index.md @@ -1,8 +1,18 @@ -`static void Dispose();` +```yml signature +- {type: keyword, text: static} +- {type: text, text: " "} +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: Dispose} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Unloads the **ONLYOFFICE Document Builder** from the application memory when it is no longer needed. Generally, there is no need to dispose JS before exiting the process, it should happen automatically. It should only be used if the process needs the resources taken up by JS. +Unloads the ONLYOFFICE Document Builder from the application memory when it is no longer needed. Generally, there is no need to dispose JS before exiting the process, it should happen automatically. It should only be used if the process needs the resources taken up by JS. -> Please note, that for the *.docbuilder* file the *CDocBuilder.Dispose* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.Dispose` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/ExecuteCommand/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/ExecuteCommand/index.md index bd60aa14e..a99ab2a7a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/ExecuteCommand/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/ExecuteCommand/index.md @@ -1,15 +1,47 @@ -`bool ExecuteCommand(sCommand, oRetValue = 0);` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: ExecuteCommand} +- {type: text, text: (} +- {type: parameter, text: sCommand} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: ", "} +- {type: parameter, text: oRetValue} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue*}} +- {type: text, text: " = "} +- {type: text, text: 0} +- {type: text, text: )} +``` + +## Description Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). See the [Text document API](../../../../../Office%20API/Usage%20API/Text%20Document%20API/index.md), [Spreadsheet API](../../../../../Office%20API/Usage%20API/Spreadsheet%20API/index.md), [Presentation API](../../../../../Office%20API/Usage%20API/Presentation%20API/index.md), or [Form API](../../../../../Office%20API/Usage%20API/Form%20API/index.md) sections for more information which commands are available for various document types. -Please note, that for the *.docbuilder* file the *CDocBuilder.ExecuteCommand* method is not used explicitly. The command itself is used instead. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilder.ExecuteCommand` method is not used explicitly. The command itself is used instead. See the example below. ## Parameters -| Name | Type | Description | -| ----------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- | -| *sCommand* | const wchar\_t\* | The command which will be used to create the document file (in C++, the escape character must be used when the command contains quotation symbols). | -| *oRetValue* | CDocBuilderValue\* | The command return value. | + + +- sCommand + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The command which will be used to create the document file (in C++, the escape character must be used when the command contains quotation symbols). + +- retValue, default: 0 + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue*}} + ``` + + - : The command return value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/GetContext/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/GetContext/index.md index aa46c9291..8fe5dfb25 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/GetContext/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/GetContext/index.md @@ -1,8 +1,16 @@ -`CDocBuilderContext GetContext();` +```yml signature +- {id: ../../CDocBuilderContext/index.md, token: {type: type, text: CDocBuilderContext}} +- {type: text, text: " "} +- {type: entity, text: GetContext} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Returns the current JS [context](../../CDocBuilderContext/index.md). -> Please note, that for the *.docbuilder* file the *CDocBuilder.GetContext* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.GetContext` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/GetVersion/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/GetVersion/index.md index 8181871da..82e674db2 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/GetVersion/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/GetVersion/index.md @@ -1,8 +1,16 @@ -`char* GetVersion();` +```yml signature +- {type: type, text: char*} +- {type: text, text: " "} +- {type: entity, text: GetVersion} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns the **ONLYOFFICE Document Builder** engine version. +Returns the ONLYOFFICE Document Builder engine version. -> Please note, that for the *.docbuilder* file the *CDocBuilder.GetVersion* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.GetVersion` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/Initialize/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/Initialize/index.md index d167a506e..5061de138 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/Initialize/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/Initialize/index.md @@ -1,14 +1,37 @@ -`static void Initialize(sDirectory=0);` +```yml signature +- {type: keyword, text: static} +- {type: text, text: " "} +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: Initialize} +- {type: text, text: (} +- {type: parameter, text: sDirectory} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: " = "} +- {type: text, text: 0} +- {type: text, text: )} +``` + +## Description -Initializes the **ONLYOFFICE Document Builder** as a library for the application to be able to work with it. This method just sets the directory to the main Document Builder resources (icu files, etc). If this method is not called, the Document Builder will find resources from the current process directory. +Initializes the ONLYOFFICE Document Builder as a library for the application to be able to work with it. This method just sets the directory to the main Document Builder resources (icu files, etc). If this method is not called, the Document Builder will find resources from the current process directory. -> Please note, that for the *.docbuilder* file the *CDocBuilder.Initialize* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.Initialize` method is not used. ## Parameters -| Name | Type | Description | -| ------------ | ---------------- | ------------------------------------------------ | -| *sDirectory* | const wchar\_t\* | The path to the main Document Builder resources. | + + +- sDirectory, default: 0 + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The path to the main Document Builder resources. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/IsSaveWithDoctrendererMode/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/IsSaveWithDoctrendererMode/index.md index 636c063bd..be2cc5c68 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/IsSaveWithDoctrendererMode/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/IsSaveWithDoctrendererMode/index.md @@ -1,8 +1,16 @@ -`bool IsSaveWithDoctrendererMode();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsSaveWithDoctrendererMode} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. -> Please note, that for the *.docbuilder* file the *CDocBuilder.IsSaveWithDoctrendererMode* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.IsSaveWithDoctrendererMode` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/OpenFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/OpenFile/index.md index 186518cb9..32c79843d 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/OpenFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/OpenFile/index.md @@ -1,13 +1,54 @@ -`int OpenFile(sPath, sParams);` +```yml signature +- {type: type, text: int} +- {type: text, text: " "} +- {type: entity, text: OpenFile} +- {type: text, text: (} +- {type: parameter, text: sPath} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: ", "} +- {type: parameter, text: sParams} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: )} +``` + +## Description Opens the document file which will be edited and saved afterwards. ## Parameters -| Name | Type | Attributes | Description | -| --------- | ---------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *sPath* | const wchar\_t\* | | The path to the file to be opened together with its name and extension. | -| *sParams* | const wchar\_t\* | \ | The parameters needed for the correct file opening (most commonly, the encoding is used for the *txt* and *csv* file types or the delimiter for the *csv* files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where **m\_nCsvTxtEncoding** is used for the text encoding and **m\_nCsvDelimiter** is used for the delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the *csv* delimiters include:

          **0** - no delimiter;

          **1** - tab;

          **2** - semicolon;

          **3** - colon;

          **4** - comma;

          **5** - space. | + + +- sPath + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : + + The path to the file to be opened together with its name and extension. + +- sParams + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : + + The parameters needed for the correct file opening (most commonly, the encoding is used for the `txt` and `csv` file types or the delimiter for the `csv` files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where `m_nCsvTxtEncoding` is used for the text encoding and `m_nCsvDelimiter` is used for the delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the `csv` delimiters include: + + - `0` - no delimiter; + - `1` - tab; + - `2` - semicolon; + - `3` - colon; + - `4` - comma; + - `5` - space. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/Run/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/Run/index.md index 8d290d2af..311af693f 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/Run/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/Run/index.md @@ -1,12 +1,31 @@ -`bool Run(sPath);` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: Run} +- {type: text, text: (} +- {type: parameter, text: sPath} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: )} +``` + +## Description -Runs the **ONLYOFFICE Document Builder** executable. If you do not want to write a C++ application, you can simply use the **docbuilder.exe** executable file and run it with the ### .docbuilder file as an argument, where all the code for the document file creation will be written. For C++, create the *CDocBuilder* object and call the *Run* method with the path to the executable file from the *sPath* parameter. +Runs the ONLYOFFICE Document Builder executable. If you do not want to write a C++ application, you can simply use the `docbuilder.exe` executable file and run it with the `.docbuilder` file as an argument, where all the code for the document file creation will be written. For C++, create the `CDocBuilder` object and call the `Run` method with the path to the executable file from the `sPath` parameter. ## Parameters -| Name | Type | Description | -| ------- | ---------------- | ----------------------------------------------------------- | -| *sPath* | const wchar\_t\* | The path to the **ONLYOFFICE Document Builder** executable. | + + +- sPath + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The path to the ONLYOFFICE Document Builder executable. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/RunTextA/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/RunTextA/index.md index 615755f41..7c2835830 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/RunTextA/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/RunTextA/index.md @@ -1,14 +1,31 @@ -`bool RunTextA(sCommands);` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: RunTextA} +- {type: text, text: (} +- {type: parameter, text: sCommands} +- {type: text, text: ": "} +- {type: type, text: const char*} +- {type: text, text: )} +``` -Runs all the commands for the document creation using a single command in the UTF8 format. Compared to [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) where only one command at a time is allowed, *CDocBuilder.RunTextA* makes it possible to enter all the commands for the document creation at once. +Runs all the commands for the document creation using a single command in the UTF8 format. Compared to [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) where only one command at a time is allowed, `CDocBuilder.RunTextA` makes it possible to enter all the commands for the document creation at once. -> Please note, that for the *.docbuilder* file the *CDocBuilder.RunTextA* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.RunTextA` method is not used. ## Parameters -| Name | Type | Description | -| ----------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *sCommands* | const char\* | The commands in the UTF8 format which will be used to create the document file (in C++, the escape character must be used when the command contains quotation symbols). All the commands containing *builder.* are line separated, i.e. you cannot write them in one line, each command **must** start with its own line. | + + +- sCommands + + ```yml signature.variant="inline" + - {type: type, text: const char*} + ``` + + - : The commands in the UTF8 format which will be used to create the document file (in C++, the escape character must be used when the command contains quotation symbols). All the commands containing `builder.` are line separated, i.e. you cannot write them in one line, each command must start with its own line. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/RunTextW/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/RunTextW/index.md index 333a2feeb..748e25dfa 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/RunTextW/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/RunTextW/index.md @@ -1,14 +1,33 @@ -`bool RunTextW(sCommands);` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: RunTextW} +- {type: text, text: (} +- {type: parameter, text: sCommands} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: )} +``` + +## Description -Runs all the commands for the document creation using a single command in the Unicode format. Compared to [CDocBuilder.ExecuteCommand](../Dispose/index.md) where only one command at a time is allowed, *CDocBuilder.RunTextW* makes it possible to enter all the commands for the document creation at once. +Runs all the commands for the document creation using a single command in the Unicode format. Compared to [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) where only one command at a time is allowed, `CDocBuilder.RunTextW` makes it possible to enter all the commands for the document creation at once. -> Please note, that for the *.docbuilder* file the *CDocBuilder.RunTextW* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.RunTextW` method is not used. ## Parameters -| Name | Type | Description | -| ----------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *sCommands* | const wchar\_t\* | The commands in the Unicode format which will be used to create the document file (in C++, the escape character must be used when the command contains quotation symbols). All the commands containing *builder.* are line separated, i.e. you cannot write them in one line, each command **must** start with its own line. | + + +- sCommands + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The commands in the Unicode format which will be used to create the document file (in C++, the escape character must be used when the command contains quotation symbols). All the commands containing `builder.` are line separated, i.e. you cannot write them in one line, each command must start with its own line. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SaveFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SaveFile/index.md index a709594a4..b2b58572b 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SaveFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SaveFile/index.md @@ -1,14 +1,70 @@ -`int SaveFile(nType, sPath, sParams);` +```yml signature +- {type: type, text: int} +- {type: text, text: " "} +- {type: entity, text: SaveFile} +- {type: text, text: (} +- {type: parameter, text: sExtension} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: ", "} +- {type: parameter, text: sPath} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: ", "} +- {type: parameter, text: sParams} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: )} +``` + +## Description Saves the file after all the changes are made. The type of the file which will be saved needs to be set. ## Parameters -| Name | Type | Description | -| ------------ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *sExtension* | const wchar\_t\* | The file extension. The following values are possible: **docx**, **odt**, **rtf**, **txt**, **pptx**, **xlsx**, **ods**, **csv**, **pdf** (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/index.md#format-types) values). | -| *sPath* | const wchar\_t\* | The path to the file to be saved together with its name and extension. | -| *sParams* | const wchar\_t\* | The parameters needed for the correct file saving (most commonly, the encoding is used for the *txt* and *csv* file types or the delimiter for the *csv* files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where **m\_nCsvTxtEncoding** is used for the text encoding and **m\_nCsvDelimiter** is used for the *csv* delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the *csv* delimiters include:

          **0** - no delimiter;

          **1** - tab;

          **2** - semicolon;

          **3** - colon;

          **4** - comma;

          **5** - space.

          When saving into an image file (*png* or *jpg*) for creating thumbnails, the additional parameters are used. [See below](#saving-into-images) to find them out. | + + +- sExtension + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : + + The file extension. The following values are possible: `docx`, `odt`, `rtf`, `txt`, `pptx`, `xlsx`, `ods`, `csv`, `pdf` (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). + +- sPath + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : + + The path to the file to be saved together with its name and extension. + +- sParams + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : + + The parameters needed for the correct file saving (most commonly, the encoding is used for the `txt` and `csv` file types or the delimiter for the `csv` files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where `m_nCsvTxtEncoding` is used for the text encoding and `m_nCsvDelimiter` is used for the `csv` delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the `csv` delimiters include: + + - `0` - no delimiter; + - `1` - tab; + - `2` - semicolon; + - `3` - colon; + - `4` - comma; + - `5` - space. + + When saving into an image file (`png` or `jpg`) for creating thumbnails, the additional parameters are used. [See below](#saving-into-images) to find them out. + + ## Example @@ -31,14 +87,14 @@ builder.SaveFile("docx", "result.docx") ## Saving into images -**ONLYOFFICE Document Builder** allows to save your document files into image files creating thumbnails of the first page or of all the pages in the document. This is done using the parameters of the *SaveFile()* method. The parameters are added in the form of XML tags, where the following tags can be used: +ONLYOFFICE Document Builder allows to save your document files into image files creating thumbnails of the first page or of all the pages in the document. This is done using the parameters of the `SaveFile()` method. The parameters are added in the form of XML tags, where the following tags can be used: -- **m\_oThumbnail** - the core tag showing that the inner nodes will be used to create a thumbnail out of the document file; -- **format** - the image file format used to create a thumbnail (can be of the following values: **3** - for a JPG file, **4** - for a PNG file); -- **aspect** - the image aspect when creating a thumbnail from the document file (can be of the following values: **1** - will keep the original aspect, **0** - will stretch the image to fit the width and the height set below); -- **first** - whether only the first page or all the pages should be converted into a thumbnail (can be of the following values: **true** - only the first page will be converted, **false** - all the document pages will be used to create thumbnails, in this case the file will be saved as an archive of images, one for each page); -- **width** - the image width in pixels; -- **height** - the image height in pixels. +- `m_oThumbnail` - the core tag showing that the inner nodes will be used to create a thumbnail out of the document file; +- `format` - the image file format used to create a thumbnail (can be of the following values: `3` - for a JPG file, `4` - for a PNG file); +- `aspect` - the image aspect when creating a thumbnail from the document file (can be of the following values: `1` - will keep the original aspect, `0` - will stretch the image to fit the width and the height set below); +- `first` - whether only the first page or all the pages should be converted into a thumbnail (can be of the following values: `true` - only the first page will be converted, `false` - all the document pages will be used to create thumbnails, in this case the file will be saved as an archive of images, one for each page); +- `width` - the image width in pixels; +- `height` - the image height in pixels. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SetProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SetProperty/index.md index e18f805d2..a54318136 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SetProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SetProperty/index.md @@ -1,31 +1,125 @@ -`void SetProperty(sParam, sValue);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: SetProperty} +- {type: text, text: (} +- {type: parameter, text: sParam} +- {type: text, text: ": "} +- {type: type, text: const char*} +- {type: text, text: ", "} +- {type: parameter, text: sValue} +- {type: text, text: ": "} +- {type: type, text: const char*} +- {type: text, text: )} +``` + +## Description -Sets an argument in the UTF8 format to the builder class which can be trasferred to the program outside the [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) method, i.e. either as an additional property when running **ONLYOFFICE Document Builder** executable file or as a part of program code, but not included into the document file script. +Sets an argument in the UTF8 format to the builder class which can be trasferred to the program outside the [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) method, i.e. either as an additional property when running ONLYOFFICE Document Builder executable file or as a part of program code, but not included into the document file script. -> Please note, that for the *.docbuilder* file the *CDocBuilder.SetProperty* method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilder.SetProperty` method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below. ## Parameters -| Name | Type | Description | -| -------- | ------------ | -------------------------------------------------------------------------- | -| *sParam* | const char\* | The parameter name in the UTF8 format, the value is always *--argument*. | -| *sValue* | const char\* | The parameter value in the UTF8 format which will be used in the document. | + + +- sParam + + ```yml signature.variant="inline" + - {type: type, text: const char*} + ``` + + - : The parameter name in the UTF8 format, the value is always `--argument`. + +- sValue + + ```yml signature.variant="inline" + - {type: type, text: const char*} + ``` + + - : The parameter value in the UTF8 format which will be used in the document. + + ## Supported properties -| Name | Type | Default | Description | -| --------------------------- | ---------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- | -| *--use-doctrenderer-scheme* | bool | false | Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. | -| *--check-fonts* | bool | true | Specifies if the system fonts are cached for faster work. | -| *--work-directory* | const wchar\_t\* | "" | The path to the temporary directory. | -| *--cache-scripts* | bool | true | Specifies if the sdkjs scripts are cached. | -| *--save-use-only-names* | bool | false | Specifies if the destination paths are used (for server work). For example: /home/user/1.txt => /tmp/1.txt | -| *--all-fonts-path* | const wchar\_t\* | "" | The path to the *AllFonts.js* script. | -| *--argument* | const wchar\_t\* | "" | The JSON argument which is sent to the global parameters of all the opened JS context. | -| *--fonts-system* | bool | true | Specifies if the system fonts are used. | -| *--fonts-dir* | const wchar\_t\* | "" | The path to the additional fonts directory (may be many records). | + + +- --use-doctrenderer-scheme, default: false + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. + +- --check-fonts, default: true + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the system fonts are cached for faster work. + +- --work-directory, default: "" + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The path to the temporary directory. + +- --cache-scripts, default: true + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the sdkjs scripts are cached. + +- --save-use-only-names, default: false + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the destination paths are used (for server work). For example: `/home/user/1.txt` => `/tmp/1.txt`. + +- --all-fonts-path, default: "" + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The path to the `AllFonts.js` script. + +- --argument, default: "" + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The JSON argument which is sent to the global parameters of all the opened JS context. + +- --fonts-system, default: true + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the system fonts are used. + +- --fonts-dir, default: "" + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The path to the additional fonts directory (may be many records). + + -Once added, the argument will be available as the **Argument** variable with its parameter values set: +Once added, the argument will be available as the `Argument` variable with its parameter values set: ```cpp Argument.name === "ONLYOFFICE" // true @@ -51,7 +145,7 @@ docbuilder.exe "--argument={\"name\":\"ONLYOFFICE\"}" test.docbuilder ## Adding or removing fonts -It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the **check-fonts** variable is used: +It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the `check-fonts` variable is used: ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SetPropertyW/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SetPropertyW/index.md index 8ec1f723b..2c78c0c6f 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SetPropertyW/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SetPropertyW/index.md @@ -1,31 +1,125 @@ -`void SetPropertyW(sParam, sValue);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: SetPropertyW} +- {type: text, text: (} +- {type: parameter, text: sParam} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: ", "} +- {type: parameter, text: sValue} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: )} +``` + +## Description -Sets an argument in the Unicode format which can be trasferred to the program outside the [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) method, i.e. either as an additional property when running **ONLYOFFICE Document Builder** executable file or as a part of program code, but not included into the document file script. +Sets an argument in the Unicode format which can be trasferred to the program outside the [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) method, i.e. either as an additional property when running ONLYOFFICE Document Builder executable file or as a part of program code, but not included into the document file script. -> Please note, that for the *.docbuilder* file the *CDocBuilder.SetPropertyW* method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilder.SetPropertyW` method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below. ## Parameters -| Name | Type | Description | -| -------- | ---------------- | ----------------------------------------------------------------------------- | -| *sParam* | const wchar\_t\* | The parameter name in the Unicode format, the value is always *--argument*. | -| *sValue* | const wchar\_t\* | The parameter value in the Unicode format which will be used in the document. | + + +- sParam + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The parameter name in the Unicode format, the value is always `--argument`. + +- sValue + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The parameter value in the Unicode format which will be used in the document. + + ## Supported properties -| Name | Type | Default | Description | -| --------------------------- | ---------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- | -| *--use-doctrenderer-scheme* | bool | false | Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. | -| *--check-fonts* | bool | true | Specifies if the system fonts are cached for faster work. | -| *--work-directory* | const wchar\_t\* | "" | The path to the temporary directory. | -| *--cache-scripts* | bool | true | Specifies if the sdkjs scripts are cached. | -| *--save-use-only-names* | bool | false | Specifies if the destination paths are used (for server work). For example: /home/user/1.txt => /tmp/1.txt | -| *--all-fonts-path* | const wchar\_t\* | "" | The path to the *AllFonts.js* script. | -| *--argument* | const wchar\_t\* | "" | The JSON argument which is sent to the global parameters of all the opened JS context. | -| *--fonts-system* | bool | true | Specifies if the system fonts are used. | -| *--fonts-dir* | const wchar\_t\* | "" | The path to the additional fonts directory (may be many records). | + + +- --use-doctrenderer-scheme, default: false + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. + +- --check-fonts, default: true + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the system fonts are cached for faster work. + +- --work-directory, default: "" + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The path to the temporary directory. + +- --cache-scripts, default: true + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the sdkjs scripts are cached. + +- --save-use-only-names, default: false + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the destination paths are used (for server work). For example: `/home/user/1.txt` => `/tmp/1.txt`. + +- --all-fonts-path, default: "" + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The path to the `AllFonts.js` script. + +- --argument, default: "" + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The JSON argument which is sent to the global parameters of all the opened JS context. + +- --fonts-system, default: true + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the system fonts are used. + +- --fonts-dir, default: "" + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The path to the additional fonts directory (may be many records). + + -Once added, the argument will be available as the **Argument** variable with its parameter values set: +Once added, the argument will be available as the `Argument` variable with its parameter values set: ```cpp Argument.name === "ONLYOFFICE" // true @@ -51,7 +145,7 @@ docbuilder.exe "--argument={\"name\":\"ONLYOFFICE\"}" test.docbuilder ## Adding or removing fonts -It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the **check-fonts** variable is used: +It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the `check-fonts` variable is used: ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SetTmpFolder/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SetTmpFolder/index.md index 6b753f0f1..0e1992bf6 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SetTmpFolder/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/SetTmpFolder/index.md @@ -1,12 +1,31 @@ -`void SetTmpFolder(sFolder);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: SetTmpFolder} +- {type: text, text: (} +- {type: parameter, text: sFolder} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: )} +``` + +## Description Sets the path to the folder where the program will temporarily save files needed for the program correct work. After the successful document file creation, all the files will be deleted from the folder. If no temporary folder is set, the system one will be used. ## Parameters -| Name | Type | Description | -| --------- | ---------------- | --------------------------------------------------------------- | -| *sFolder* | const wchar\_t\* | The path to the folder where the temporary files will be saved. | + + +- sFolder + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The path to the folder where the temporary files will be saved. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/WriteData/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/WriteData/index.md index 206088a68..ced72df0d 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/WriteData/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/WriteData/index.md @@ -1,16 +1,57 @@ -`void WriteData(sPath, sValue, bAppend);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: WriteData} +- {type: text, text: (} +- {type: parameter, text: sPath} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: ", "} +- {type: parameter, text: sValue} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: ", "} +- {type: parameter, text: bAppend} +- {type: text, text: ": "} +- {type: type, text: const bool&} +- {type: text, text: )} +``` + +## Description Writes data to the log file. It is used for logs in JS code. -> Please note, that for the *.docbuilder* file the *CDocBuilder.WriteData* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.WriteData` method is not used. ## Parameters -| Name | Type | Description | -| --------- | ---------------- | ---------------------------------------------------------------------------------------------------------- | -| *sPath* | const wchar\_t\* | The path to the file where all the logs will be written. | -| *sValue* | const wchar\_t\* | The data which will be written to the log file. | -| *bAppend* | const bool& | Specifies if the new data will be appended to the already existing log file or a new file will be created. | + + +- sPath + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The path to the file where all the logs will be written. + +- sValue + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The data which will be written to the log file. + +- bAppend + + ```yml signature.variant="inline" + - {type: type, text: const bool&} + ``` + + - : Specifies if the new data will be appended to the already existing log file or a new file will be created. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/index.md index 31e157cc5..7eb320d71 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilder/index.md @@ -1,25 +1,50 @@ -`new CDocBuilder` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilder} +``` -Base class used by **ONLYOFFICE Document Builder** for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. +## Description -## Methods +Base class used by ONLYOFFICE Document Builder for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. -| Name | Description | -| ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [CloseFile](CloseFile/index.md) | Closes the file to stop working with it. | -| [CreateFile](CreateFile/index.md) | Creates a new file. | -| [Dispose](Dispose/index.md) | Unloads the **ONLYOFFICE Document Builder** from the application memory when it is no longer needed. | -| [ExecuteCommand](ExecuteCommand/index.md) | Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). | -| [GetContext](GetContext/index.md) | Returns the current JS context. | -| [GetVersion](GetVersion/index.md) | Returns the **ONLYOFFICE Document Builder** engine version. | -| [Initialize](Initialize/index.md) | Initializes the **ONLYOFFICE Document Builder** as a library for the application to be able to work with it. | -| [IsSaveWithDoctrendererMode](IsSaveWithDoctrendererMode/index.md) | Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. | -| [OpenFile](OpenFile/index.md) | Opens the document file which will be edited and saved afterwards. | -| [Run](Run/index.md) | Runs the **ONLYOFFICE Document Builder** executable. | -| [RunTextA](RunTextA/index.md) | Runs all the commands for the document creation using a single command in the UTF8 format. | -| [RunTextW](RunTextW/index.md) | Runs all the commands for the document creation using a single command in the Unicode format. | -| [SaveFile](SaveFile/index.md) | Saves the file after all the changes are made. | -| [SetProperty](SetProperty/index.md) | Sets an argument in the UTF8 format which can be transferred to the program outside the [CDocBuilder.ExecuteCommand](ExecuteCommand/index.md) method. | -| [SetPropertyW](SetPropertyW/index.md) | Sets an argument in the Unicode format which can be transferred to the program outside the [CDocBuilder.ExecuteCommand](ExecuteCommand/index.md) method. | -| [SetTmpFolder](SetTmpFolder/index.md) | Sets the path to the folder where the program will temporarily save files needed for the program correct work. | -| [WriteData](WriteData/index.md) | Writes data to the log file. | +## Instance Methods + + + +- [CloseFile](CloseFile/index.md) + - : Closes the file to stop working with it. +- [CreateFile](CreateFile/index.md) + - : Creates a new file. +- [Dispose](Dispose/index.md) + - : Unloads the ONLYOFFICE Document Builder from the application memory when it is no longer needed. +- [ExecuteCommand](ExecuteCommand/index.md) + - : Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). +- [GetContext](GetContext/index.md) + - : Returns the current JS context. +- [GetVersion](GetVersion/index.md) + - : Returns the ONLYOFFICE Document Builder engine version. +- [Initialize](Initialize/index.md) + - : Initializes the ONLYOFFICE Document Builder as a library for the application to be able to work with it. +- [IsSaveWithDoctrendererMode](IsSaveWithDoctrendererMode/index.md) + - : Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. +- [OpenFile](OpenFile/index.md) + - : Opens the document file which will be edited and saved afterwards. +- [Run](Run/index.md) + - : Runs the ONLYOFFICE Document Builder executable. +- [RunTextA](RunTextA/index.md) + - : Runs all the commands for the document creation using a single command in the UTF8 format. +- [RunTextW](RunTextW/index.md) + - : Runs all the commands for the document creation using a single command in the Unicode format. +- [SaveFile](SaveFile/index.md) + - : Saves the file after all the changes are made. +- [SetProperty](SetProperty/index.md) + - : Sets an argument in the UTF8 format which can be transferred to the program outside the [CDocBuilder.ExecuteCommand](ExecuteCommand/index.md) method. +- [SetPropertyW](SetPropertyW/index.md) + - : Sets an argument in the Unicode format which can be transferred to the program outside the [CDocBuilder.ExecuteCommand](ExecuteCommand/index.md) method. +- [SetTmpFolder](SetTmpFolder/index.md) + - : Sets the path to the folder where the program will temporarily save files needed for the program correct work. +- [WriteData](WriteData/index.md) + - : Writes data to the log file. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/AllocMemoryTypedArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/AllocMemoryTypedArray/index.md index 0675a59cf..0dde160a8 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/AllocMemoryTypedArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/AllocMemoryTypedArray/index.md @@ -1,14 +1,35 @@ -`static unsigned char* AllocMemoryTypedArray(nSize);` +```yml signature +- {type: keyword, text: static} +- {type: text, text: " "} +- {type: type, text: unsigned char*} +- {type: text, text: " "} +- {type: entity, text: AllocMemoryTypedArray} +- {type: text, text: (} +- {type: parameter, text: nSize} +- {type: text, text: ": "} +- {type: type, text: const size_t*} +- {type: text, text: )} +``` + +## Description Allocates the memory for a typed array by creating a buffer array of the specified size. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.AllocMemoryTypedArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.AllocMemoryTypedArray` method is not used. ## Parameters -| Name | Type | Description | -| ------- | --------------- | ---------------------- | -| *nSize* | const size\_t\* | The buffer array size. | + + +- nSize + + ```yml signature.variant="inline" + - {type: type, text: const size_t*} + ``` + + - : The buffer array size. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateArray/index.md index 74e3d3140..6ca3c6313 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateArray/index.md @@ -1,14 +1,33 @@ -`CDocBuilderValue CreateArray(nLength);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: CreateArray} +- {type: text, text: (} +- {type: parameter, text: nLength} +- {type: text, text: ": "} +- {type: type, text: const int&} +- {type: text, text: )} +``` + +## Description -Creates an array value, an analogue of *new Array (length)* in JS. +Creates an array value, an analogue of `new Array (length)` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateArray` method is not used. ## Parameters -| Name | Type | Description | -| --------- | ---------- | ----------------- | -| *nLength* | const int& | The array length. | + + +- nLength + + ```yml signature.variant="inline" + - {type: type, text: const int&} + ``` + + - : The array length. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateNull/index.md index 7a4cd7123..fdbfed68a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateNull/index.md @@ -1,8 +1,16 @@ -`CDocBuilderValue CreateNull();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: CreateNull} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Creates a null value, an analogue of *null* in JS. +Creates a null value, an analogue of `null` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateNull* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateNull` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateObject/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateObject/index.md index 1f448173e..de7a0ec87 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateObject/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateObject/index.md @@ -1,8 +1,16 @@ -`CDocBuilderValue CreateObject();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: CreateObject} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Creates an empty object, an analogue of *{}* in JS. +Creates an empty object, an analogue of `{}` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateObject* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateObject` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateScope/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateScope/index.md index d4df03a99..dfef75f49 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateScope/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateScope/index.md @@ -1,8 +1,16 @@ -`CDocBuilderContextScope CreateScope();` +```yml signature +- {id: ../../CDocBuilderContextScope/index.md, token: {type: type, text: CDocBuilderContextScope}} +- {type: text, text: " "} +- {type: entity, text: CreateScope} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Creates a [context scope](../../CDocBuilderContextScope/index.md) which sets the execution context for all operations executed within a local scope. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateScope* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateScope` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateTypedArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateTypedArray/index.md index 85956ff92..cc1febb6b 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateTypedArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateTypedArray/index.md @@ -1,16 +1,57 @@ -`CDocBuilderValue CreateTypedArray(sBuffer, nLength, bExternalize);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: CreateTypedArray} +- {type: text, text: (} +- {type: parameter, text: sBuffer} +- {type: text, text: ": "} +- {type: type, text: unsigned char*} +- {type: text, text: ", "} +- {type: parameter, text: nLength} +- {type: text, text: ": "} +- {type: type, text: const int&} +- {type: text, text: ", "} +- {type: parameter, text: bExternalize} +- {type: text, text: ": "} +- {type: type, text: const bool&} +- {type: text, text: )} +``` + +## Description -Creates a Uint8Array value, an analogue of *Uint8Array* in JS. +Creates a Uint8Array value, an analogue of `Uint8Array` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateTypedArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateTypedArray` method is not used. ## Parameters -| Name | Type | Description | -| -------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| *sBuffer* | unsigned char\* | The array buffer. | -| *nLength* | const int& | The array length. | -| *bExternalize* | const bool& | Specifies if the application releases the memory after freeing Uint8Array (**true**). If this parameter is **false**, then the memory will be released automatically. In this case, the buffer must be created with the [AllocMemoryTypedArray](../AllocMemoryTypedArray/index.md) method. | + + +- sBuffer + + ```yml signature.variant="inline" + - {type: type, text: unsigned char*} + ``` + + - : The array buffer. + +- nLength + + ```yml signature.variant="inline" + - {type: type, text: const int&} + ``` + + - : The array length. + +- bExternalize + + ```yml signature.variant="inline" + - {type: type, text: const bool&} + ``` + + - : Specifies if the application releases the memory after freeing Uint8Array (`true`). If this parameter is `false`, then the memory will be released automatically. In this case, the buffer must be created with the [AllocMemoryTypedArray](../AllocMemoryTypedArray/index.md) method. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateUndefined/index.md index e7075d6ac..e56a01f08 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/CreateUndefined/index.md @@ -1,8 +1,16 @@ -`CDocBuilderValue CreateUndefined();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: CreateUndefined} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Creates an undefined value, an analogue of *undefined* in JS. +Creates an undefined value, an analogue of `undefined` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateUndefined` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/FreeMemoryTypedArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/FreeMemoryTypedArray/index.md index 3c8e32548..f1743d8a8 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/FreeMemoryTypedArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/FreeMemoryTypedArray/index.md @@ -1,15 +1,47 @@ -`static void FreeMemoryTypedArray(sData, nSize);` +```yml signature +- {type: keyword, text: static} +- {type: text, text: " "} +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: FreeMemoryTypedArray} +- {type: text, text: (} +- {type: parameter, text: sData} +- {type: text, text: ": "} +- {type: type, text: unsigned char*} +- {type: text, text: ", "} +- {type: parameter, text: nSize} +- {type: text, text: ": "} +- {type: type, text: const size_t*} +- {type: text, text: )} +``` + +## Description Frees the memory for a typed array. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.FreeMemoryTypedArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.FreeMemoryTypedArray` method is not used. ## Parameters -| Name | Type | Description | -| ------- | --------------- | ------------------------------------ | -| *sData* | unsigned char\* | The allocated memory to be released. | -| *nSize* | const size\_t\* | The buffer array size. | + + +- sData + + ```yml signature.variant="inline" + - {type: type, text: unsigned char*} + ``` + + - : The allocated memory to be released. + +- nSize + + ```yml signature.variant="inline" + - {type: type, text: const size_t*} + ``` + + - : The buffer array size. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/GetGlobal/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/GetGlobal/index.md index 57e4fd0f8..709709055 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/GetGlobal/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/GetGlobal/index.md @@ -1,8 +1,16 @@ -`CDocBuilderValue GetGlobal();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: GetGlobal} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Returns the global object for the current context. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.GetGlobal* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.GetGlobal` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/IsError/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/IsError/index.md index ecea9df16..ece12f827 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/IsError/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/IsError/index.md @@ -1,8 +1,16 @@ -`bool IsError();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsError} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Checks for errors in JS. The error message and call stack will be written to *std::cerr*. +Checks for errors in JS. The error message and call stack will be written to `std::cerr`. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.IsError* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.IsError` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/index.md index d00eda3f7..4c985489d 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContext/index.md @@ -1,18 +1,36 @@ -`new CDocBuilderContext` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderContext} +``` -Class used by **ONLYOFFICE Document Builder** for getting JS context for working. +## Description -## Methods +Class used by ONLYOFFICE Document Builder for getting JS context for working. -| Name | Description | -| ------------------------------------------------------- | -------------------------------------------------------------- | -| [AllocMemoryTypedArray](AllocMemoryTypedArray/index.md) | Allocates the memory for a typed array. | -| [CreateArray](CreateArray/index.md) | Creates an array, an analogue of *new Array (length)* in JS. | -| [CreateNull](CreateNull/index.md) | Creates a null value, an analogue of *null* in JS. | -| [CreateObject](CreateObject/index.md) | Creates an empty object, an analogue of *{}* in JS. | -| [CreateScope](CreateScope/index.md) | Creates a context scope. | -| [CreateTypedArray](CreateTypedArray/index.md) | Creates a Uint8Array value, an analogue of *Uint8Array* in JS. | -| [CreateUndefined](CreateUndefined/index.md) | Creates an undefined value, an analogue of *undefined* in JS. | -| [FreeMemoryTypedArray](FreeMemoryTypedArray/index.md) | Frees the memory for a typed array. | -| [GetGlobal](GetGlobal/index.md) | Returns the global object for the current context. | -| [IsError](IsError/index.md) | Checks for errors in JS. | +## Instance Methods + + + +- [AllocMemoryTypedArray](AllocMemoryTypedArray/index.md) + - : Allocates the memory for a typed array. +- [CreateArray](CreateArray/index.md) + - : Creates an array, an analogue of `new Array (length)` in JS. +- [CreateNull](CreateNull/index.md) + - : Creates a null value, an analogue of `null` in JS. +- [CreateObject](CreateObject/index.md) + - : Creates an empty object, an analogue of `{}` in JS. +- [CreateScope](CreateScope/index.md) + - : Creates a context scope. +- [CreateTypedArray](CreateTypedArray/index.md) + - : Creates a Uint8Array value, an analogue of `Uint8Array` in JS. +- [CreateUndefined](CreateUndefined/index.md) + - : Creates an undefined value, an analogue of `undefined` in JS. +- [FreeMemoryTypedArray](FreeMemoryTypedArray/index.md) + - : Frees the memory for a typed array. +- [GetGlobal](GetGlobal/index.md) + - : Returns the global object for the current context. +- [IsError](IsError/index.md) + - : Checks for errors in JS. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContextScope/Close/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContextScope/Close/index.md index 16121148c..acc31e71c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContextScope/Close/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContextScope/Close/index.md @@ -1,8 +1,16 @@ -`void Close();` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: Close} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Closes the current scope. This method will be called automatically when the descructor is executed. -> Please note, that for the *.docbuilder* file the *CDocBuilderContextScope.Close* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContextScope.Close` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContextScope/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContextScope/index.md index 83f7cfb6e..cd60ed76c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContextScope/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderContextScope/index.md @@ -1,9 +1,18 @@ -`new CDocBuilderContextScope` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderContextScope} +``` -The stack-allocated class used by **ONLYOFFICE Document Builder** which sets the execution context for all operations executed within a local scope. All opened scopes will be closed automatically when the builder [CloseFile](../CDocBuilder/CloseFile/index.md) method is called. +## Description -## Methods +The stack-allocated class used by ONLYOFFICE Document Builder which sets the execution context for all operations executed within a local scope. All opened scopes will be closed automatically when the builder [CloseFile](../CDocBuilder/CloseFile/index.md) method is called. -| Name | Description | -| ----------------------- | ------------------------- | -| [Close](Close/index.md) | Closes the current scope. | +## Instance Methods + + + +- [Close](Close/index.md) + - : Closes the current scope. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Call/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Call/index.md index e79d37097..2d5268556 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Call/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Call/index.md @@ -1,15 +1,69 @@ -`CDocBuilderValue Call(sName, p1, p2, p3, p4, p5, p6);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: Call} +- {type: text, text: (} +- {type: parameter, text: sName} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: " | "} +- {type: type, text: const char*} +- {type: text, text: ", "} +- {type: parameter, text: p1} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: ", "} +- {type: parameter, text: p2} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: ", "} +- {type: parameter, text: p3} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: ", "} +- {type: parameter, text: p4} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: ", "} +- {type: parameter, text: p5} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: ", "} +- {type: parameter, text: p6} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: )} +``` + +## Description Calls the specified Document Builder method. See the [Text document API](../../../../../Office%20API/Usage%20API/Text%20Document%20API/index.md), [Spreadsheet API](../../../../../Office%20API/Usage%20API/Spreadsheet%20API/index.md), [Presentation API](../../../../../Office%20API/Usage%20API/Presentation%20API/index.md) or [Form API](../../../../../Office%20API/Usage%20API/Form%20API/index.md) sections for more information which methods are available for various document types. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Call* method is not used explicitly. The method itself is used instead. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Call` method is not used explicitly. The method itself is used instead. See the example below. ## Parameters -| Name | Type | Description | -| ------- | ----------------------------- | ---------------------------------------------------------------------- | -| *sName* | const wchar\_t\*/const char\* | The name of the Document Builder method in the Unicode or UTF8 format. | -| *p1-p6* | CDocBuilderValue | The parameters that the Document Builder method takes as arguments. | + + +- sName + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + - {type: text, text: " | "} + - {type: type, text: const char*} + ``` + + - : The name of the Document Builder method in the Unicode or UTF8 format. + +- p1-p6 + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} + ``` + + - : The parameters that the Document Builder method takes as arguments. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Clear/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Clear/index.md index 8b70b8b6c..25c8fc247 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Clear/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Clear/index.md @@ -1,8 +1,16 @@ -`void Clear();` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: Clear} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Clears the **CDocBuilderValue** object. +Clears the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Clear* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Clear` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/CreateNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/CreateNull/index.md index a15fd3f5e..24e0458df 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/CreateNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/CreateNull/index.md @@ -1,8 +1,18 @@ -`static CDocBuilderValue CreateNull();` +```yml signature +- {type: keyword, text: static} +- {type: text, text: " "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: CreateNull} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Creates a null value. This method returns the current [context](../../CDocBuilderContext/index.md) and calls its [CreateNull](../../CDocBuilderContext/CreateNull/index.md) method. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.CreateNull* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.CreateNull` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/CreateUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/CreateUndefined/index.md index 296d4ab29..9914d0d09 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/CreateUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/CreateUndefined/index.md @@ -1,8 +1,18 @@ -`static CDocBuilderValue CreateUndefined();` +```yml signature +- {type: keyword, text: static} +- {type: text, text: " "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: CreateUndefined} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Creates an undefined value. This method returns the current [context](../../CDocBuilderContext/index.md) and calls its [CreateUndefined](../../CDocBuilderContext/CreateUndefined/index.md) method. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.CreateUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.CreateUndefined` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Get/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Get/index.md index d21ffaa85..276a1a5b0 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Get/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Get/index.md @@ -1,14 +1,33 @@ -`CDocBuilderValue Get(nIndex);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: Get} +- {type: text, text: (} +- {type: parameter, text: nIndex} +- {type: text, text: ": "} +- {type: type, text: const int&} +- {type: text, text: )} +``` + +## Description Returns an array value by its index. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Get* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Get` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ---------- | ----------------------------- | -| *nIndex* | const int& | The index of the array value. | + + +- nIndex + + ```yml signature.variant="inline" + - {type: type, text: const int&} + ``` + + - : The index of the array value. + + ## Example @@ -27,7 +46,7 @@ CValue oChart = aCharts.Get(1); CDocBuilder::Dispose(); ``` -The **operator\[]** postfix expression can be also used to get an array value by its index: +The `operator[]` postfix expression can be also used to get an array value by its index: ```cpp CDocBuilderValue operator[](const int& name); diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/GetLength/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/GetLength/index.md index e267d8583..1ed57e0aa 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/GetLength/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/GetLength/index.md @@ -1,8 +1,16 @@ -`unsigned int GetLength();` +```yml signature +- {type: type, text: unsigned int} +- {type: text, text: " "} +- {type: entity, text: GetLength} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns the length if the **CDocBuilderValue** object is an array/typed array. Otherwise, returns 0. +Returns the length if the `CDocBuilderValue` object is an array/typed array. Otherwise, returns 0. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.GetLength* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.GetLength` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/GetProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/GetProperty/index.md index 1dfd34f50..e794ba31b 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/GetProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/GetProperty/index.md @@ -1,14 +1,33 @@ -`CDocBuilderValue GetProperty(sName);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: GetProperty} +- {type: text, text: (} +- {type: parameter, text: sName} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: )} +``` + +## Description -Returns a property of the **CDocBuilderValue** object. +Returns a property of the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.GetProperty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.GetProperty` method is not used. ## Parameters -| Name | Type | Description | -| ------- | ---------------- | ----------------------------------------------------- | -| *sName* | const wchar\_t\* | The name of the **CDocBuilderValue** object property. | + + +- sName + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The name of the `CDocBuilderValue` object property. + + ## Example @@ -26,9 +45,9 @@ CValue oDocPr = oDocument.GetProperty("color"); CDocBuilder::Dispose(); ``` -There are two more ways to get a property of the **CDocBuilderValue** object: +There are two more ways to get a property of the `CDocBuilderValue` object: -1. use the **Get** method that takes the arguments both in the UTF8 or Unicode formats: +1. use the `Get` method that takes the arguments both in the UTF8 or Unicode formats: ```cpp CDocBuilderValue Get(const char* name); @@ -51,7 +70,7 @@ There are two more ways to get a property of the **CDocBuilderValue** object: CDocBuilder::Dispose(); ``` -2. use the **operator\[]** postfix expression that takes the arguments both in the UTF8 or Unicode formats: +2. use the `operator[]` postfix expression that takes the arguments both in the UTF8 or Unicode formats: ```cpp CDocBuilderValue operator[](const char* name); diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsArray/index.md index d1977a532..8c2dbf5e7 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsArray/index.md @@ -1,8 +1,16 @@ -`bool IsArray();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsArray} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an array. +Returns true if the `CDocBuilderValue` object is an array. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsArray` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsBool/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsBool/index.md index 2a20e74dd..8e96a069d 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsBool/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsBool/index.md @@ -1,8 +1,16 @@ -`bool IsBool();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsBool} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a boolean value. +Returns true if the `CDocBuilderValue` object is a boolean value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsBool* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsBool` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsDouble/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsDouble/index.md index 4f4caaed6..e99a38af7 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsDouble/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsDouble/index.md @@ -1,8 +1,16 @@ -`bool IsDouble();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsDouble} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a double value. +Returns true if the `CDocBuilderValue` object is a double value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsDouble* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsDouble` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsEmpty/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsEmpty/index.md index 2d146a1d4..c19b8b622 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsEmpty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsEmpty/index.md @@ -1,8 +1,16 @@ -`bool IsEmpty();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsEmpty} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is empty. +Returns true if the `CDocBuilderValue` object is empty. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsEmpty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsEmpty` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsFunction/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsFunction/index.md index 76a7a0e57..4c1d81d44 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsFunction/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsFunction/index.md @@ -1,8 +1,16 @@ -`bool IsFunction();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsFunction} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a function. +Returns true if the `CDocBuilderValue` object is a function. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsFunction* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsFunction` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsInt/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsInt/index.md index c77091fb3..e2732aebf 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsInt/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsInt/index.md @@ -1,8 +1,16 @@ -`bool IsInt();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsInt} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an integer. +Returns true if the `CDocBuilderValue` object is an integer. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsInt* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsInt` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsNull/index.md index 96dcf8d53..4f40bd96a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsNull/index.md @@ -1,8 +1,16 @@ -`bool IsNull();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsNull} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is null. +Returns true if the `CDocBuilderValue` object is null. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsNll* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsNll` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsObject/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsObject/index.md index 53227b9f8..8968434ba 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsObject/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsObject/index.md @@ -1,8 +1,16 @@ -`bool IsObject();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsObject} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an object. +Returns true if the `CDocBuilderValue` object is an object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsObject* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsObject` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsString/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsString/index.md index 993c606d5..b399325ba 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsString/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsString/index.md @@ -1,8 +1,16 @@ -`bool IsString();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsString} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a string. +Returns true if the `CDocBuilderValue` object is a string. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsString* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsString` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsTypedArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsTypedArray/index.md index 02ad7d903..8ff315138 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsTypedArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsTypedArray/index.md @@ -1,8 +1,16 @@ -`bool IsTypedArray();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsTypedArray} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a typed array. +Returns true if the `CDocBuilderValue` object is a typed array. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsTypedArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsTypedArray` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsUndefined/index.md index cb9deed86..cdd9c4147 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/IsUndefined/index.md @@ -1,8 +1,16 @@ -`bool IsUndefined();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: IsUndefined} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is undefined. +Returns true if the `CDocBuilderValue` object is undefined. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsUndefined* method is not used. +> Please note, that for the `.docbuilder` file the` CDocBuilderValue.IsUndefined` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Set/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Set/index.md index 73c542fe5..98d8a0f50 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Set/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/Set/index.md @@ -1,15 +1,45 @@ -`void Set(nIndex, sValue);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: Set} +- {type: text, text: (} +- {type: parameter, text: nIndex} +- {type: text, text: ": "} +- {type: type, text: const int&} +- {type: text, text: ", "} +- {type: parameter, text: sValue} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: )} +``` + +## Description Sets an array value by its index. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Set* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Set` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ---------------- | ----------------------------- | -| *nIndex* | const int& | The index of the array value. | -| *sValue* | CDocBuilderValue | The array value to be set. | + + +- nIndex + + ```yml signature.variant="inline" + - {type: type, text: const int&} + ``` + + - : The index of the array value. + +- sValue + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: keyword, text: CDocBuilderValue}} + ``` + + - : The array value to be set. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/SetProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/SetProperty/index.md index 47fcee54a..b5de7bd02 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/SetProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/SetProperty/index.md @@ -1,15 +1,45 @@ -`void SetProperty(sName, sValue);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: SetProperty} +- {type: text, text: (} +- {type: parameter, text: sName} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: ", "} +- {type: parameter, text: sValue} +- {type: text, text: ": "} +- {type: type, text: const wchar_t*} +- {type: text, text: )} +``` + +## Description -Sets a property to the **CDocBuilderValue** object. +Sets a property to the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.SetProperty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.SetProperty` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ---------------- | ------------------------------------------------------ | -| *sName* | const wchar\_t\* | The name of the **CDocBuilderValue** object property. | -| *sValue* | const wchar\_t\* | The value of the **CDocBuilderValue** object property. | + + +- sName + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The name of the `CDocBuilderValue` object property. + +- sValue + + ```yml signature.variant="inline" + - {type: type, text: const wchar_t*} + ``` + + - : The value of the `CDocBuilderValue` object property. + + ## Example @@ -27,7 +57,7 @@ oDocument.SetProperty("color", {"zX":{"red":112,"green":173,"blue":71,"alpha":25 CDocBuilder::Dispose(); ``` -The **Set** method can be also used to set a property to the **CDocBuilderValue** object. The object property can be specified with its name in the Unicode format: +The `Set` method can be also used to set a property to the `CDocBuilderValue` object. The object property can be specified with its name in the Unicode format: ```cpp void Set(const wchar_t* name, CDocBuilderValue value); diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToBool/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToBool/index.md index 893d86a95..248c590d4 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToBool/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToBool/index.md @@ -1,8 +1,16 @@ -`bool ToBool();` +```yml signature +- {type: type, text: bool} +- {type: text, text: " "} +- {type: entity, text: ToBool} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a boolean value. +Converts the `CDocBuilderValue` object to a boolean value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToBool* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToBool` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToDouble/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToDouble/index.md index d8c892c54..2b99d96a1 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToDouble/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToDouble/index.md @@ -1,8 +1,16 @@ -`double ToDouble();` +```yml signature +- {type: type, text: double} +- {type: text, text: " "} +- {type: entity, text: ToDouble} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a double value. +Converts the `CDocBuilderValue` object to a double value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToDouble* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToDouble` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToInt/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToInt/index.md index c624745f4..fafcc3a44 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToInt/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToInt/index.md @@ -1,8 +1,16 @@ -`int ToInt();` +```yml signature +- {type: type, text: int} +- {type: text, text: " "} +- {type: entity, text: ToInt} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to an integer. +Converts the `CDocBuilderValue` object to an integer. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToInt* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToInt` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToString/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToString/index.md index 141a39079..6d14bf3d9 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToString/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/ToString/index.md @@ -1,8 +1,16 @@ -`CString ToString();` +```yml signature +- {type: type, text: CString} +- {type: text, text: " "} +- {type: entity, text: ToString} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a string. +Converts the `CDocBuilderValue` object to a string. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToString* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToString` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/index.md index f39e0c1a1..341f3e77e 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/CDocBuilderValue/index.md @@ -1,8 +1,14 @@ -`new CDocBuilderValue` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderValue} +``` + +## Description -Class used by **ONLYOFFICE Document Builder** for getting the results of called JS commands. It represents a wrapper for a JS object. +Class used by ONLYOFFICE Document Builder for getting the results of called JS commands. It represents a wrapper for a JS object. -The **CDocBuilderValue** class can be created from the primitive data types: +The `CDocBuilderValue` class can be created from the primitive data types: ``` cpp CDocBuilderValue(const bool& value); @@ -13,31 +19,57 @@ CDocBuilderValue(const char* value); CDocBuilderValue(const wchar_t* value); ``` -## Methods - -| Name | Description | -| ------------------------------------------- | ---------------------------------------------------------- | -| [Call](Call/index.md) | Calls the specified Document Builder method. | -| [Clear](Clear/index.md) | Clears the object. | -| [CreateNull](CreateNull/index.md) | Creates a null value. | -| [CreateUndefined](CreateUndefined/index.md) | Creates an undefined value. | -| [Get](Get/index.md) | Returns an array value by its index. | -| [GetLength](GetLength/index.md) | Returns the length if this object is an array/typed array. | -| [GetProperty](GetProperty/index.md) | Returns a property of this object. | -| [IsArray](IsArray/index.md) | Returns true if this object is an array. | -| [IsBool](IsBool/index.md) | Returns true if this object is a boolean value. | -| [IsDouble](IsDouble/index.md) | Returns true if this object is a double value. | -| [IsEmpty](IsEmpty/index.md) | Returns true if this object is empty. | -| [IsFunction](IsFunction/index.md) | Returns true if this object is a function. | -| [IsInt](IsInt/index.md) | Returns true if this object is an integer. | -| [IsNull](IsNull/index.md) | Returns true if this object is null. | -| [IsObject](IsObject/index.md) | Returns true if this object is an object. | -| [IsString](IsString/index.md) | Returns true if this object is a string. | -| [IsTypedArray](IsTypedArray/index.md) | Returns true if this object is a typed array. | -| [IsUndefined](IsUndefined/index.md) | Returns true if this object is undefined. | -| [Set](Set/index.md) | Sets an array value by its index. | -| [SetProperty](SetProperty/index.md) | Sets a property to this object. | -| [ToBool](ToBool/index.md) | Converts this object to a boolean value. | -| [ToDouble](ToDouble/index.md) | Converts this object to a double value. | -| [ToInt](ToInt/index.md) | Converts this object to an integer. | -| [ToString](ToString/index.md) | Converts this object to a string. | +## Instance Methods + + + +- [Call](Call/index.md) + - : Calls the specified Document Builder method. +- [Clear](Clear/index.md) + - : Clears the object. +- [CreateNull](CreateNull/index.md) + - : Creates a null value. +- [CreateUndefined](CreateUndefined/index.md) + - : Creates an undefined value. +- [Get](Get/index.md) + - : Returns an array value by its index. +- [GetLength](GetLength/index.md) + - : Returns the length if this object is an array/typed array. +- [GetProperty](GetProperty/index.md) + - : Returns a property of this object. +- [IsArray](IsArray/index.md) + - : Returns true if this object is an array. +- [IsBool](IsBool/index.md) + - : Returns true if this object is a boolean value. +- [IsDouble](IsDouble/index.md) + - : Returns true if this object is a double value. +- [IsEmpty](IsEmpty/index.md) + - : Returns true if this object is empty. +- [IsFunction](IsFunction/index.md) + - : Returns true if this object is a function. +- [IsInt](IsInt/index.md) + - : Returns true if this object is an integer. +- [IsNull](IsNull/index.md) + - : Returns true if this object is null. +- [IsObject](IsObject/index.md) + - : Returns true if this object is an object. +- [IsString](IsString/index.md) + - : Returns true if this object is a string. +- [IsTypedArray](IsTypedArray/index.md) + - : Returns true if this object is a typed array. +- [IsUndefined](IsUndefined/index.md) + - : Returns true if this object is undefined. +- [Set](Set/index.md) + - : Sets an array value by its index. +- [SetProperty](SetProperty/index.md) + - : Sets a property to this object. +- [ToBool](ToBool/index.md) + - : Converts this object to a boolean value. +- [ToDouble](ToDouble/index.md) + - : Converts this object to a double value. +- [ToInt](ToInt/index.md) + - : Converts this object to an integer. +- [ToString](ToString/index.md) + - : Converts this object to a string. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/C++/index.md b/site/pages/Docs/Document Builder/Builder Framework/C++/index.md index 74235eada..2688a0f08 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/C++/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/C++/index.md @@ -2,14 +2,24 @@ order: -6 --- -For the integration of **ONLYOFFICE Document Builder** into any application, the C++ **doctrenderer** library is used. The current application version contains six main classes: - -- *CDoctrenderer* class - used by **ONLYOFFICE Document Builder** in the file conversion process. -- *CString* class - the string class with the *wchar\_t\** property. -- [CDocBuilder](CDocBuilder/index.md) class - used by **ONLYOFFICE Document Builder** for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. -- [CDocBuilderContext](CDocBuilderContext/index.md) class - used by **ONLYOFFICE Document Builder** for getting JS context for working. -- [CDocBuilderContextScope](CDocBuilderContextScope/index.md) class - the stack-allocated class which sets the execution context for all operations executed within a local scope. -- [CDocBuilderValue](CDocBuilderValue/index.md) class - used by **ONLYOFFICE Document Builder** for getting the results of called JS commands. It represents a wrapper for a JS object. +For the integration of ONLYOFFICE Document Builder into any application, the C++ doctrenderer library is used. + +## Classes + +The current application version contains four main classes: + + + +- [CDocBuilder](CDocBuilder/index.md) + - : Used by ONLYOFFICE Document Builder for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. +- [CDocBuilderContext](CDocBuilderContext/index.md) + - : Used by ONLYOFFICE Document Builder for getting JS context for working. +- [CDocBuilderContextScope](CDocBuilderContextScope/index.md) + - : The stack-allocated class which sets the execution context for all operations executed within a local scope. +- [CDocBuilderValue](CDocBuilderValue/index.md) + - : Used by ONLYOFFICE Document Builder for getting the results of called JS commands. It represents a wrapper for a JS object. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/CloseFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/CloseFile/index.md index 65ccbc7c6..bff333a57 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/CloseFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/CloseFile/index.md @@ -1,6 +1,14 @@ -`HRESULT CloseFile();` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: CloseFile} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Closes the file to stop working with it. You can use a single **ONLYOFFICE Document Builder** instance to work with all your files, but you need to close the previous file before you can start working with the next one in this case. +Closes the file to stop working with it. You can use a single ONLYOFFICE Document Builder instance to work with all your files, but you need to close the previous file before you can start working with the next one in this case. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/CreateFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/CreateFile/index.md index 505837aa7..5559c6266 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/CreateFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/CreateFile/index.md @@ -1,13 +1,43 @@ -`HRESULT CreateFile([in] BSTR type, [out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: CreateFile} +- {type: text, text: (} +- {type: parameter, text: type} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description Creates a new file. The type of the file which will be created needs to be set. ## Parameters -| Name | Type | Description | -| -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *type* | BSTR | The file extension. The following values are possible: **docx**, **xlsx**, **pptx**, or **pdf** (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). | -| *result* | VARIANT\_BOOL\* | Specifies if the operation of creating a file is successful or not. | + + +- type + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The file extension. The following values are possible: `docx`, `xlsx`, `pptx`, or `pdf` (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies if the operation of creating a file is successful or not. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/CreateInstance/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/CreateInstance/index.md index 684eff2e0..340d9bfad 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/CreateInstance/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/CreateInstance/index.md @@ -1,8 +1,16 @@ -`HRESULT CreateInstance();` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: CreateInstance} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Creates an instance of the *CDocBuilder* class. +Creates an instance of the `CDocBuilder` class. -> Please note, that for the *.docbuilder* file the *CDocBuilder.CreateInstance* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.CreateInstance` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Dispose/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Dispose/index.md index 3fbe3380d..8d671a57f 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Dispose/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Dispose/index.md @@ -1,8 +1,16 @@ -`HRESULT Dispose();` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: Dispose} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Unloads the **ONLYOFFICE Document Builder** from the application memory when it is no longer needed. Generally, there is no need to dispose JS before exiting the process, it should happen automatically. It should only be used if the process needs the resources taken up by JS. +Unloads the ONLYOFFICE Document Builder from the application memory when it is no longer needed. Generally, there is no need to dispose JS before exiting the process, it should happen automatically. It should only be used if the process needs the resources taken up by JS. -> Please note, that for the *.docbuilder* file the *CDocBuilder.Dispose* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.Dispose` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Execute/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Execute/index.md index f737b1791..017a92825 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Execute/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Execute/index.md @@ -1,15 +1,45 @@ -`HRESULT Execute([in] BSTR command, [out, retval] I_DOCBUILDER_VALUE** result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: Execute} +- {type: text, text: (} +- {type: parameter, text: command} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} +- {type: text, text: )} +``` + +## Description Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). See the [Text document API](../../../../../Office%20API/Usage%20API/Text%20Document%20API/index.md), [Spreadsheet API](../../../../../Office%20API/Usage%20API/Spreadsheet%20API/index.md), [Presentation API](../../../../../Office%20API/Usage%20API/Presentation%20API/index.md), or [Form API](../../../../../Office%20API/Usage%20API/Form%20API/index.md) sections for more information which commands are available for various document types. -> Please note, that for the *.docbuilder* file the *CDocBuilder.Execute* method is not used explicitly. The command itself is used instead. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilder.Execute` method is not used explicitly. The command itself is used instead. See the example below. ## Parameters -| Name | Type | Description | -| --------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | -| *command* | BSTR | The command which will be used to create the document file (the escape character must be used when the command contains quotation symbols). | -| *result* | I\_DOCBUILDER\_VALUE\*\* | The command return value. | + + +- command + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The command which will be used to create the document file (the escape character must be used when the command contains quotation symbols). + +- result + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} + ``` + + - : The command return value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/ExecuteCommand/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/ExecuteCommand/index.md index 303bbbc9d..b50a51470 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/ExecuteCommand/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/ExecuteCommand/index.md @@ -1,15 +1,45 @@ -`HRESULT ExecuteCommand([in] BSTR command, [out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: ExecuteCommand} +- {type: text, text: (} +- {type: parameter, text: command} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). See the [Text document API](../../../../../Office%20API/Usage%20API/Text%20Document%20API/index.md), [Spreadsheet API](../../../../../Office%20API/Usage%20API/Spreadsheet%20API/index.md), [Presentation API](../../../../../Office%20API/Usage%20API/Presentation%20API/index.md), or [Form API](../../../../../Office%20API/Usage%20API/Form%20API/index.md) sections for more information which commands are available for various document types. -> Please note, that for the *.docbuilder* file the *CDocBuilder.ExecuteCommand* method is not used explicitly. The command itself is used instead. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilder.ExecuteCommand` method is not used explicitly. The command itself is used instead. See the example below. ## Parameters -| Name | Type | Description | -| --------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | -| *command* | BSTR | The command which will be used to create the document file (in COM, the escape character must be used when the command contains quotation symbols). | -| *result* | VARIANT\_BOOL\* | Specifies if the operation of executing a command is successful or not. | + + +- command + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The command which will be used to create the document file (in COM, the escape character must be used when the command contains quotation symbols) + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies if the operation of executing a command is successful or not. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/GetContext/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/GetContext/index.md index a0cf54170..90802aeb3 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/GetContext/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/GetContext/index.md @@ -1,14 +1,33 @@ -`HRESULT GetContext([out, retval] I_DOCBUILDER_CONTEXT** result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: GetContext} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {id: ../../CDocBuilderContext/index.md, token: {type: type, text: I_DOCBUILDER_CONTEXT**}} +- {type: text, text: )} +``` + +## Description Returns the current JS [context](../../CDocBuilderContext/index.md). -> Please note, that for the *.docbuilder* file the *CDocBuilder.GetContext* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.GetContext` method is not used. ## Parameters -| Name | Type | Description | -| -------- | -------------------------- | ------------------------ | -| *result* | I\_DOCBUILDER\_CONTEXT\*\* | The returned JS context. | + + +- result + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderContext/index.md, token: {type: type, text: I_DOCBUILDER_CONTEXT**}} + ``` + + - : The returned JS context. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Initialize/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Initialize/index.md index bafe256b5..59dd96e2a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Initialize/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Initialize/index.md @@ -1,8 +1,16 @@ -`HRESULT Initialize();` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: Initialize} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Initializes the **ONLYOFFICE Document Builder** as a library for the application to be able to work with it. This method just sets the directory to the main Document Builder resources (icu files, etc). If this method is not called, the Document Builder will find resources from the current process directory. +Initializes the ONLYOFFICE Document Builder as a library for the application to be able to work with it. This method just sets the directory to the main Document Builder resources (icu files, etc). If this method is not called, the Document Builder will find resources from the current process directory. -> Please note, that for the *.docbuilder* file the *CDocBuilder.Initialize* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.Initialize` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/IsSaveWithDoctrendererMode/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/IsSaveWithDoctrendererMode/index.md index 9c7576368..efe64534e 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/IsSaveWithDoctrendererMode/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/IsSaveWithDoctrendererMode/index.md @@ -1,14 +1,33 @@ -`HRESULT IsSaveWithDoctrendererMode([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsSaveWithDoctrendererMode} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. -> Please note, that for the *.docbuilder* file the *CDocBuilder.IsSaveWithDoctrendererMode* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.IsSaveWithDoctrendererMode` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | -------------------------------------------------------------------------------------------------------------------------- | -| *result* | VARIANT\_BOOL\* | Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/OpenFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/OpenFile/index.md index a8f781357..3e6c4614f 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/OpenFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/OpenFile/index.md @@ -1,14 +1,68 @@ -`HRESULT OpenFile([in] BSTR path, [in] BSTR params, [out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: OpenFile} +- {type: text, text: (} +- {type: parameter, text: path} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: params} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description Opens the document file which will be edited and saved afterwards. ## Parameters -| Name | Type | Attributes | Description | -| -------- | --------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *path* | BSTR | | The path to the file to be opened together with its name and extension. | -| *params* | BSTR | \ | The parameters needed for the correct file opening (most commonly, the encoding is used for the *txt* and *csv* file types or the delimiter for the *csv* files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where **m\_nCsvTxtEncoding** is used for the text encoding and **m\_nCsvDelimiter** is used for the delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the *csv* delimiters include:

          **0** - no delimiter;

          **1** - tab;

          **2** - semicolon;

          **3** - colon;

          **4** - comma;

          **5** - space. | -| *result* | VARIANT\_BOOL\* | | Specifies if the operation of opening a file is successful or not. | | + + +- path + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : + + The path to the file to be opened together with its name and extension. + +- params + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : + + The parameters needed for the correct file opening (most commonly, the encoding is used for the `txt` and `csv` file types or the delimiter for the `csv` files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where `m_nCsvTxtEncoding` is used for the text encoding and `m_nCsvDelimiter` is used for the delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the `csv` delimiters include: + + - `0` - no delimiter; + - `1` - tab; + - `2` - semicolon; + - `3` - colon; + - `4` - comma; + - `5` - space. + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : + + Specifies if the operation of opening a file is successful or not. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Run/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Run/index.md index c7c4b89f9..f458544e8 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Run/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/Run/index.md @@ -1,13 +1,43 @@ -`HRESULT Run([in] BSTR path, [out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: Run} +- {type: text, text: (} +- {type: parameter, text: path} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Runs the **ONLYOFFICE Document Builder** executable. If you do not want to write an application, you can simply use the **docbuilder.exe** executable file and run it with the ### .docbuilder file as an argument, where all the code for the document file creation will be written. For COM, create the *CDocBuilder* object and call the *Run* method with the path to the executable file from the *path* parameter. +Runs the ONLYOFFICE Document Builder executable. If you do not want to write an application, you can simply use the `docbuilder.exe` executable file and run it with the `.docbuilder` file as an argument, where all the code for the document file creation will be written. For COM, create the `CDocBuilder` object and call the `Run` method with the path to the executable file from the `patр` parameter. ## Parameters -| Name | Type | Description | -| -------- | --------------- | -------------------------------------------------------------------------- | -| *path* | BSTR | The path to the **ONLYOFFICE Document Builder** executable. | -| *result* | VARIANT\_BOOL\* | Specifies if the operation of running the executable is successful or not. | + + +- path + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The path to the ONLYOFFICE Document Builder executable. + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies if the operation of running the executable is successful or not. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/RunText/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/RunText/index.md index 640610410..1b38d9a6c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/RunText/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/RunText/index.md @@ -1,15 +1,45 @@ -`HRESULT RunText([in] BSTR commands, [out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: RunText} +- {type: text, text: (} +- {type: parameter, text: commands} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Runs all the commands for the document creation using a single command. Compared to [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) where only one command at a time is allowed, *CDocBuilder.RunText* makes it possible to enter all the commands for the document creation at once. +Runs all the commands for the document creation using a single command. Compared to [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) where only one command at a time is allowed, `CDocBuilder.RunText` makes it possible to enter all the commands for the document creation at once. -> Please note, that for the *.docbuilder* file the *CDocBuilder.RunText* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.RunText` method is not used. ## Parameters -| Name | Type | Description | -| ---------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| *commands* | BSTR | The commands which will be used to create the document file (in COM, the escape character must be used when the command contains quotation symbols). All the commands containing *builder.* are line separated, i.e. you cannot write them in one line, each command **must** start with its own line. | -| *result* | VARIANT\_BOOL\* | Specifies if the operation of running the commands is successful or not. | + + +- commands + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The commands which will be used to create the document file (in COM, the escape character must be used when the command contains quotation symbols). All the commands containing `builder.` are line separated, i.e. you cannot write them in one line, each command must start with its own line. + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies if the operation of running the commands is successful or not. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/SaveFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/SaveFile/index.md index 2da6ccc2f..ffd86b016 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/SaveFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/SaveFile/index.md @@ -1,14 +1,55 @@ -`HRESULT SaveFile([in] BSTR type, [in] BSTR path, [out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: SaveFile} +- {type: text, text: (} +- {type: parameter, text: type} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: path} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description Saves the file after all the changes are made. The type of the file which will be saved needs to be set. ## Parameters -| Name | Type | Description | -| -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *type* | BSTR | The file extension. The following values are possible: **docx**, **odt**, **rtf**, **txt**, **pptx**, **xlsx**, **ods**, **csv**, **pdf** (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). | -| *path* | BSTR | The path to the file to be saved together with its name and extension. | -| *result* | VARIANT\_BOOL\* | Specifies if the operation of saving a file is successful or not. | + + +- type + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The file extension. The following values are possible: `docx`, `odt`, `rtf`, `txt`, `pptx`, `xlsx`, `ods`, `csv`, `pdf` (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). + +- path + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The path to the file to be saved together with its name and extension. + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies if the operation of saving a file is successful or not. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/SetProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/SetProperty/index.md index db259b258..726d066fd 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/SetProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/SetProperty/index.md @@ -1,31 +1,125 @@ -`HRESULT SetProperty([in] BSTR key, [in] BSTR value);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: SetProperty} +- {type: text, text: (} +- {type: parameter, text: key} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: value} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: )} +``` + +## Description -Sets an argument to the builder class which can be trasferred to the program outside the [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) method, i.e. either as an additional property when running **ONLYOFFICE Document Builder** executable file or as a part of program code, but not included into the document file script. +Sets an argument to the builder class which can be trasferred to the program outside the [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) method, i.e. either as an additional property when running ONLYOFFICE Document Builder executable file or as a part of program code, but not included into the document file script. -> Please note, that for the *.docbuilder* file the *CDocBuilder.SetProperty* method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilder.SetProperty` method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below. ## Parameters -| Name | Type | Description | -| ------- | ---- | ------------------------------------------------------- | -| *key* | BSTR | The parameter name, the value is always *--argument*. | -| *value* | BSTR | The parameter value which will be used in the document. | + + +- key + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The parameter name, the value is always `--argument`. + +- value + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The parameter value which will be used in the document. + + ## Supported properties -| Name | Type | Default | Description | -| --------------------------- | ------------- | ------- | -------------------------------------------------------------------------------------------------------------------------- | -| *--use-doctrenderer-scheme* | VARIANT\_BOOL | false | Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. | -| *--check-fonts* | VARIANT\_BOOL | true | Specifies if the system fonts are cached for faster work. | -| *--work-directory* | BSTR | "" | The path to the temporary directory. | -| *--cache-scripts* | VARIANT\_BOOL | true | Specifies if the sdkjs scripts are cached. | -| *--save-use-only-names* | VARIANT\_BOOL | false | Specifies if the destination paths are used (for server work). For example: /home/user/1.txt => /tmp/1.txt | -| *--all-fonts-path* | BSTR | "" | The path to the *AllFonts.js* script. | -| *--argument* | BSTR | "" | The JSON argument which is sent to the global parameters of all the opened JS context. | -| *--fonts-system* | VARIANT\_BOOL | true | Specifies if the system fonts are used. | -| *--fonts-dir* | BSTR | "" | The path to the additional fonts directory (may be many records). | + + +- --use-doctrenderer-scheme, default: false + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL} + ``` + + - : Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. + +- --check-fonts, default: true + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL} + ``` + + - : Specifies if the system fonts are cached for faster work. + +- --work-directory, default: "" + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The path to the temporary directory. + +- --cache-scripts, default: true + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL} + ``` + + - : Specifies if the sdkjs scripts are cached. + +- --save-use-only-names, default: false + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL} + ``` + + - : Specifies if the destination paths are used (for server work). For example: `/home/user/1.txt` => `/tmp/1.txt`. + +- --all-fonts-path, default: "" + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The path to the `AllFonts.js` script. + +- --argument, default: "" + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The JSON argument which is sent to the global parameters of all the opened JS context. + +- --fonts-system, default: true + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL} + ``` + + - : Specifies if the system fonts are used. + +- --fonts-dir, default: "" + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The path to the additional fonts directory (may be many records). + + -Once added, the argument will be available as the **Argument** variable with its parameter values set: +Once added, the argument will be available as the `Argument` variable with its parameter values set: ``` cpp Argument.name === "ONLYOFFICE" // true @@ -51,7 +145,7 @@ docbuilder.exe "--argument={\"name\":\"ONLYOFFICE\"}" test.docbuilder; ## Adding or removing fonts -It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the **check-fonts** variable is used: +It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the `check-fonts` variable is used: ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/SetTmpFolder/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/SetTmpFolder/index.md index 91df1f999..289cab245 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/SetTmpFolder/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/SetTmpFolder/index.md @@ -1,12 +1,31 @@ -`HRESULT SetTmpFolder([in] BSTR folder);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: SetTmpFolder} +- {type: text, text: (} +- {type: parameter, text: folder} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: )} +``` + +## Description Sets the path to the folder where the program will temporarily save files needed for the program correct work. After the successful document file creation, all the files will be deleted from the folder. If no temporary folder is set, the system one will be used. ## Parameters -| Name | Type | Description | -| -------- | ---- | --------------------------------------------------------------- | -| *folder* | BSTR | The path to the folder where the temporary files will be saved. | + + +- folder + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The path to the folder where the temporary files will be saved. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/WriteData/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/WriteData/index.md index d4ecfae13..1e2c6e9d0 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/WriteData/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/WriteData/index.md @@ -1,16 +1,57 @@ -`HRESULT WriteData([in] BSTR path, [in] BSTR value, [in] VARIANT_BOOL append);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: WriteData} +- {type: text, text: (} +- {type: parameter, text: path} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: value} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: append} +- {type: text, text: ": [in] "} +- {type: type, text: VARIANT_BOOL} +- {type: text, text: )} +``` + +## Description Writes data to the log file. It is used for logs in JS code. -> Please note, that for the *.docbuilder* file the *CDocBuilder.WriteData* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.WriteData` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------------- | ---------------------------------------------------------------------------------------------------------- | -| *path* | BSTR | The path to the file where all the logs will be written. | -| *value* | BSTR | The data which will be written to the log file. | -| *append* | VARIANT\_BOOL | Specifies if the new data will be appended to the already existing log file or a new file will be created. | + + +- path + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The path to the file where all the logs will be written. + +- value + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The data which will be written to the log file. + +- append + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL} + ``` + + - : Specifies if the new data will be appended to the already existing log file or a new file will be created. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/index.md index 59b7c465e..53cb648d7 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilder/index.md @@ -1,25 +1,48 @@ -`new CDocBuilder` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilder} +``` -Base class used by **ONLYOFFICE Document Builder** for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. +## Description -## Methods +Base class used by ONLYOFFICE Document Builder for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. -| Name | Description | -| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [CloseFile](CloseFile/index.md) | Closes the file to stop working with it. | -| [CreateFile](CreateFile/index.md) | Creates a new file. | -| [CreateInstance](CreateInstance/index.md) | Creates an instance of the *CDocBuilder* class. | -| [Dispose](Dispose/index.md) | Unloads the **ONLYOFFICE Document Builder** from the application memory when it is no longer needed. | -| [Execute](Execute/index.md) | Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). The command returns the *I\_DOCBUILDER\_VALUE\*\** value. | -| [ExecuteCommand](ExecuteCommand/index.md) | Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). The command returns the *VARIANT\_BOOL\** value. | -| [GetContext](GetContext/index.md) | Returns the current JS context. | -| [Initialize](Initialize/index.md) | Initializes the **ONLYOFFICE Document Builder** as a library for the application to be able to work with it. | -| [IsSaveWithDoctrendererMode](IsSaveWithDoctrendererMode/index.md) | Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. | -| [OpenFile](OpenFile/index.md) | Opens the document file which will be edited and saved afterwards. | -| [Run](Run/index.md) | Runs the **ONLYOFFICE Document Builder** executable. | -| [RunText](RunText/index.md) | Runs all the commands for the document creation using a single command. | -| [SaveFile](SaveFile/index.md) | Saves the file after all the changes are made. | -| [SetProperty](SetProperty/index.md) | Sets an argument to the builder class which can be transferred to the program outside the [CDocBuilder.ExecuteCommand](ExecuteCommand/index.md) method. | -| [SetTmpFolder](SetTmpFolder/index.md) | Sets the path to the folder where the program will temporarily save files needed for the program correct work. | -| [WriteData](WriteData/index.md) | Writes data to the log file. | -| | +## Instance Methods + + + +- [CloseFile](CloseFile/index.md) + - : Closes the file to stop working with it. +- [CreateFile](CreateFile/index.md) + - : Creates a new file. +- [CreateInstance](CreateInstance/index.md) + - : Creates an instance of the `CDocBuilder` class. +- [Dispose](Dispose/index.md) + - : Unloads the ONLYOFFICE Document Builder from the application memory when it is no longer needed. +- [Execute](Execute/index.md) + - : Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). The command returns the [I_DOCBUILDER_VALUE**](../CDocBuilderValue/index.md) value. +- [ExecuteCommand](ExecuteCommand/index.md) + - : Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). +- [GetContext](GetContext/index.md) + - : Returns the current JS context. +- [Initialize](Initialize/index.md) + - : Initializes the ONLYOFFICE Document Builder as a library for the application to be able to work with it. +- [IsSaveWithDoctrendererMode](IsSaveWithDoctrendererMode/index.md) + - : Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. +- [OpenFile](OpenFile/index.md) + - : Opens the document file which will be edited and saved afterwards. +- [Run](Run/index.md) + - : Runs the ONLYOFFICE Document Builder executable. +- [RunText](RunText/index.md) + - : Runs all the commands for the document creation using a single command. +- [SaveFile](SaveFile/index.md) + - : Saves the file after all the changes are made. +- [SetProperty](SetProperty/index.md) + - : Sets an argument which can be transferred to the program outside the [CDocBuilder.ExecuteCommand](ExecuteCommand/index.md) method. +- [SetTmpFolder](SetTmpFolder/index.md) + - : Sets the path to the folder where the program will temporarily save files needed for the program correct work. +- [WriteData](WriteData/index.md) + - : Writes data to the log file. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateArray/index.md index b88f86b77..9ea1bde57 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateArray/index.md @@ -1,15 +1,45 @@ -`HRESULT CreateArray([in] long length, [out, retval] I_DOCBUILDER_VALUE** result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: CreateArray} +- {type: text, text: (} +- {type: parameter, text: length} +- {type: text, text: ": [in] "} +- {type: type, text: long} +- {type: text, text: ", "} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} +- {type: text, text: )} +``` + +## Description -Creates an array value, an analogue of *new Array (length)* in JS. +Creates an array value, an analogue of `new Array (length)` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateArray` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------------------------ | ------------------- | -| *length* | long | The array length. | -| *result* | I\_DOCBUILDER\_VALUE\*\* | The returned array. | + + +- length + + ```yml signature.variant="inline" + - {type: type, text: long} + ``` + + - : The array length. + +- result + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} + ``` + + - : The returned array. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateNull/index.md index 9decfbced..900e61766 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateNull/index.md @@ -1,14 +1,33 @@ -`HRESULT CreateNull([out, retval] I_DOCBUILDER_VALUE** result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: CreateNull} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} +- {type: text, text: )} +``` + +## Description -Creates a null value, an analogue of *null* in JS. +Creates a null value, an analogue of `null` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateNull* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateNull` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------------------------ | ------------------------ | -| *result* | I\_DOCBUILDER\_VALUE\*\* | The returned null value. | + + +- result + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} + ``` + + - : The returned null value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateObject/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateObject/index.md index a77e3209e..50a3b3032 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateObject/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateObject/index.md @@ -1,14 +1,33 @@ -`HRESULT CreateObject([out, retval] I_DOCBUILDER_VALUE** result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: CreateObject} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} +- {type: text, text: )} +``` + +## Description -Creates an empty object, an analogue of *{}* in JS. +Creates an empty object, an analogue of `{}` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateObject* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateObject` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------------------------ | -------------------------- | -| *result* | I\_DOCBUILDER\_VALUE\*\* | The returned empty object. | + + +- result + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} + ``` + + - : The returned empty object. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateScope/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateScope/index.md index d0d6fc46d..88911ea55 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateScope/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateScope/index.md @@ -1,14 +1,33 @@ -`HRESULT CreateScope([out, retval] I_DOCBUILDER_CONTEXT_SCOPE** result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: CreateScope} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {id: ../../CDocBuilderContextScope/index.md, token: {type: type, text: I_DOCBUILDER_CONTEXT_SCOPE**}} +- {type: text, text: )} +``` + +## Description Creates a [context scope](../../CDocBuilderContextScope/index.md) which sets the execution context for all operations executed within a local scope. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateScope* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateScope` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------------------------- | --------------------------- | -| *result* | I\_DOCBUILDER\_CONTEXT\_SCOPE\*\* | The returned context scope. | + + +- result + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderContextScope/index.md, token: {type: type, text: I_DOCBUILDER_CONTEXT_SCOPE**}} + ``` + + - : The returned context scope. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateTypedArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateTypedArray/index.md index 2e070c350..7ed6259b3 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateTypedArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateTypedArray/index.md @@ -1,16 +1,57 @@ -`HRESULT CreateTypedArray([in] VARIANT buffer, [in] long length, [out, retval] I_DOCBUILDER_VALUE** result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: CreateTypedArray} +- {type: text, text: (} +- {type: parameter, text: buffer} +- {type: text, text: ": [in] "} +- {type: type, text: VARIANT} +- {type: text, text: ", "} +- {type: parameter, text: length} +- {type: text, text: ": [in] "} +- {type: type, text: long} +- {type: text, text: ", "} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} +- {type: text, text: )} +``` + +## Description -Creates a Uint8Array value, an analogue of *Uint8Array* in JS. +Creates a Uint8Array value, an analogue of `Uint8Array` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateTypedArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateTypedArray` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------------------------ | ------------------------- | -| *buffer* | VARIANT | The array buffer. | -| *length* | long | The array length. | -| *result* | I\_DOCBUILDER\_VALUE\*\* | The returned typed array. | + + +- buffer + + ```yml signature.variant="inline" + - {type: type, text: VARIANT} + ``` + + - : The array buffer. + +- length + + ```yml signature.variant="inline" + - {type: type, text: long} + ``` + + - : The array length. + +- result + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} + ``` + + - : The returned typed array. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateUndefined/index.md index f8b5853a3..600c5a524 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/CreateUndefined/index.md @@ -1,14 +1,33 @@ -`HRESULT CreateUndefined([out, retval] I_DOCBUILDER_VALUE** result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: CreateUndefined} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} +- {type: text, text: )} +``` + +## Description -Creates an undefined value, an analogue of *undefined* in JS. +Creates an undefined value, an analogue of `undefined` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateUndefined` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------------------------ | ----------------------------- | -| *result* | I\_DOCBUILDER\_VALUE\*\* | The returned undefined value. | + + +- result + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} + ``` + + - : The returned undefined value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/GetGlobal/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/GetGlobal/index.md index f7aaf377d..ffbd9c3f2 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/GetGlobal/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/GetGlobal/index.md @@ -1,14 +1,33 @@ -`HRESULT GetGlobal([out, retval] I_DOCBUILDER_VALUE** result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: GetGlobal} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} +- {type: text, text: )} +``` + +## Description Returns the global object for the current context. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.GetGlobal* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.GetGlobal` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------------------------ | --------------------------- | -| *result* | I\_DOCBUILDER\_VALUE\*\* | The returned global object. | + + +- result + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} + ``` + + - : The returned global object. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/IsError/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/IsError/index.md index 533f8cc03..fd9b1b75e 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/IsError/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/IsError/index.md @@ -1,14 +1,33 @@ -`HRESULT IsError([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsError} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description Checks for errors in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.IsError* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.IsError` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | ---------------------------------- | -| *result* | VARIANT\_BOOL\* | Specifies whether an error occurs. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies whether an error occurs. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/index.md index e345b1a32..4e6118e86 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContext/index.md @@ -1,16 +1,32 @@ -`new CDocBuilderContext` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderContext} +``` -Class used by **ONLYOFFICE Document Builder** for getting JS context for working. +## Description -## Methods +Class used by ONLYOFFICE Document Builder for getting JS context for working. -| Name | Description | -| --------------------------------------------- | -------------------------------------------------------------- | -| [CreateArray](CreateArray/index.md) | Creates an array, an analogue of *new Array (length)* in JS. | -| [CreateNull](CreateNull/index.md) | Creates a null value, an analogue of *null* in JS. | -| [CreateObject](CreateObject/index.md) | Creates an empty object, an analogue of *{}* in JS. | -| [CreateScope](CreateScope/index.md) | Creates a context scope. | -| [CreateTypedArray](CreateTypedArray/index.md) | Creates a Uint8Array value, an analogue of *Uint8Array* in JS. | -| [CreateUndefined](CreateUndefined/index.md) | Creates an undefined value, an analogue of *undefined* in JS. | -| [GetGlobal](GetGlobal/index.md) | Returns the global object for the current context. | -| [IsError](IsError/index.md) | Checks for errors in JS. | +## Instance Methods + + + +- [CreateArray](CreateArray/index.md) + - : Creates an array, an analogue of `new Array (length)` in JS. +- [CreateNull](CreateNull/index.md) + - : Creates a null value, an analogue of `null` in JS. +- [CreateObject](CreateObject/index.md) + - : Creates an empty object, an analogue of `{}` in JS. +- [CreateScope](CreateScope/index.md) + - : Creates a context scope. +- [CreateTypedArray](CreateTypedArray/index.md) + - : Creates a Uint8Array value, an analogue of `Uint8Array` in JS. +- [CreateUndefined](CreateUndefined/index.md) + - : Creates an undefined value, an analogue of `undefined` in JS. +- [GetGlobal](GetGlobal/index.md) + - : Returns the global object for the current context. +- [IsError](IsError/index.md) + - : Checks for errors in JS. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContextScope/Close/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContextScope/Close/index.md index c73f1b6be..995bc9e19 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContextScope/Close/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContextScope/Close/index.md @@ -1,8 +1,16 @@ -`HRESULT Close();` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: Close} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Closes the current scope. This method will be called automatically when the descructor is executed. -> Please note, that for the *.docbuilder* file the *CDocBuilderContextScope.Close* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContextScope.Close` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContextScope/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContextScope/index.md index 83f7cfb6e..cd60ed76c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContextScope/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderContextScope/index.md @@ -1,9 +1,18 @@ -`new CDocBuilderContextScope` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderContextScope} +``` -The stack-allocated class used by **ONLYOFFICE Document Builder** which sets the execution context for all operations executed within a local scope. All opened scopes will be closed automatically when the builder [CloseFile](../CDocBuilder/CloseFile/index.md) method is called. +## Description -## Methods +The stack-allocated class used by ONLYOFFICE Document Builder which sets the execution context for all operations executed within a local scope. All opened scopes will be closed automatically when the builder [CloseFile](../CDocBuilder/CloseFile/index.md) method is called. -| Name | Description | -| ----------------------- | ------------------------- | -| [Close](Close/index.md) | Closes the current scope. | +## Instance Methods + + + +- [Close](Close/index.md) + - : Closes the current scope. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Call/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Call/index.md index 0c581d466..8888d93bc 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Call/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Call/index.md @@ -1,16 +1,77 @@ -`HRESULT Call([in] BSTR name, [in, optional] VARIANT val1, [in, optional] VARIANT val2, [in, optional] VARIANT val3, [in, optional] VARIANT val4, [in, optional] VARIANT val5, [in, optional] VARIANT val6, [out, retval] I_DOCBUILDER_VALUE** result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: Call} +- {type: text, text: (} +- {type: parameter, text: name} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: val1} +- {type: text, text: ": [in, optional] "} +- {type: type, text: VARIANT} +- {type: text, text: ", "} +- {type: parameter, text: val2} +- {type: text, text: ": [in, optional] "} +- {type: type, text: VARIANT} +- {type: text, text: ", "} +- {type: parameter, text: val3} +- {type: text, text: ": [in, optional] "} +- {type: type, text: VARIANT} +- {type: text, text: ", "} +- {type: parameter, text: val4} +- {type: text, text: ": [in, optional] "} +- {type: type, text: VARIANT} +- {type: text, text: ", "} +- {type: parameter, text: val5} +- {type: text, text: ": [in, optional] "} +- {type: type, text: VARIANT} +- {type: text, text: ", "} +- {type: parameter, text: val6} +- {type: text, text: ": [in, optional] "} +- {type: type, text: VARIANT} +- {type: text, text: ", "} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} +- {type: text, text: )} +``` + +## Description Calls the specified Document Builder method. See the [Text document API](../../../../../Office%20API/Usage%20API/Text%20Document%20API/index.md), [Spreadsheet API](../../../../../Office%20API/Usage%20API/Spreadsheet%20API/index.md), [Presentation API](../../../../../Office%20API/Usage%20API/Presentation%20API/index.md), or [Form API](../../../../../Office%20API/Usage%20API/Form%20API/index.md) sections for more information which methods are available for various document types. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Call* method is not used explicitly. The method itself is used instead. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Call` method is not used explicitly. The method itself is used instead. See the example below. ## Parameters -| Name | Type | Description | -| ----------- | ------------------------ | ------------------------------------------------------------------- | -| *name* | BSTR | The name of the Document Builder method. | -| *val1-val6* | VARIANT | The parameters that the Document Builder method takes as arguments. | -| *result* | I\_DOCBUILDER\_VALUE\*\* | The returned method value. | + + +- name + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The name of the Document Builder method. + +- val1-val6 + + ```yml signature.variant="inline" + - {type: type, text: VARIANT} + ``` + + - : The parameters that the Document Builder method takes as arguments. + +- result + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} + ``` + + - : The returned method value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Clear/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Clear/index.md index 08d57d479..8e878d370 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Clear/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Clear/index.md @@ -1,8 +1,16 @@ -`HRESULT Clear();` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: Clear} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Clears the **CDocBuilderValue** object. +Clears the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Clear* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Clear` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/CreateInstance/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/CreateInstance/index.md index 78be2c593..e7ebeaaf4 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/CreateInstance/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/CreateInstance/index.md @@ -1,14 +1,33 @@ -`HRESULT CreateInstance([in, optional] VARIANT value);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: CreateInstance} +- {type: text, text: (} +- {type: parameter, text: value} +- {type: text, text: ": [in, optional] "} +- {type: type, text: VARIANT} +- {type: text, text: )} +``` + +## Description -Creates an instance of the *CDocBuilderValue* class. +Creates an instance of the `CDocBuilderValue` class. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.CreateInstance* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.CreateInstance` method is not used. ## Parameters -| Name | Type | Description | -| ------- | ------- | ----------------------------------------------- | -| *value* | VARIANT | A value from which an instance will be created. | + + +- value + + ```yml signature.variant="inline" + - {type: type, text: VARIANT} + ``` + + - : A value from which an instance will be created. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Get/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Get/index.md index 230e19afc..94220ab94 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Get/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Get/index.md @@ -1,15 +1,45 @@ -`HRESULT Get([in] long index, [out, retval] I_DOCBUILDER_VALUE** result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: Get} +- {type: text, text: (} +- {type: parameter, text: index} +- {type: text, text: ": [in] "} +- {type: type, text: long} +- {type: text, text: ", "} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} +- {type: text, text: )} +``` + +## Description Returns an array value by its index. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Get* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Get` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------------------------ | ----------------------------- | -| *index* | long | The index of the array value. | -| *result* | I\_DOCBUILDER\_VALUE\*\* | The returned array value. | + + +- index + + ```yml signature.variant="inline" + - {type: type, text: long} + ``` + + - : The index of the array value. + +- result + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} + ``` + + - : The returned array value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/GetLength/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/GetLength/index.md index d12a080e9..313780669 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/GetLength/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/GetLength/index.md @@ -1,14 +1,33 @@ -`HRESULT GetLength([out, retval] long* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: GetLength} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: long*} +- {type: text, text: )} +``` + +## Description -Returns the length if the **CDocBuilderValue** object is an array/typed array. Otherwise, returns 0. +Returns the length if the `CDocBuilderValue` object is an array/typed array. Otherwise, returns 0. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.GetLength* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.GetLength` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------ | --------------------------- | -| *result* | long\* | The returned object length. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: long*} + ``` + + - : The returned object length. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/GetProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/GetProperty/index.md index 5760206da..622a7306f 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/GetProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/GetProperty/index.md @@ -1,15 +1,45 @@ -`HRESULT GetProperty([in] BSTR name, [out, retval] I_DOCBUILDER_VALUE** result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: GetProperty} +- {type: text, text: (} +- {type: parameter, text: name} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} +- {type: text, text: )} +``` + +## Description -Returns a property of the **CDocBuilderValue** object. +Returns a property of the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.GetProperty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.GetProperty` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------------------------ | ----------------------------------------------------- | -| *name* | BSTR | The name of the **CDocBuilderValue** object property. | -| *result* | I\_DOCBUILDER\_VALUE\*\* | The returned object property. | + + +- name + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The name of the `CDocBuilderValue` object property. + +- result + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} + ``` + + - : The returned object property. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsArray/index.md index e766ef819..e185c8ed0 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsArray/index.md @@ -1,14 +1,33 @@ -`HRESULT IsArray([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsArray} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an array. +Returns true if the `CDocBuilderValue` object is an array. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsArray` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | -------------------------------------------------------------- | -| *result* | VARIANT\_BOOL\* | Specifies whether the **CDocBuilderValue** object is an array. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies whether the `CDocBuilderValue` object is an array. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsBool/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsBool/index.md index 1057ec2ef..ee0fa465b 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsBool/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsBool/index.md @@ -1,14 +1,33 @@ -`HRESULT IsBool([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsBool} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a boolean value. +Returns true if the `CDocBuilderValue` object is a boolean value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsBool* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsBool` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | --------------------------------------------------------------------- | -| *result* | VARIANT\_BOOL\* | Specifies whether the **CDocBuilderValue** object is a boolean value. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies whether the `CDocBuilderValue` object is a boolean value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsDouble/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsDouble/index.md index 49098c44e..26fc9a9c0 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsDouble/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsDouble/index.md @@ -1,14 +1,33 @@ -`HRESULT IsDouble([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsDouble} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a double value. +Returns true if the `CDocBuilderValue` object is a double value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsDouble* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsDouble` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | -------------------------------------------------------------------- | -| *result* | VARIANT\_BOOL\* | Specifies whether the **CDocBuilderValue** object is a double value. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies whether the `CDocBuilderValue` object is a double value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsEmpty/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsEmpty/index.md index 72865a002..536f4151c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsEmpty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsEmpty/index.md @@ -1,14 +1,33 @@ -`HRESULT IsEmpty([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsEmpty} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is empty. +Returns true if the `CDocBuilderValue` object is empty. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsEmpty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsEmpty` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | ----------------------------------------------------------- | -| *result* | VARIANT\_BOOL\* | Specifies whether the **CDocBuilderValue** object is empty. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies whether the `CDocBuilderValue` object is empty. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsFunction/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsFunction/index.md index e1f19ed44..187180653 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsFunction/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsFunction/index.md @@ -1,14 +1,33 @@ -`HRESULT IsFunction([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsFunction} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a function. +Returns true if the `CDocBuilderValue` object is a function. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsFunction* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsFunction` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | ---------------------------------------------------------------- | -| *result* | VARIANT\_BOOL\* | Specifies whether the **CDocBuilderValue** object is a function. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies whether the `CDocBuilderValue` object is a function. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsInt/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsInt/index.md index dcd9093b3..b11b94b6f 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsInt/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsInt/index.md @@ -1,14 +1,33 @@ -`HRESULT IsInt([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsInt} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an integer. +Returns true if the `CDocBuilderValue` object is an integer. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsInt* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsInt` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | ---------------------------------------------------------------- | -| *result* | VARIANT\_BOOL\* | Specifies whether the **CDocBuilderValue** object is an integer. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies whether the `CDocBuilderValue` object is an integer. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsNull/index.md index ed40da38f..ccd345173 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsNull/index.md @@ -1,14 +1,33 @@ -`HRESULT IsNull([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsNull} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is null. +Returns true if the `CDocBuilderValue` object is null. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsNull* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsNull` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | ---------------------------------------------------------- | -| *result* | VARIANT\_BOOL\* | Specifies whether the **CDocBuilderValue** object is null. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies whether the `CDocBuilderValue` object is null. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsObject/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsObject/index.md index 1296b9ce9..1735ad33c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsObject/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsObject/index.md @@ -1,14 +1,33 @@ -`HRESULT IsObject([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsObject} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an object. +Returns true if the `CDocBuilderValue` object is an object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsObject* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsObject` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | ------------------------------------------------------------ | -| *result* | VARIANT\_BOOL\* | Specifies whether the **CDocBuilderValue** object an object. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies whether the `CDocBuilderValue` object is an object. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsString/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsString/index.md index 5dcca068a..701eb7322 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsString/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsString/index.md @@ -1,14 +1,33 @@ -`HRESULT IsString([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsString} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a string. +Returns true if the `CDocBuilderValue` object is a string. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsString* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsString` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | -------------------------------------------------------------- | -| *result* | VARIANT\_BOOL\* | Specifies whether the **CDocBuilderValue** object is a string. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies whether the `CDocBuilderValue` object is a string. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsTypedArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsTypedArray/index.md index d69484edc..81b85c49c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsTypedArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsTypedArray/index.md @@ -1,14 +1,33 @@ -`HRESULT IsTypedArray([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsTypedArray} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a typed array. +Returns true if the `CDocBuilderValue` object is a typed array. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsTypedArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsTypedArray` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | ------------------------------------------------------------------- | -| *result* | VARIANT\_BOOL\* | Specifies whether the **CDocBuilderValue** object is a typed array. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies whether the `CDocBuilderValue` object is a typed array. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsUndefined/index.md index 50f6ba34a..c86e327f3 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/IsUndefined/index.md @@ -1,14 +1,33 @@ -`HRESULT IsUndefined([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: IsUndefined} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is undefined. +Returns true if the `CDocBuilderValue` object is undefined. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsUndefined` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | --------------------------------------------------------------- | -| *result* | VARIANT\_BOOL\* | Specifies whether the **CDocBuilderValue** object is undefined. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : Specifies whether the `CDocBuilderValue` object is undefined. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Set/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Set/index.md index 07aa49ecc..41d32cd6c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Set/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/Set/index.md @@ -1,15 +1,45 @@ -`HRESULT Set([in] long index, [in] I_DOCBUILDER_VALUE* value);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: Set} +- {type: text, text: (} +- {type: parameter, text: index} +- {type: text, text: ": [in] "} +- {type: type, text: long} +- {type: text, text: ", "} +- {type: parameter, text: value} +- {type: text, text: ": [in] "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} +- {type: text, text: )} +``` + +## Description Sets an array value by its index. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Set* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Set` method is not used. ## Parameters -| Name | Type | Description | -| ------- | ---------------------- | ----------------------------- | -| *index* | long | The index of the array value. | -| *value* | I\_DOCBUILDER\_VALUE\* | The array value to be set. | + + +- index + + ```yml signature.variant="inline" + - {type: type, text: long} + ``` + + - : The index of the array value. + +- value + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} + ``` + + - : The array value to be set. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/SetProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/SetProperty/index.md index df99b6d8d..181937989 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/SetProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/SetProperty/index.md @@ -1,15 +1,45 @@ -`HRESULT SetProperty([in] BSTR name, [in] I_DOCBUILDER_VALUE* value);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: SetProperty} +- {type: text, text: (} +- {type: parameter, text: name} +- {type: text, text: ": [in] "} +- {type: type, text: BSTR} +- {type: text, text: ", "} +- {type: parameter, text: value} +- {type: text, text: ": [in] "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} +- {type: text, text: )} +``` + +## Description -Sets a property to the **CDocBuilderValue** object. +Sets a property to the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.SetProperty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.SetProperty` method is not used. ## Parameters -| Name | Type | Description | -| ------- | ---------------------- | ------------------------------------------------------ | -| *name* | BSTR | The name of the **CDocBuilderValue** object property. | -| *value* | I\_DOCBUILDER\_VALUE\* | The value of the **CDocBuilderValue** object property. | + + +- name + + ```yml signature.variant="inline" + - {type: type, text: BSTR} + ``` + + - : The name of the `CDocBuilderValue` object property. + +- value + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: I_DOCBUILDER_VALUE**}} + ``` + + - : The value of the `CDocBuilderValue` object property. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToBool/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToBool/index.md index 233a2665c..e6dd9d927 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToBool/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToBool/index.md @@ -1,14 +1,33 @@ -`HRESULT ToBool([out, retval] VARIANT_BOOL* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: ToBool} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: VARIANT_BOOL*} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a boolean value. +Converts the `CDocBuilderValue` object to a boolean value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToBool* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToBool` method is not used. ## Parameters -| Name | Type | Description | -| -------- | --------------- | --------------------------- | -| *result* | VARIANT\_BOOL\* | The returned boolean value. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: VARIANT_BOOL*} + ``` + + - : The returned boolean value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToDouble/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToDouble/index.md index aae87555a..6c1b17f2d 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToDouble/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToDouble/index.md @@ -1,14 +1,33 @@ -`HRESULT ToDouble([out, retval] double* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: ToDouble} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: double*} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a double value. +Converts the `CDocBuilderValue` object to a double value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToDouble* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToDouble` method is not used. ## Parameters -| Name | Type | Description | -| -------- | -------- | -------------------------- | -| *result* | double\* | The returned double value. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: double*} + ``` + + - : The returned double value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToInt/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToInt/index.md index 2cdd611e6..aba24289b 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToInt/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToInt/index.md @@ -1,14 +1,33 @@ -`HRESULT ToInt([out, retval] long* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: ToInt} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: long*} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to an integer. +Converts the `CDocBuilderValue` object to an integer. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToInt* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToInt` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------ | --------------------------- | -| *result* | long\* | The returned integer value. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: long*} + ``` + + - : The returned integer value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToString/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToString/index.md index e8351ac31..6d16e8f1a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToString/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/ToString/index.md @@ -1,14 +1,33 @@ -`HRESULT ToString([out, retval] BSTR* result);` +```yml signature +- {type: type, text: HRESULT} +- {type: text, text: " "} +- {type: entity, text: ToString} +- {type: text, text: (} +- {type: parameter, text: result} +- {type: text, text: ": [out, retval] "} +- {type: type, text: BSTR*} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a string. +Converts the `CDocBuilderValue` object to a string. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToString* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToString` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------ | -------------------------- | -| *result* | BSTR\* | The returned string value. | + + +- result + + ```yml signature.variant="inline" + - {type: type, text: BSTR*} + ``` + + - : The returned string value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/index.md index 9626acc67..b085f6f7e 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/CDocBuilderValue/index.md @@ -1,31 +1,62 @@ -`new CDocBuilderValue` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderValue} +``` -Class used by **ONLYOFFICE Document Builder** for getting the results of called JS commands. It represents a wrapper for a JS object. +## Description -## Methods +Class used by ONLYOFFICE Document Builder for getting the results of called JS commands. It represents a wrapper for a JS object. -| Name | Description | -| ----------------------------------------- | ---------------------------------------------------------- | -| [Call](Call/index.md) | Calls the specified Document Builder method. | -| [Clear](Clear/index.md) | Clears the object. | -| [CreateInstance](CreateInstance/index.md) | Creates an instance of the *CDocBuilderValue* class. | -| [Get](Get/index.md) | Returns an array value by its index. | -| [GetLength](GetLength/index.md) | Returns the length if this object is an array/typed array. | -| [GetProperty](GetProperty/index.md) | Returns a property of this object. | -| [IsArray](IsArray/index.md) | Returns true if this object is an array. | -| [IsBool](IsBool/index.md) | Returns true if this object is a boolean value. | -| [IsDouble](IsDouble/index.md) | Returns true if this object is a double value. | -| [IsEmpty](IsEmpty/index.md) | Returns true if this object is empty. | -| [IsFunction](IsFunction/index.md) | Returns true if this object is a function. | -| [IsInt](IsInt/index.md) | Returns true if this object is an integer. | -| [IsNull](IsNull/index.md) | Returns true if this object is null. | -| [IsObject](IsObject/index.md) | Returns true if this object is an object. | -| [IsString](IsString/index.md) | Returns true if this object is a string. | -| [IsTypedArray](IsTypedArray/index.md) | Returns true if this object is a typed array. | -| [IsUndefined](IsUndefined/index.md) | Returns true if this object is undefined. | -| [Set](Set/index.md) | Sets an array value by its index. | -| [SetProperty](SetProperty/index.md) | Sets a property to this object. | -| [ToBool](ToBool/index.md) | Converts this object to a boolean value. | -| [ToDouble](ToDouble/index.md) | Converts this object to a double value. | -| [ToInt](ToInt/index.md) | Converts this object to an integer. | -| [ToString](ToString/index.md) | Converts this object to a string. | +## Instance Methods + + + +- [Call](Call/index.md) + - : Calls the specified Document Builder method. +- [Clear](Clear/index.md) + - : Clears the object. +- [CreateInstance](CreateInstance/index.md) + - : Creates an instance of the `CDocBuilderValue` class. +- [Get](Get/index.md) + - : Returns an array value by its index. +- [GetLength](GetLength/index.md) + - : Returns the length if this object is an array/typed array. +- [GetProperty](GetProperty/index.md) + - : Returns a property of this object. +- [IsArray](IsArray/index.md) + - : Returns true if this object is an array. +- [IsBool](IsBool/index.md) + - : Returns true if this object is a boolean value. +- [IsDouble](IsDouble/index.md) + - : Returns true if this object is a double value. +- [IsEmpty](IsEmpty/index.md) + - : Returns true if this object is empty. +- [IsFunction](IsFunction/index.md) + - : Returns true if this object is a function. +- [IsInt](IsInt/index.md) + - : Returns true if this object is an integer. +- [IsNull](IsNull/index.md) + - : Returns true if this object is null. +- [IsObject](IsObject/index.md) + - : Returns true if this object is an object. +- [IsString](IsString/index.md) + - : Returns true if this object is a string. +- [IsTypedArray](IsTypedArray/index.md) + - : Returns true if this object is a typed array. +- [IsUndefined](IsUndefined/index.md) + - : Returns true if this object is undefined. +- [Set](Set/index.md) + - : Sets an array value by its index +- [SetProperty](SetProperty/index.md) + - : Sets a property to this object. +- [ToBool](ToBool/index.md) + - : Converts this object to a boolean value. +- [ToDouble](ToDouble/index.md) + - : Converts this object to a double value. +- [ToInt](ToInt/index.md) + - : Converts this object to an integer. +- [ToString](ToString/index.md) + - : Converts this object to a string. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/COM/index.md b/site/pages/Docs/Document Builder/Builder Framework/COM/index.md index 24f64a824..a6838a57b 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/COM/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/COM/index.md @@ -2,13 +2,24 @@ order: -5 --- -For the integration of **ONLYOFFICE Document Builder** into any application, the COM **doctrenderer** library is used. The current application version contains five main classes: +For the integration of ONLYOFFICE Document Builder into any application, the COM doctrenderer library is used. -- *CDoctrenderer* class - used by **ONLYOFFICE Document Builder** in the file conversion process. -- [CDocBuilder](CDocBuilder/index.md) class - used by **ONLYOFFICE Document Builder** for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. -- [CDocBuilderContext](CDocBuilderContext/index.md) class - used by **ONLYOFFICE Document Builder** for getting JS context for working. -- [CDocBuilderContextScope](CDocBuilderContextScope/index.md) class - the stack-allocated class which sets the execution context for all operations executed within a local scope. -- [CDocBuilderValue](CDocBuilderValue/index.md) class - used by **ONLYOFFICE Document Builder** for getting the results of called JS commands. It represents a wrapper for a JS object. +## Classes + +The current application version contains four main classes: + + + +- [CDocBuilder](CDocBuilder/index.md) + - : Used by ONLYOFFICE Document Builder for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. +- [CDocBuilderContext](CDocBuilderContext/index.md) + - : Used by ONLYOFFICE Document Builder for getting JS context for working. +- [CDocBuilderContextScope](CDocBuilderContextScope/index.md) + - : The stack-allocated class which sets the execution context for all operations executed within a local scope. +- [CDocBuilderValue](CDocBuilderValue/index.md) + - : Used by ONLYOFFICE Document Builder for getting the results of called JS commands. It represents a wrapper for a JS object. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/closeFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/closeFile/index.md index 89898c194..7c72a3253 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/closeFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/closeFile/index.md @@ -1,6 +1,14 @@ -`void closeFile();` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: closeFile} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Closes the file to stop working with it. You can use a single **ONLYOFFICE Document Builder** instance to work with all your files, but you need to close the previous file before you can start working with the next one in this case. +Closes the file to stop working with it. You can use a single ONLYOFFICE Document Builder instance to work with all your files, but you need to close the previous file before you can start working with the next one in this case. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/createFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/createFile/index.md index d2352c3bf..45e8302a7 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/createFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/createFile/index.md @@ -1,12 +1,35 @@ -`boolean createFile(int type);` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: createFile} +- {type: text, text: (} +- {type: parameter, text: type} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: " | "} +- {type: type, text: String} +- {type: text, text: )} +``` + +## Description Creates a new file. The type of the file which will be created needs to be set. ## Parameters -| Name | Type | Description | -| ------ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *type* | int / String | The type of the file to be created set as a hexadecimal integer for the Java code or **docx**, **xlsx**, **pptx**, or **pdf** for the *.docbuilder* script file (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). | + + +- type + + ```yml signature.variant="inline" + - {type: type, text: int} + - {type: text, text: " | "} + - {type: type, text: String} + ``` + + - : The type of the file to be created set as a hexadecimal integer for the Java code or `docx`, `xlsx`, `pptx`, or `pdf` for the `.docbuilder` script file (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/dispose/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/dispose/index.md index 8dca5efc5..2b27689b7 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/dispose/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/dispose/index.md @@ -1,8 +1,16 @@ -`void dispose();` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: dispose} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Unloads the **ONLYOFFICE Document Builder** from the application memory when it is no longer needed. Generally, there is no need to dispose JS before exiting the process, it should happen automatically. It should only be used if the process needs the resources taken up by JS. +Unloads the ONLYOFFICE Document Builder from the application memory when it is no longer needed. Generally, there is no need to dispose JS before exiting the process, it should happen automatically. It should only be used if the process needs the resources taken up by JS. -> Please note, that for the *.docbuilder* file the *CDocBuilder.dispose* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.dispose` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/executeCommand/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/executeCommand/index.md index c8b81b783..fc0f54558 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/executeCommand/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/executeCommand/index.md @@ -1,15 +1,47 @@ -`boolea executeCommand(String command, CDocBuilderValue retValue = 0);` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: executeCommand} +- {type: text, text: (} +- {type: parameter, text: command} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: ", "} +- {type: parameter, text: retValue} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " = "} +- {type: text, text: 0} +- {type: text, text: )} +``` + +## Description Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). See the [Text document API](../../../../../Office%20API/Usage%20API/Text%20Document%20API/index.md), [Spreadsheet API](../../../../../Office%20API/Usage%20API/Spreadsheet%20API/index.md), [Presentation API](../../../../../Office%20API/Usage%20API/Presentation%20API/index.md), or [Form API](../../../../../Office%20API/Usage%20API/Form%20API/index.md) sections for more information which commands are available for various document types. -> Please note, that for the *.docbuilder* file the *CDocBuilder.executeCommand* method is not used explicitly. The command itself is used instead. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilder.executeCommand` method is not used explicitly. The command itself is used instead. See the example below. ## Parameters -| Name | Type | Description | -| ---------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *command* | String | The command in the form of JavaScript code which will be used to create the document file (in Java, the escape character must be used when the command contains quotation symbols). | -| *retValue* | CDocBuilderValue | The command return value. | + + +- command + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The command in the form of JavaScript code which will be used to create the document file (in Java, the escape character must be used when the command contains quotation symbols). + +- retValue, default: 0 + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} + ``` + + - : The command return value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/getContext/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/getContext/index.md index ba6f7226f..21a8fdb71 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/getContext/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/getContext/index.md @@ -1,14 +1,35 @@ -`CDocBuilderContext getContext(boolean enterContext = 0);` +```yml signature +- {id: ../../CDocBuilderContext/index.md, token: {type: type, text: CDocBuilderContext}} +- {type: text, text: " "} +- {type: entity, text: getContext} +- {type: text, text: (} +- {type: parameter, text: enterContext} +- {type: text, text: ": "} +- {type: type, text: boolean} +- {type: text, text: " = "} +- {type: text, text: 0} +- {type: text, text: )} +``` + +## Description Returns the current JS [context](../../CDocBuilderContext/index.md). -> Please note, that for the *.docbuilder* file the *CDocBuilder.getContext* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.getContext` method is not used. ## Parameters -| Name | Type | Description | -| -------------- | ------- | ---------------------------------------------- | -| *enterContext* | boolean | Specifies whether the context will be entered. | + + +- enterContext, default: 0 + + ```yml signature.variant="inline" + - {type: type, text: boolean} + ``` + + - : Specifies whether the context will be entered. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/getVersion/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/getVersion/index.md index 86a89272d..e5db91d4a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/getVersion/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/getVersion/index.md @@ -1,8 +1,16 @@ -`String getVersion();` +```yml signature +- {type: type, text: String} +- {type: text, text: " "} +- {type: entity, text: getVersion} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns the **ONLYOFFICE Document Builder** engine version. +Returns the ONLYOFFICE Document Builder engine version. -> Please note, that for the *.docbuilder* file the *CDocBuilder.getVersion* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.getVersion` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/index.md index acb878099..0bb025ce5 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/index.md @@ -1,23 +1,46 @@ -`new CDocBuilder` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilder} +``` -Base class used by **ONLYOFFICE Document Builder** for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. +## Description -## Methods +Base class used by ONLYOFFICE Document Builder for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. -| Name | Description | -| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| [closeFile](closeFile/index.md) | Closes the file to stop working with it. | -| [createFile](createFile/index.md) | Creates a new file. | -| [dispose](dispose/index.md) | Unloads the **ONLYOFFICE Document Builder** from the application memory when it is no longer needed. | -| [executeCommand](executeCommand/index.md) | Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). | -| [getContext](getContext/index.md) | Returns the current JS context. | -| [getVersion](getVersion/index.md) | Returns the **ONLYOFFICE Document Builder** engine version. | -| [initialize](initialize/index.md) | Initializes the **ONLYOFFICE Document Builder** as a library for the application to be able to work with it. | -| [isSaveWithDoctrendererMode](isSaveWithDoctrendererMode/index.md) | Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. | -| [openFile](openFile/index.md) | Opens the document file which will be edited and saved afterwards. | -| [run](run/index.md) | Runs the **ONLYOFFICE Document Builder** executable. | -| [runText](runText/index.md) | Runs all the commands for the document creation using a single command. | -| [saveFile](saveFile/index.md) | Saves the file after all the changes are made. | -| [setProperty](setProperty/index.md) | Sets an argument which can be transferred to the program outside the [CDocBuilder.executeCommand](executeCommand/index.md) method. | -| [setTmpFolder](setTmpFolder/index.md) | Sets the path to the folder where the program will temporarily save files needed for the program's correct work. | -| [writeData](writeData/index.md) | Writes data to the log file. | +## Instance Methods + + + +- [closeFile](closeFile/index.md) + - : Closes the file to stop working with it. +- [createFile](createFile/index.md) + - : Creates a new file. +- [dispose](dispose/index.md) + - : Unloads the ONLYOFFICE Document Builder from the application memory when it is no longer needed. +- [executeCommand](executeCommand/index.md) + - : Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). +- [getContext](getContext/index.md) + - : Returns the current JS context. +- [getVersion](getVersion/index.md) + - : Returns the ONLYOFFICE Document Builder engine version. +- [initialize](initialize/index.md) + - : Initializes the ONLYOFFICE Document Builder as a library for the application to be able to work with it. +- [isSaveWithDoctrendererMode](isSaveWithDoctrendererMode/index.md) + - : Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. +- [openFile](openFile/index.md) + - : Opens the document file which will be edited and saved afterwards. +- [run](run/index.md) + - : Runs the ONLYOFFICE Document Builder executable. +- [runText](runText/index.md) + - : Runs all the commands for the document creation using a single command. +- [saveFile](saveFile/index.md) + - : Saves the file after all the changes are made. +- [setProperty](setProperty/index.md) + - : Sets an argument which can be transferred to the program outside the [CDocBuilder.executeCommand](executeCommand/index.md) method. +- [setTmpFolder](setTmpFolder/index.md) + - : Sets the path to the folder where the program will temporarily save files needed for the program correct work. +- [writeData](writeData/index.md) + - : Writes data to the log file. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/initialize/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/initialize/index.md index 550f8d020..19d67e983 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/initialize/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/initialize/index.md @@ -1,14 +1,37 @@ -`static void initialize(String directory = 0);` +```yml signature +- {type: keyword, text: static} +- {type: text, text: " "} +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: initialize} +- {type: text, text: (} +- {type: parameter, text: directory} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: " = "} +- {type: text, text: 0} +- {type: text, text: )} +``` + +## Description -Initializes the **ONLYOFFICE Document Builder** as a library for the application to be able to work with it. This method just sets the directory to the main Document Builder resources (icu files, etc). If this method is not called, the Document Builder will find resources from the current process directory. +Initializes the ONLYOFFICE Document Builder as a library for the application to be able to work with it. This method just sets the directory to the main Document Builder resources (icu files, etc). If this method is not called, the Document Builder will find resources from the current process directory. -> Please note, that for the *.docbuilder* file the *CDocBuilder.initialize* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.initialize` method is not used. ## Parameters -| Name | Type | Description | -| ----------- | ------ | ------------------------------------------------ | -| *directory* | String | The path to the main Document Builder resources. | + + +- directory, default: 0 + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The path to the main Document Builder resources. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/isSaveWithDoctrendererMode/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/isSaveWithDoctrendererMode/index.md index 6aa26cf42..c56261731 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/isSaveWithDoctrendererMode/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/isSaveWithDoctrendererMode/index.md @@ -1,8 +1,16 @@ -`boolean isSaveWithDoctrendererMode();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: isSaveWithDoctrendererMode} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. -> Please note, that for the *.docbuilder* file the *CDocBuilder.isSaveWithDoctrendererMode* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.isSaveWithDoctrendererMode` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/openFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/openFile/index.md index 9b5ceafb9..f0960b5d7 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/openFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/openFile/index.md @@ -1,13 +1,54 @@ -`int openFile(String path, String params);` +```yml signature +- {type: type, text: int} +- {type: text, text: " "} +- {type: entity, text: openFile} +- {type: text, text: (} +- {type: parameter, text: path} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: ", "} +- {type: parameter, text: params} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: )} +``` + +## Description Opens the document file which will be edited and saved afterwards. ## Parameters -| Name | Type | Attributes | Description | -| -------- | ------ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *path* | String | | The path to the file to be opened together with its name and extension. | -| *params* | String | \ | The parameters needed for the correct file opening (most commonly, the encoding is used for the *txt* and *csv* file types or the delimiter for the *csv* files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where **m\_nCsvTxtEncoding** is used for the text encoding and **m\_nCsvDelimiter** is used for the *csv* delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the *csv* delimiters include:

          **0** - no delimiter;

          **1** - tab;

          **2** - semicolon;

          **3** - colon;

          **4** - comma;

          **5** - space. | + + +- path + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : + + The path to the file to be opened together with its name and extension + +- params + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : + + The parameters needed for the correct file opening (most commonly, the encoding is used for the `txt` and `csv` file types or the delimiter for the `csv` files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where `m_nCsvTxtEncoding` is used for the text encoding and `m_nCsvDelimiter` is used for the `csv` delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the `csv` delimiters include: + + - `0` - no delimiter; + - `1` - tab; + - `2` - semicolon; + - `3` - colon; + - `4` - comma; + - `5` - space. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/run/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/run/index.md index 024f88f44..821d9e083 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/run/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/run/index.md @@ -1,12 +1,31 @@ -`boolean run(String path);` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: run} +- {type: text, text: (} +- {type: parameter, text: path} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: )} +``` + +## Description -Runs the **ONLYOFFICE Document Builder** executable. If you do not want to write a Java application, you can simply use the **docbuilder.exe** executable file and run it with the **.docbuilder** file as an argument, where all the code for the document file creation will be written. For Java, create the *CDocBuilder* object and call the *run* method with the path to the executable file from the *path* parameter. +Runs the ONLYOFFICE Document Builder executable. If you do not want to write a Java application, you can simply use the `docbuilder.exe` executable file and run it with the `.docbuilder` file as an argument, where all the code for the document file creation will be written. For Java, create the `CDocBuilder` object and call the `run` method with the path to the executable file from the `path` parameter. ## Parameters -| Name | Type | Description | -| ------ | ------ | ----------------------------------------------------------- | -| *path* | String | The path to the **ONLYOFFICE Document Builder** executable. | + + +- path + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The path to the ONLYOFFICE Document Builder executable. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/runText/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/runText/index.md index 8325b717b..f12c7f6af 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/runText/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/runText/index.md @@ -1,14 +1,33 @@ -`boolean runText(String commands);` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: runText} +- {type: text, text: (} +- {type: parameter, text: commands} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: )} +``` + +## Description -Runs all the commands for the document creation using a single command. Compared to [CDocBuilder.executeCommand](../executeCommand/index.md) where only one command at a time is allowed, *CDocBuilder.runText* makes it possible to enter all the commands for the document creation at once. +Runs all the commands for the document creation using a single command. Compared to [CDocBuilder.executeCommand](../executeCommand/index.md) where only one command at a time is allowed, `CDocBuilder.runText` makes it possible to enter all the commands for the document creation at once. -> Please note, that for the *.docbuilder* file the *CDocBuilder.runText* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.runText` method is not used. ## Parameters -| Name | Type | Description | -| ---------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *commands* | String | The commands which will be used to create the document file (in Java, the escape character must be used when the command contains quotation symbols). All the commands containing *builder.* are line separated, i.e. you cannot write them in one line, each command **must** start with its own line. | + + +- commands + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The commands which will be used to create the document file (in Java, the escape character must be used when the command contains quotation symbols). All the commands containing `builder.` are line separated, i.e. you cannot write them in one line, each command must start with its own line. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/saveFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/saveFile/index.md index 2125a2113..022624307 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/saveFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/saveFile/index.md @@ -1,14 +1,74 @@ -`int saveFile(int type, String path, String params);` +```yml signature +- {type: type, text: int} +- {type: text, text: " "} +- {type: entity, text: saveFile} +- {type: text, text: (} +- {type: parameter, text: type} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: " | "} +- {type: type, text: String} +- {type: text, text: ", "} +- {type: parameter, text: path} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: ", "} +- {type: parameter, text: params} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: )} +``` + +## Description Saves the file after all the changes are made. The type of the file which will be saved needs to be set. ## Parameters -| Name | Type | Attributes | Description | -| -------- | ------------ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *type* | int / String | | The type of the file to be saved set as a hexadecimal integer for the Java code. For the *.docbuilder* script file the following values are possible: **docx**, **odt**, **rtf**, **txt**, **pptx**, **xlsx**, **ods**, **csv**, **pdf** (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). | -| *path* | String | | The path to the file to be saved together with its name and extension. | -| *params* | String | \ | The parameters needed for the correct file saving (most commonly, the encoding is used for the *txt* and *csv* file types or the delimiter for the *csv* files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where **m\_nCsvTxtEncoding** is used for the text encoding and **m\_nCsvDelimiter** is used for the *csv* delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the *csv* delimiters include:

          **0** - no delimiter;

          **1** - tab;

          **2** - semicolon;

          **3** - colon;

          **4** - comma;

          **5** - space.

          When saving into an image file (*png* or *jpg*) for creating thumbnails, the additional parameters are used. [See below](#saving-into-images) to find them out. | + + +- type + + ```yml signature.variant="inline" + - {type: type, text: int} + - {type: text, text: " | "} + - {type: type, text: String} + ``` + + - : + + The type of the file to be saved set as a hexadecimal integer for the Java code. For the `.docbuilder` script file the following values are possible: `docx`, `odt`, `rtf`, `txt`, `pptx`, `xlsx`, `ods`, `csv`, `pdf` (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). + +- path + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : + + The path to the file to be saved together with its name and extension. + +- params + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : + + The parameters needed for the correct file saving (most commonly, the encoding is used for the `txt` and `csv` file types or the delimiter for the `csv` files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where `m_nCsvTxtEncoding` is used for the text encoding and `m_nCsvDelimiter` is used for the `csv` delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the `csv` delimiters include: + + - `0` - no delimiter; + - `1` - tab; + - `2` - semicolon; + - `3` - colon; + - `4` - comma; + - `5` - space. + + When saving into an image file (`png` or `jpg`) for creating thumbnails, the additional parameters are used. [See below](#saving-into-images) to find them out. + + ## Example @@ -30,14 +90,14 @@ builder.SaveFile("docx", "result.docx") ## Saving into images -**ONLYOFFICE Document Builder** allows to save your document files into image files creating thumbnails of the first page or of all the pages in the document. This is done using the parameters of the *saveFile()* method. The parameters are added in the form of XML tags, where the following tags can be used: +ONLYOFFICE Document Builder allows to save your document files into image files creating thumbnails of the first page or of all the pages in the document. This is done using the parameters of the `saveFile()` method. The parameters are added in the form of XML tags, where the following tags can be used: -- **m\_oThumbnail** - the core tag showing that the inner nodes will be used to create a thumbnail out of the document file; -- **format** - the image file format used to create a thumbnail (can be of the following values: **3** - for a JPG file, **4** - for a PNG file); -- **aspect** - the image aspect when creating a thumbnail from the document file (can be of the following values: **1** - will keep the original aspect, **0** - will stretch the image to fit the width and the height set below); -- **first** - whether only the first page or all the pages should be converted into a thumbnail (can be of the following values: **true** - only the first page will be converted, **false** - all the document pages will be used to create thumbnails, in this case the file will be saved as an archive of images, one for each page); -- **width** - the image width in pixels; -- **height** - the image height in pixels. +- `m_oThumbnail` - the core tag showing that the inner nodes will be used to create a thumbnail out of the document file; +- `format` - the image file format used to create a thumbnail (can be of the following values: `3` - for a JPG file, `4` - for a PNG file); +- `aspect` - the image aspect when creating a thumbnail from the document file (can be of the following values: `1` - will keep the original aspect, `0` - will stretch the image to fit the width and the height set below); +- `first` - whether only the first page or all the pages should be converted into a thumbnail (can be of the following values: `true` - only the first page will be converted, `false` - all the document pages will be used to create thumbnails, in this case the file will be saved as an archive of images, one for each page); +- `width` - the image width in pixels; +- `height` - the image height in pixels. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/setProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/setProperty/index.md index 180267e4b..e3a3a4258 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/setProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/setProperty/index.md @@ -1,31 +1,125 @@ -`void setProperty(String param, String value);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: setProperty} +- {type: text, text: (} +- {type: parameter, text: param} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: ", "} +- {type: parameter, text: value} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: )} +``` + +## Description -Sets an argument to the builder class which can be trasferred to the program outside the [CDocBuilder.executeCommand](../executeCommand/index.md) method, i.e. either as an additional property when running **ONLYOFFICE Document Builder** executable file or as a part of program code, but not included into the document file script. +Sets an argument to the builder class which can be trasferred to the program outside the [CDocBuilder.executeCommand](../executeCommand/index.md) method, i.e. either as an additional property when running ONLYOFFICE Document Builder executable file or as a part of program code, but not included into the document file script. -> Please note, that for the *.docbuilder* file the *CDocBuilder.setProperty* method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilder.setProperty` method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below. ## Parameters -| Name | Type | Description | -| ------- | ------ | ------------------------------------------------------- | -| *param* | String | The parameter name, the value is always *--argument*. | -| *value* | String | The parameter value which will be used in the document. | + + +- param + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The parameter name, the value is always `--argument`. + +- value + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The parameter value which will be used in the document. + + ## Supported properties -| Name | Type | Default | Description | -| --------------------------- | ------- | ------- | -------------------------------------------------------------------------------------------------------------------------- | -| *--use-doctrenderer-scheme* | boolean | false | Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. | -| *--check-fonts* | boolean | true | Specifies if the system fonts are cached for faster work. | -| *--work-directory* | String | "" | The path to the temporary directory. | -| *--cache-scripts* | boolean | true | Specifies if the sdkjs scripts are cached. | -| *--save-use-only-names* | boolean | false | Specifies if the destination paths are used (for server work). For example: /home/user/1.txt => /tmp/1.txt | -| *--all-fonts-path* | String | "" | The path to the *AllFonts.js* script. | -| *--argument* | String | "" | The JSON argument which is sent to the global parameters of all the opened JS context. | -| *--fonts-system* | boolean | true | Specifies if the system fonts are used. | -| *--fonts-dir* | String | "" | The path to the additional fonts directory (may be many records). | + + +- --use-doctrenderer-scheme, default: false + + ```yml signature.variant="inline" + - {type: type, text: boolean} + ``` + + - : Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. + +- --check-fonts, default: true + + ```yml signature.variant="inline" + - {type: type, text: boolean} + ``` + + - : Specifies if the system fonts are cached for faster work. + +- --work-directory, default: "" + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The path to the temporary directory. + +- --cache-scripts, default: true + + ```yml signature.variant="inline" + - {type: type, text: boolean} + ``` + + - : Specifies if the sdkjs scripts are cached. + +- --save-use-only-names, default: false + + ```yml signature.variant="inline" + - {type: type, text: boolean} + ``` + + - : Specifies if the destination paths are used (for server work). For example: `/home/user/1.txt` => `/tmp/1.txt`. + +- --all-fonts-path, default: "" + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The path to the `AllFonts.js` script. + +- --argument, default: "" + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The JSON argument which is sent to the global parameters of all the opened JS context. + +- --fonts-system, default: true + + ```yml signature.variant="inline" + - {type: type, text: boolean} + ``` + + - : Specifies if the system fonts are used. + +- --fonts-dir, default: "" + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The path to the additional fonts directory (may be many records). + + -Once added, the argument will be available as the **Argument** variable with its parameter values set: +Once added, the argument will be available as the `Argument` variable with its parameter values set: ``` java Argument.name === "ONLYOFFICE" // true @@ -50,7 +144,7 @@ docbuilder.exe "--argument={\"name\":\"ONLYOFFICE\"}" test.docbuilder ## Adding or removing fonts -It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the **check-fonts** variable is used. +It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the `check-fonts` variable is used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/setTmpFolder/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/setTmpFolder/index.md index cbba6c914..aceb85dab 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/setTmpFolder/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/setTmpFolder/index.md @@ -1,12 +1,31 @@ -`void setTmpFolder(String folder);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: setTmpFolder} +- {type: text, text: (} +- {type: parameter, text: folder} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: )} +``` + +## Description Sets the path to the folder where the program will temporarily save files needed for the program correct work. After the successful document file creation, all the files will be deleted from the folder. If no temporary folder is set, the system one will be used. ## Parameters -| Name | Type | Description | -| -------- | ------ | --------------------------------------------------------------- | -| *folder* | String | The path to the folder where the temporary files will be saved. | + + +- folder + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The path to the folder where the temporary files will be saved. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/writeData/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/writeData/index.md index 03ebc0a55..5af097aff 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/writeData/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilder/writeData/index.md @@ -1,16 +1,57 @@ -`void writeData(String path, String value, boolean append);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: writeData} +- {type: text, text: (} +- {type: parameter, text: path} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: ", "} +- {type: parameter, text: value} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: ", "} +- {type: parameter, text: append} +- {type: text, text: ": "} +- {type: type, text: boolean} +- {type: text, text: )} +``` + +## Description Writes data to the log file. It is used for logs in JS code. -> Please note, that for the *.docbuilder* file the *CDocBuilder.writeData* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.writeData` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ------- | ---------------------------------------------------------------------------------------------------------- | -| *path* | String | The path to the file where all the logs will be written. | -| *value* | String | The data which will be written to the log file. | -| *append* | boolean | Specifies if the new data will be appended to the already existing log file or a new file will be created. | + + +- path + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The path to the file where all the logs will be written. + +- value + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The data which will be written to the log file. + +- append + + ```yml signature.variant="inline" + - {type: type, text: boolean} + ``` + + - : Specifies if the new data will be appended to the already existing log file or a new file will be created. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createArray/index.md index 264b45d9a..e5ce6a947 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createArray/index.md @@ -1,14 +1,33 @@ -`CDocBuilderValue createArray(int length);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: createArray} +- {type: text, text: (} +- {type: parameter, text: length} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: )} +``` + +## Description -Creates an array value, an analogue of *new Array (length)* in JS. +Creates an array value, an analogue of `new Array (length)` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.createArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.createArray` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ---- | ----------------- | -| *length* | int | The array length. | + + +- length + + ```yml signature.variant="inline" + - {type: type, text: int} + ``` + + - : The array length. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createNull/index.md index 28bdc9b02..863b73e88 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createNull/index.md @@ -1,8 +1,16 @@ -`CDocBuilderValue createNull();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: createNull} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Creates a null value, an analogue of *null* in JS. +Creates a null value, an analogue of `null` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.createNull* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.createNull` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createObject/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createObject/index.md index aedb4211a..1d1cc8b67 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createObject/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createObject/index.md @@ -1,8 +1,16 @@ -`CDocBuilderValue createObject();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: createObject} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Creates an empty object, an analogue of *{}* in JS. +Creates an empty object, an analogue of `{}` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.createObject* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.createObject` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createScope/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createScope/index.md index c2899363b..a22f9b435 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createScope/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createScope/index.md @@ -1,8 +1,16 @@ -`CDocBuilderContextScope createScope();` +```yml signature +- {id: ../../CDocBuilderContextScope/index.md, token: {type: type, text: CDocBuilderContextScope}} +- {type: text, text: " "} +- {type: entity, text: createScope} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Creates a [context scope](../../CDocBuilderContextScope/index.md) which sets the execution context for all operations executed within a local scope. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.createScope* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.createScope` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createUndefined/index.md index 0bb7a83af..4e3273062 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/createUndefined/index.md @@ -1,8 +1,16 @@ -`CDocBuilderValue createUndefined();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: createUndefined} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Creates an undefined value, an analogue of *undefined* in JS. +Creates an undefined value, an analogue of `undefined` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.createUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.createUndefined` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/getGlobal/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/getGlobal/index.md index f25acea86..e1725ecda 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/getGlobal/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/getGlobal/index.md @@ -1,8 +1,16 @@ -`CDocBuilderValue getGlobal();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: getGlobal} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Returns the global object for the current context. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.getGlobal* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.getGlobal` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/index.md index a7b3e8a7f..c5c539442 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/index.md @@ -1,15 +1,30 @@ -`new CDocBuilderContext` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderContext} +``` -Class used by **ONLYOFFICE Document Builder** for getting JS context for working. +## Description -## Methods +Class used by ONLYOFFICE Document Builder for getting JS context for working. -| Name | Description | -| ------------------------------------------- | ------------------------------------------------------------- | -| [createArray](createArray/index.md) | Creates an array, an analogue of *new Array (length)* in JS. | -| [createNull](createNull/index.md) | Creates a null value, an analogue of *null* in JS. | -| [createObject](createObject/index.md) | Creates an empty object, an analogue of *{}* in JS. | -| [createScope](createScope/index.md) | Creates a context scope. | -| [createUndefined](createUndefined/index.md) | Creates an undefined value, an analogue of *undefined* in JS. | -| [getGlobal](getGlobal/index.md) | Returns the global object for the current context. | -| [isError](isError/index.md) | Checks for errors in JS. | +## Instance Methods + + + +- [createArray](createArray/index.md) + - : Creates an array, an analogue of `new Array (length)` in JS. +- [createNull](createNull/index.md) + - : Creates a null value, an analogue of `null` in JS. +- [createObject](createObject/index.md) + - : Creates an empty object, an analogue of `{}` in JS. +- [createScope](createScope/index.md) + - : Creates a context scope. +- [createUndefined](createUndefined/index.md) + - : Creates an undefined value, an analogue of `undefined` in JS. +- [getGlobal](getGlobal/index.md) + - : Returns the global object for the current context. +- [isError](isError/index.md) + - : Checks for errors in JS. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/isError/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/isError/index.md index 99899b193..333543506 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/isError/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContext/isError/index.md @@ -1,8 +1,16 @@ -`boolean isError();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: isError} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Checks for errors in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.isError* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.isError` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContextScope/close/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContextScope/close/index.md index 697fb0cfd..389e9933e 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContextScope/close/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContextScope/close/index.md @@ -1,8 +1,16 @@ -`void close();` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: close} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Closes the current scope. This method will be called automatically when the descructor is executed. -> Please note, that for the *.docbuilder* file the *CDocBuilderContextScope.close* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContextScope.close` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContextScope/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContextScope/index.md index 1da5a9b88..df028cdeb 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContextScope/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderContextScope/index.md @@ -1,9 +1,18 @@ -`new CDocBuilderContextScope` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderContextScope} +``` -The stack-allocated class used by **ONLYOFFICE Document Builder** which sets the execution context for all operations executed within a local scope. All opened scopes will be closed automatically when the builder [closeFile](../CDocBuilder/closeFile/index.md) method is called. +## Description -## Methods +The stack-allocated class used by ONLYOFFICE Document Builder which sets the execution context for all operations executed within a local scope. All opened scopes will be closed automatically when the builder [closeFile](../CDocBuilder/closeFile/index.md) method is called. -| Name | Description | -| ----------------------- | ------------------------- | -| [close](close/index.md) | Closes the current scope. | +## Instance Methods + + + +- [close](close/index.md) + - : Closes the current scope. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/call/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/call/index.md index d0b5cc4d0..a1eb5aca2 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/call/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/call/index.md @@ -1,15 +1,65 @@ -`CDocBuilderValue call(String name, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: call} +- {type: text, text: (} +- {type: parameter, text: name} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: ", "} +- {type: parameter, text: p1} +- {type: text, text: ": "} +- {type: type, text: Object} +- {type: text, text: ", "} +- {type: parameter, text: p2} +- {type: text, text: ": "} +- {type: type, text: Object} +- {type: text, text: ", "} +- {type: parameter, text: p3} +- {type: text, text: ": "} +- {type: type, text: Object} +- {type: text, text: ", "} +- {type: parameter, text: p4} +- {type: text, text: ": "} +- {type: type, text: Object} +- {type: text, text: ", "} +- {type: parameter, text: p5} +- {type: text, text: ": "} +- {type: type, text: Object} +- {type: text, text: ", "} +- {type: parameter, text: p6} +- {type: text, text: ": "} +- {type: type, text: Object} +- {type: text, text: )} +``` + +## Description Calls the specified Document Builder method. See the [Text document API](../../../../../Office%20API/Usage%20API/Text%20Document%20API/index.md), [Spreadsheet API](../../../../../Office%20API/Usage%20API/Spreadsheet%20API/index.md), [Presentation API](../../../../../Office%20API/Usage%20API/Presentation%20API/index.md) or [Form API](../../../../../Office%20API/Usage%20API/Form%20API/index.md) sections for more information which methods are available for various document types. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.call* method is not used explicitly. The method itself is used instead. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.call` method is not used explicitly. The method itself is used instead. See the example below. ## Parameters -| Name | Type | Description | -| ------- | ------ | ------------------------------------------------------------------ | -| *name* | String | The name of the Document Builder method. | -| *p1-p6* | Object | The parameters that the Document Builder method takes as argumens. | + + +- name + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The name of the Document Builder method. + +- p1-p6 + + ```yml signature.variant="inline" + - {type: type, text: Object} + ``` + + - : The parameters that the Document Builder method takes as argumens. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/clear/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/clear/index.md index 7941f526f..ba0864957 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/clear/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/clear/index.md @@ -1,8 +1,16 @@ -`void clear();` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: clear} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Clears the **CDocBuilderValue** object. +Clears the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.clear* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.clear` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/createArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/createArray/index.md index 7b2137fe9..27d66f044 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/createArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/createArray/index.md @@ -1,14 +1,33 @@ -`CDocBuilderValue CreateArray(int length);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: createArray} +- {type: text, text: (} +- {type: parameter, text: length} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: )} +``` + +## Description Creates an array value. This method returns the current [context](../../CDocBuilderContext/index.md) and calls its [createArray](../../CDocBuilderContext/createArray/index.md) method. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.createArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.createArray` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ---- | ----------------- | -| *length* | int | The array length. | + + +- length + + ```yml signature.variant="inline" + - {type: type, text: int} + ``` + + - : The array length. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/createNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/createNull/index.md index 95c171eb9..c9b024250 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/createNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/createNull/index.md @@ -1,8 +1,16 @@ -`static CDocBuilderValue createNull();` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: createNull} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Creates a null value. This method returns the current [context](../../CDocBuilderContext/index.md) and calls its [createNull](../../CDocBuilderContext/createNull/index.md) method. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.createNull* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.createNull` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/createUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/createUndefined/index.md index 64231dad7..831e7b147 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/createUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/createUndefined/index.md @@ -1,8 +1,18 @@ -`static CDocBuilderValue createUndefined();` +```yml signature +- {type: keyword, text: static} +- {type: text, text: " "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: createUndefined} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Creates an undefined value. This method returns the current [context](../../CDocBuilderContext/index.md) and calls its [createUndefined](../../CDocBuilderContext/createUndefined/index.md) method. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.createUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.createUndefined` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/get/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/get/index.md index 98fa84a36..3d6e45ed1 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/get/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/get/index.md @@ -1,14 +1,37 @@ -`CDocBuilderValue get(int index);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: get} +- {type: text, text: (} +- {type: parameter, text: index} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: " | "} +- {type: type, text: String} +- {type: text, text: )} +``` + +## Description Returns an array value by its index or name. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.get* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.get` method is not used. ## Parameters -| Name | Type | Description | -| ------- | ------------ | ------------------------------------- | -| *index* | int / String | The index or name of the array value. | + + +- index + + ```yml signature.variant="inline" + - {type: type, text: int} + - {type: text, text: " | "} + - {type: type, text: String} + ``` + + - : The index or name of the array value. + + ## Example @@ -26,7 +49,7 @@ CDocBuilderValue chart = charts.get(1); CDocBuilder.dispose(); ``` -The **default\[]** postfix expression can be also used to get an array value by its index: +The `default[]` postfix expression can be also used to get an array value by its index: ``` java property CDocBuilderValue default[int] diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/getLength/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/getLength/index.md index 104f2f408..f049ee1a8 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/getLength/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/getLength/index.md @@ -1,8 +1,16 @@ -`int getLength();` +```yml signature +- {type: type, text: int} +- {type: text, text: " "} +- {type: entity, text: getLength} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns the length if the **CDocBuilderValue** object is an array. Otherwise, returns 0. +Returns the length if the `CDocBuilderValue` object is an array. Otherwise, returns 0. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.getLength* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.getLength` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/getProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/getProperty/index.md index ec17e0595..ccb305cc0 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/getProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/getProperty/index.md @@ -1,14 +1,33 @@ -`CDocBuilderValue getProperty(String name);` +```yml signature +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " "} +- {type: entity, text: getProperty} +- {type: text, text: (} +- {type: parameter, text: name} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: )} +``` + +## Description -Returns a property of the **CDocBuilderValue** object. +Returns a property of the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.getProperty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.getProperty` method is not used. ## Parameters -| Name | Type | Description | -| ------ | ------ | ----------------------------------------------------- | -| *name* | String | The name of the **CDocBuilderValue** object property. | + + +- name + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The name of the `CDocBuilderValue` object property. + + ## Example @@ -25,9 +44,9 @@ CDocBuilderValue docPr = document.getProperty("color"); CDocBuilder.dispose(); ``` -There are two more ways to get a property of the **CDocBuilderValue** object: +There are two more ways to get a property of the `CDocBuilderValue` object: -1. use the **get** method that takes an argument in the string format: +1. use the `get` method that takes an argument in the string format: ``` java CDocBuilderValue get(String name); @@ -48,7 +67,7 @@ There are two more ways to get a property of the **CDocBuilderValue** object: CDocBuilder.dispose(); ``` -2. use the **default\[]** postfix expression that takes an argument in the string format: +2. use the `default[]` postfix expression that takes an argument in the string format: ``` java property CDocBuilderValue default[String] diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/index.md index a3ccba00d..31daf0803 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/index.md @@ -1,8 +1,14 @@ -`new CDocBuilderValue` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderValue} +``` + +## Description -Class used by **ONLYOFFICE Document Builder** for getting the results of called JS commands. It represents a wrapper for a JS object. +Class used by ONLYOFFICE Document Builder for getting the results of called JS commands. It represents a wrapper for a JS object. -The **CDocBuilderValue** class can be created from the primitive data types: +The `CDocBuilderValue` class can be created from the primitive data types: ``` java CDocBuilderValue(boolean value); @@ -12,31 +18,57 @@ CDocBuilderValue(String value); CDocBuilderValue(Object[] values); ``` -## Methods - -| Name | Description | -| ------------------------------------------- | ----------------------------------------------- | -| [call](call/index.md) | Calls the specified Document Builder method. | -| [clear](clear/index.md) | Clears the object. | -| [createArray](createArray/index.md) | Creates an array value. | -| [createNull](createNull/index.md) | Creates a null value. | -| [createUndefined](createUndefined/index.md) | Creates an undefined value. | -| [get](get/index.md) | Returns an array value by its index or name. | -| [getLength](getLength/index.md) | Returns the length if this object is an array. | -| [getProperty](getProperty/index.md) | Returns a property of this object. | -| [isArray](isArray/index.md) | Returns true if this object is an array. | -| [isBool](isBool/index.md) | Returns true if this object is a boolean value. | -| [isDouble](isDouble/index.md) | Returns true if this object is a double value. | -| [isEmpty](isEmpty/index.md) | Returns true if this object is empty. | -| [isFunction](isFunction/index.md) | Returns true if this object is a function. | -| [isInt](isInt/index.md) | Returns true if this object is an integer. | -| [isNull](isNull/index.md) | Returns true if this object is null. | -| [isObject](isObject/index.md) | Returns true if this object is an object. | -| [isString](isString/index.md) | Returns true if this object is a string. | -| [isUndefined](isUndefined/index.md) | Returns true if this object is undefined. | -| [set](set/index.md) | Sets an array value by its index or name. | -| [setProperty](setProperty/index.md) | Sets a property to this object. | -| [toBool](toBool/index.md) | Converts this object to a boolean value. | -| [toDouble](toDouble/index.md) | Converts this object to a double value. | -| [toInt](toInt/index.md) | Converts this object to an integer. | -| [toString](toString/index.md) | Converts this object to a string. | +## Instance Methods + + + +- [call](call/index.md) + - : Calls the specified Document Builder method. +- [clear](clear/index.md) + - : Clears the object. +- [createArray](createArray/index.md) + - : Creates an array value. +- [createNull](createNull/index.md) + - : Creates a null value. +- [createUndefined](createUndefined/index.md) + - : Creates an undefined value. +- [get](get/index.md) + - : Returns an array value by its index or name. +- [getLength](getLength/index.md) + - : Returns the length if this object is an array. +- [getProperty](getProperty/index.md) + - : Returns a property of this object. +- [isArray](isArray/index.md) + - : Returns true if this object is an array. +- [isBool](isBool/index.md) + - : Returns true if this object is a boolean value. +- [isDouble](isDouble/index.md) + - : Returns true if this object is a double value. +- [isEmpty](isEmpty/index.md) + - : Returns true if this object is empty. +- [isFunction](isFunction/index.md) + - : Returns true if this object is a function. +- [isInt](isInt/index.md) + - : Returns true if this object is an integer. +- [isNull](isNull/index.md) + - : Returns true if this object is null. +- [isObject](isObject/index.md) + - : Returns true if this object is an object. +- [isString](isString/index.md) + - : Returns true if this object is a string. +- [isUndefined](isUndefined/index.md) + - : Returns true if this object is undefined. +- [set](set/index.md) + - : Sets an array value by its index or name. +- [setProperty](setProperty/index.md) + - : Sets a property to this object. +- [toBool](toBool/index.md) + - : Converts this object to a boolean value. +- [toDouble](toDouble/index.md) + - : Converts this object to a double value. +- [toInt](toInt/index.md) + - : Converts this object to an integer. +- [toString](toString/index.md) + - : Converts this object to a string. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isArray/index.md index d549b4b8e..9376626a6 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isArray/index.md @@ -1,8 +1,16 @@ -`boolean isArray();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: isArray} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an array. +Returns true if the `CDocBuilderValue` object is an array. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.isArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.isArray` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isBool/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isBool/index.md index 68351abac..4cc29cbb3 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isBool/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isBool/index.md @@ -1,8 +1,16 @@ -`boolean isBool();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: isBool} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a boolean value. +Returns true if the `CDocBuilderValue` object is a boolean value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.isBool* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.isBool` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isDouble/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isDouble/index.md index 6cc3fa937..c027a3d88 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isDouble/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isDouble/index.md @@ -1,8 +1,16 @@ -`boolean isDouble();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: isDouble} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a double value. +Returns true if the `CDocBuilderValue` object is a double value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.isDouble* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.isDouble` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isEmpty/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isEmpty/index.md index ba7d3f2ca..939fb6bf1 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isEmpty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isEmpty/index.md @@ -1,8 +1,16 @@ -`boolean isEmpty();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: isEmpty} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is empty. +Returns true if the `CDocBuilderValue` object is empty. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.isEmpty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.isEmpty` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isFunction/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isFunction/index.md index 6dc30e18a..3afe56ee0 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isFunction/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isFunction/index.md @@ -1,8 +1,16 @@ -`boolean isFunction();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: isFunction} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a function. +Returns true if the `CDocBuilderValue` object is a function. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.isFunction* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.isFunction` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isInt/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isInt/index.md index 52ea9c959..42644c005 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isInt/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isInt/index.md @@ -1,8 +1,16 @@ -`boolean isInt();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: isInt} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an integer. +Returns true if the `CDocBuilderValue` object is an integer. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.isInt* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.isInt` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isNull/index.md index 4eb9eecbc..c380bdfb7 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isNull/index.md @@ -1,8 +1,16 @@ -`boolean isNull();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: isNull} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is null. +Returns true if the `CDocBuilderValue` object is null. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.isNll* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.isNll` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isObject/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isObject/index.md index 574354e65..851705a30 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isObject/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isObject/index.md @@ -1,8 +1,16 @@ -`boolean isObject();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: isObject} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an object. +Returns true if the `CDocBuilderValue` object is an object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.isObject* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.isObject` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isString/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isString/index.md index 77a7db181..d650a2d1a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isString/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isString/index.md @@ -1,8 +1,16 @@ -`boolean isString();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: isString} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a string. +Returns true if the `CDocBuilderValue` object is a string. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.isString* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.isString` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isUndefined/index.md index 39b5c8a4a..470fe9aa6 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/isUndefined/index.md @@ -1,8 +1,16 @@ -`boolean isUndefined();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: isUndefined} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is undefined. +Returns true if the `CDocBuilderValue` object is undefined. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.isUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.isUndefined` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/set/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/set/index.md index f630bc8eb..7e361dd3d 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/set/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/set/index.md @@ -1,15 +1,49 @@ -`void set(int index, Object value);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: set} +- {type: text, text: (} +- {type: parameter, text: index} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: " | "} +- {type: type, text: String} +- {type: text, text: ", "} +- {type: parameter, text: value} +- {type: text, text: ": "} +- {type: type, text: Object} +- {type: text, text: )} +``` + +## Description Sets an array value by its index or name. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.set* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.set` method is not used. ## Parameters -| Name | Type | Description | -| ------- | ------------ | ------------------------------------- | -| *index* | int / String | The index or name of the array value. | -| *value* | Object | The array value to be set. | + + +- index + + ```yml signature.variant="inline" + - {type: type, text: int} + - {type: text, text: " | "} + - {type: type, text: String} + ``` + + - : The index or name of the array value. + +- value + + ```yml signature.variant="inline" + - {type: type, text: Object} + ``` + + - : The array value to be set. + + ## Example @@ -31,7 +65,7 @@ charts.set(1, chart); CDocBuilder.dispose(); ``` -The **default\[]** postfix expression can be also used to set an array value by its index: +The `default[]` postfix expression can be also used to set an array value by its index: ``` java property CDocBuilderValue default[int] diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/setProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/setProperty/index.md index 154aac490..3a01b21f4 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/setProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/setProperty/index.md @@ -1,15 +1,45 @@ -`void setProperty(String name, Object value);` +```yml signature +- {type: type, text: void} +- {type: text, text: " "} +- {type: entity, text: setProperty} +- {type: text, text: (} +- {type: parameter, text: name} +- {type: text, text: ": "} +- {type: type, text: String} +- {type: text, text: ", "} +- {type: parameter, text: value} +- {type: text, text: ": "} +- {type: type, text: Object} +- {type: text, text: )} +``` + +## Description -Sets a property to the **CDocBuilderValue** object. +Sets a property to the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.setProperty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.setProperty` method is not used. ## Parameters -| Name | Type | Description | -| ------- | ------ | ------------------------------------------------------ | -| *name* | String | The name of the **CDocBuilderValue** object property. | -| *value* | Object | The value of the **CDocBuilderValue** object property. | + + +- name + + ```yml signature.variant="inline" + - {type: type, text: String} + ``` + + - : The name of the `CDocBuilderValue` object property. + +- value + + ```yml signature.variant="inline" + - {type: type, text: Object} + ``` + + - : The value of the `CDocBuilderValue` object property. + + ## Example @@ -26,9 +56,9 @@ document.setProperty("color", {"zX":{"red":112,"green":173,"blue":71,"alpha":255 CDocBuilder.dispose(); ``` -There are two more ways to set a property to the **CDocBuilderValue** object: +There are two more ways to set a property to the `CDocBuilderValue` object: -1. use the **Set** method that takes the object property name and value as arguments: +1. use the `set` method that takes the object property name and value as arguments: ``` java void set(String name, Object value); @@ -49,7 +79,7 @@ There are two more ways to set a property to the **CDocBuilderValue** object: CDocBuilder.dispose(); ``` -2. use the **default\[]** postfix expression: +2. use the `default[]` postfix expression: ``` java property CDocBuilderValue default[String] diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toBool/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toBool/index.md index dade0bc59..0722722b0 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toBool/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toBool/index.md @@ -1,8 +1,16 @@ -`boolean toBool();` +```yml signature +- {type: type, text: boolean} +- {type: text, text: " "} +- {type: entity, text: toBool} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a boolean value. +Converts the `CDocBuilderValue` object to a boolean value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.toBool* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.toBool` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toDouble/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toDouble/index.md index 0155b75dd..b563b9e2c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toDouble/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toDouble/index.md @@ -1,8 +1,16 @@ -`double toDouble();` +```yml signature +- {type: type, text: double} +- {type: text, text: " "} +- {type: entity, text: toDouble} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a double value. +Converts the `CDocBuilderValue` object to a double value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.toDouble* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.toDouble` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toInt/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toInt/index.md index b48172fd2..a7988c041 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toInt/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toInt/index.md @@ -1,8 +1,16 @@ -`int toInt();` +```yml signature +- {type: type, text: int} +- {type: text, text: " "} +- {type: entity, text: toInt} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to an integer. +Converts the `CDocBuilderValue` object to an integer. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.toInt* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.toInt` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toString/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toString/index.md index 02cc8eb8b..a6398e33d 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toString/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/CDocBuilderValue/toString/index.md @@ -1,8 +1,16 @@ -`String toString();` +```yml signature +- {type: type, text: String} +- {type: text, text: " "} +- {type: entity, text: toString} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a string. +Converts the `CDocBuilderValue` object to a string. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.toString* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.toString` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Java/index.md b/site/pages/Docs/Document Builder/Builder Framework/Java/index.md index 0cdbd756c..83fd48525 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Java/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Java/index.md @@ -2,12 +2,24 @@ order: -4 --- -For the integration of **ONLYOFFICE Document Builder** into any application, the Java **doctrenderer** library is used. The current application version contains five main classes: +For the integration of ONLYOFFICE Document Builder into any application, the Java doctrenderer library is used. -- [CDocBuilder](CDocBuilder/index.md) class - used by **ONLYOFFICE Document Builder** for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. -- [CDocBuilderValue](CDocBuilderValue/index.md) class - used by **ONLYOFFICE Document Builder** for getting the results of called JS commands. It represents a wrapper for a JS object. -- [CDocBuilderContextScope](CDocBuilderContextScope/index.md) class - the stack-allocated class which sets the execution context for all operations executed within a local scope. -- [CDocBuilderContext](CDocBuilderContext/index.md) class - used by **ONLYOFFICE Document Builder** for getting JS context for working. +## Classes + +The current application version contains five main classes: + + + +- [CDocBuilder](CDocBuilder/index.md) + - : Used by ONLYOFFICE Document Builder for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. +- [CDocBuilderValue](CDocBuilderValue/index.md) + - : Used by ONLYOFFICE Document Builder for getting the results of called JS commands. It represents a wrapper for a JS object. +- [CDocBuilderContextScope](CDocBuilderContextScope/index.md) + - : The stack-allocated class which sets the execution context for all operations executed within a local scope. +- [CDocBuilderContext](CDocBuilderContext/index.md) + - : Used by ONLYOFFICE Document Builder for getting JS context for working. + + > JDK 8 and above is supported. diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/CloseFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/CloseFile/index.md index c5d7e5f46..a9be6e206 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/CloseFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/CloseFile/index.md @@ -1,6 +1,15 @@ -`def CloseFile(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: CloseFile} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Closes the file to stop working with it. You can use a single **ONLYOFFICE Document Builder** instance to work with all your files, but you need to close the previous file before you can start working with the next one in this case. +Closes the file to stop working with it. You can use a single ONLYOFFICE Document Builder instance to work with all your files, but you need to close the previous file before you can start working with the next one in this case. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/CreateFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/CreateFile/index.md index 82d4e3d9c..087583cbf 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/CreateFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/CreateFile/index.md @@ -1,12 +1,37 @@ -`def CreateFile(self, type);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: CreateFile} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: type} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: " | "} +- {type: type, text: str} +- {type: text, text: )} +``` + +## Description Creates a new file. The type of the file which will be created needs to be set. ## Parameters -| Name | Type | Description | -| ------ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *type* | int \| str | The type of the file to be created set as a hexadecimal integer for the Python code or **docx**, **xlsx**, **pptx**, or **pdf** for the *.docbuilder* script file (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). | + + +- type + + ```yml signature.variant="inline" + - {type: type, text: int} + - {type: text, text: " | "} + - {type: type, text: str} + ``` + + - : The type of the file to be created set as a hexadecimal integer for the Python code or `docx`, `xlsx`, `pptx`, or `pdf` for the `.docbuilder` script file (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/Overview/index.md#format-types) values). + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/Dispose/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/Dispose/index.md index 6c7f3988b..2a7f0d5a8 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/Dispose/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/Dispose/index.md @@ -1,8 +1,17 @@ -`def Dispose(cls);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: Dispose} +- {type: text, text: (} +- {type: parameter, text: cls} +- {type: text, text: )} +``` + +## Description -Unloads the **ONLYOFFICE Document Builder** from the application memory when it is no longer needed. Generally, there is no need to dispose JS before exiting the process, it should happen automatically. It should only be used if the process needs the resources taken up by JS. +Unloads the ONLYOFFICE Document Builder from the application memory when it is no longer needed. Generally, there is no need to dispose JS before exiting the process, it should happen automatically. It should only be used if the process needs the resources taken up by JS. -> Please note, that for the *.docbuilder* file the *CDocBuilder.Dispose* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.Dispose` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/ExecuteCommand/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/ExecuteCommand/index.md index cb8752902..7d051fc43 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/ExecuteCommand/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/ExecuteCommand/index.md @@ -1,15 +1,53 @@ -`def ExecuteCommand(self, command, retValue=None);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: ExecuteCommand} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: command} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: ", "} +- {type: parameter, text: retValue} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: " | "} +- {type: type, text: None} +- {type: text, text: " = "} +- {type: type, text: None} +- {type: text, text: )} +``` + +## Description Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). See the [Text document API](../../../../../Office%20API/Usage%20API/Text%20Document%20API/index.md), [Spreadsheet API](../../../../../Office%20API/Usage%20API/Spreadsheet%20API/index.md), [Presentation API](../../../../../Office%20API/Usage%20API/Presentation%20API/index.md), or [Form API](../../../../../Office%20API/Usage%20API/Form%20API/index.md) sections for more information which commands are available for various document types. -> Please note, that for the *.docbuilder* file the *CDocBuilder.ExecuteCommand* method is not used explicitly. The command itself is used instead. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilder.ExecuteCommand` method is not used explicitly. The command itself is used instead. See the example below. ## Parameters -| Name | Type | Description | -| ---------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *command* | str | The command in the form of JavaScript code which will be used to create the document file (in Python, the escape character must be used when the command contains quotation symbols). | -| *retValue* | CDocBuilderValue | The command return value. | + + +- command + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The command in the form of JavaScript code which will be used to create the document file (in Python, the escape character must be used when the command contains quotation symbols). + +- retValue, default: None + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} + - {type: text, text: " | "} + - {type: type, text: None} + ``` + + - : The command return value. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/GetContext/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/GetContext/index.md index a0145ff35..ceb88f77c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/GetContext/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/GetContext/index.md @@ -1,8 +1,17 @@ -`def GetContext(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: GetContext} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description Returns the current JS [context](../../CDocBuilderContext/index.md). -> Please note, that for the *.docbuilder* file the *CDocBuilder.GetContext* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.GetContext` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/GetVersion/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/GetVersion/index.md index 13468777d..6616f7bc9 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/GetVersion/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/GetVersion/index.md @@ -1,8 +1,17 @@ -`def GetVersion(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: GetVersion} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Returns the **ONLYOFFICE Document Builder** engine version. +Returns the ONLYOFFICE Document Builder engine version. -> Please note, that for the *.docbuilder* file the *CDocBuilder.GetVersion* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.GetVersion` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/Initialize/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/Initialize/index.md index 5159c5732..84221f781 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/Initialize/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/Initialize/index.md @@ -1,14 +1,41 @@ -`def Initialize(cls, directory=None);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: Initialize} +- {type: text, text: (} +- {type: parameter, text: cls} +- {type: text, text: ", "} +- {type: parameter, text: directory} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: " | "} +- {type: type, text: None} +- {type: text, text: " = "} +- {type: type, text: None} +- {type: text, text: )} +``` + +## Description -Initializes the **ONLYOFFICE Document Builder** as a library for the application to be able to work with it. This method just sets the directory to the main Document Builder resources (icu files, etc). If this method is not called, the Document Builder will find resources from the current process directory. +Initializes the ONLYOFFICE Document Builder as a library for the application to be able to work with it. This method just sets the directory to the main Document Builder resources (icu files, etc). If this method is not called, the Document Builder will find resources from the current process directory. -> Please note, that for the *.docbuilder* file the *CDocBuilder.Initialize* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.Initialize` method is not used. ## Parameters -| Name | Type | Description | -| --------- | ---- | ------------------------------------------------ | -| directory | str | The path to the main Document Builder resources. | + + +- directory, default: None + + ```yml signature.variant="inline" + - {type: type, text: str} + - {type: text, text: " | "} + - {type: type, text: None} + ``` + + - : The path to the main Document Builder resources. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/IsSaveWithDoctrendererMode/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/IsSaveWithDoctrendererMode/index.md index e7ebd5fae..f736fc51c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/IsSaveWithDoctrendererMode/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/IsSaveWithDoctrendererMode/index.md @@ -1,8 +1,17 @@ -`def IsSaveWithDoctrendererMode(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: IsSaveWithDoctrendererMode} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. -> Please note, that for the *.docbuilder* file the *CDocBuilder.IsSaveWithDoctrendererMode* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.IsSaveWithDoctrendererMode` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/OpenFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/OpenFile/index.md index 079d31b16..1b90dcedc 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/OpenFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/OpenFile/index.md @@ -1,13 +1,60 @@ -`def OpenFile(self, path, params);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: OpenFile} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: path} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: ", "} +- {type: parameter, text: params} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: " | "} +- {type: type, text: None} +- {type: text, text: )} +``` + +## Description Opens the document file which will be edited and saved afterwards. ## Parameters -| Name | Type | Attributes | Description | -| -------- | ---- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *path* | str | | The path to the file to be opened together with its name and extension. | -| *params* | str | \ | The parameters needed for the correct file opening (most commonly, the encoding is used for the *txt* and *csv* file types or the delimiter for the *csv* files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where **m\_nCsvTxtEncoding** is used for the text encoding and **m\_nCsvDelimiter** is used for the **delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the *csv* delimiters include:

          **0** - no delimiter;

          **1** - tab;

          **2** - semicolon;

          **3** - colon;

          **4** - comma;

          **5** - space | + + +- path + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : + + The path to the file to be opened together with its name and extension. + +- params + + ```yml signature.variant="inline" + - {type: type, text: str} + - {type: text, text: " | "} + - {type: type, text: None} + ``` + + - : + + The parameters needed for the correct file opening (most commonly, the encoding is used for the `txt` and `csv` file types or the delimiter for the `csv` files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where `m_nCsvTxtEncoding` is used for the text encoding and `m_nCsvDelimiter` is used for the delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the `csv` delimiters include: + + - `0` - no delimiter; + - `1` - tab; + - `2` - semicolon; + - `3` - colon; + - `4` - comma; + - `5` - space. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/Run/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/Run/index.md index af005fb28..df70b271f 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/Run/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/Run/index.md @@ -1,12 +1,33 @@ -`def Run(self, path);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: Run} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: path} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: )} +``` + +## Description -Runs the **ONLYOFFICE Document Builder** executable. If you do not want to write a Python application, you can simply use the **docbuilder.exe** executable file and run it with the ### .docbuilder file as an argument, where all the code for the document file creation will be written. For Python, create the *CDocBuilder* object and call the *Run* method with the path to the executable file from the *path* parameter. +Runs the ONLYOFFICE Document Builder executable. If you do not want to write a Python application, you can simply use the `docbuilder.exe` executable file and run it with the `.docbuilder` file as an argument, where all the code for the document file creation will be written. For Python, create the `CDocBuilder` object and call the `Run` method with the path to the executable file from the `path` parameter. ## Parameters -| Name | Type | Description | -| ------ | ---- | ----------------------------------------------------------- | -| *path* | str | The path to the **ONLYOFFICE Document Builder** executable. | + + +- path + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The path to the ONLYOFFICE Document Builder executable. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/RunText/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/RunText/index.md index 243ed7778..ed84d404c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/RunText/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/RunText/index.md @@ -1,14 +1,35 @@ -`def RunText(self, commands);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: RunText} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: commands} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: )} +``` + +## Description -Runs all the commands for the document creation using a single command. Compared to [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) where only one command at a time is allowed, *CDocBuilder.RunText* makes it possible to enter all the commands for the document creation at once. +Runs all the commands for the document creation using a single command. Compared to [CDocBuilder.ExecuteCommand](../ExecuteCommand/index.md) where only one command at a time is allowed, `CDocBuilder.RunText` makes it possible to enter all the commands for the document creation at once. -> Please note, that for the *.docbuilder* file the *CDocBuilder.RunText* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.RunText` method is not used. ## Parameters -| Name | Type | Description | -| ---------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *commands* | str | The commands which will be used to create the document file (in Python, the escape character must be used when the command contains quotation symbols). All the commands containing *builder.* are line separated, i.e. you cannot write them in one line, each command **must** start with its own line. | + + +- commands + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The commands which will be used to create the document file (in Python, the escape character must be used when the command contains quotation symbols). All the commands containing `builder.` are line separated, i.e. you cannot write them in one line, each command must start with its own line. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/SaveFile/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/SaveFile/index.md index 3ac2a2287..f5cd1825a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/SaveFile/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/SaveFile/index.md @@ -1,14 +1,82 @@ -`def SaveFile(self, type, path, params=None);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: SaveFile} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: type} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: " | "} +- {type: type, text: str} +- {type: text, text: ", "} +- {type: parameter, text: path} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: ", "} +- {type: parameter, text: params} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: " | "} +- {type: type, text: None} +- {type: text, text: " = "} +- {type: type, text: None} +- {type: text, text: )} +``` + +## Description Saves the file after all the changes are made. The type of the file which will be saved needs to be set. ## Parameters -| Name | Type | Description | -| -------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| *type* | int \| str | The type of the file to be saved set as a hexadecimal integer for the Python code. For the *.docbuilder* script file the following values are possible: **docx**, **odt**, **rtf**, **txt**, **pptx**, **xlsx**, **ods**, **csv**, **pdf** (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/index.md#format-types) values). | -| *path* | str | The path to the file to be saved together with its name and extension. | -| *params* | str | The parameters needed for the correct file saving (most commonly, the encoding is used for the *txt* and *csv* file types or the delimiter for the *csv* files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where **m\_nCsvTxtEncoding** is used for the text encoding and **m\_nCsvDelimiter** is used for the *csv* delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the *csv* delimiters include:

          **0** - no delimiter;

          **1** - tab;

          **2** - semicolon;

          **3** - colon;

          **4** - comma;

          **5** - space.

          When saving into an image file (*png* or *jpg*) for creating thumbnails, the additional parameters are used. [See below](#saving-into-images) to find them out. | + + +- type + + ```yml signature.variant="inline" + - {type: type, text: int} + - {type: text, text: " | "} + - {type: type, text: str} + ``` + + - : + + The type of the file to be saved set as a hexadecimal integer for the Python code. For the `.docbuilder` script file the following values are possible: `docx`, `odt`, `rtf`, `txt`, `pptx`, `xlsx`, `ods`, `csv`, `pdf` (see [OFFICESTUDIO\_FILE\_XXX](../../../../Builder%20App/index.md#format-types) values). + +- path + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : + + The path to the file to be saved together with its name and extension. + +- params, default: None + + ```yml signature.variant="inline" + - {type: type, text: str} + - {type: text, text: " | "} + - {type: type, text: None} + ``` + + - : + + The parameters needed for the correct file saving (most commonly, the encoding is used for the `txt` and `csv` file types or the delimiter for the `csv` files, for other file types this is just an empty string). The parameters are added in the form of XML tags, where `m_nCsvTxtEncoding` is used for the text encoding and `m_nCsvDelimiter` is used for the `csv` delimiter. You can find all the supported values for the encoding [in this file](https://github.com/ONLYOFFICE/server/blob/master/Common/sources/commondefines.js). The supported values for the `csv` delimiters include: + + - `0` - no delimiter; + - `1` - tab; + - `2` - semicolon; + - `3` - colon; + - `4` - comma; + - `5` - space. + + When saving into an image file (`png` or `jpg`) for creating thumbnails, the additional parameters are used. [See below](#saving-into-images) to find them out. + + ## Example @@ -28,14 +96,14 @@ builder.SaveFile("docx", "result.docx") ## Saving into images -**ONLYOFFICE Document Builder** allows to save your document files into image files creating thumbnails of the first page or of all the pages in the document. This is done using the parameters of the *SaveFile()* method. The parameters are added in the form of XML tags, where the following tags can be used: +ONLYOFFICE Document Builder allows to save your document files into image files creating thumbnails of the first page or of all the pages in the document. This is done using the parameters of the `SaveFile()` method. The parameters are added in the form of XML tags, where the following tags can be used: -- **m\_oThumbnail** - the core tag showing that the inner nodes will be used to create a thumbnail out of the document file; -- **format** - the image file format used to create a thumbnail (can be of the following values: **3** - for a JPG file, **4** - for a PNG file); -- **aspect** - the image aspect when creating a thumbnail from the document file (can be of the following values: **1** - will keep the original aspect, **0** - will stretch the image to fit the width and the height set below); -- **first** - whether only the first page or all the pages should be converted into a thumbnail (can be of the following values: **true** - only the first page will be converted, **false** - all the document pages will be used to create thumbnails, in this case the file will be saved as an archive of images, one for each page); -- **width** - the image width in pixels; -- **height** - the image height in pixels. +- `m_oThumbnail` - the core tag showing that the inner nodes will be used to create a thumbnail out of the document file; +- `format` - the image file format used to create a thumbnail (can be of the following values: `3` - for a JPG file, `4` - for a PNG file); +- `aspect` - the image aspect when creating a thumbnail from the document file (can be of the following values: `1` - will keep the original aspect, `0` - will stretch the image to fit the width and the height set below); +- `first` - whether only the first page or all the pages should be converted into a thumbnail (can be of the following values: `true` - only the first page will be converted, `false` - all the document pages will be used to create thumbnails, in this case the file will be saved as an archive of images, one for each page); +- `width` - the image width in pixels; +- `height` - the image height in pixels. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/SetProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/SetProperty/index.md index dd55474ce..a9bcd23f0 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/SetProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/SetProperty/index.md @@ -1,31 +1,127 @@ -`def SetProperty(self, name, value);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: SetProperty} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: name} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: ", "} +- {type: parameter, text: value} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: )} +``` + +## Description -Sets an argument in the UTF8 format to the builder class which can be trasferred to the program outside the [CDocBuilder.ExecuteCommand](../../CDocBuilder/ExecuteCommand/index.md) method, i.e. either as an additional property when running **ONLYOFFICE Document Builder** executable file or as a part of program code, but not included into the document file script. +Sets an argument in the UTF8 format to the builder class which can be trasferred to the program outside the [CDocBuilder.ExecuteCommand](../../CDocBuilder/ExecuteCommand/index.md) method, i.e. either as an additional property when running ONLYOFFICE Document Builder executable file or as a part of program code, but not included into the document file script. -> Please note, that for the *.docbuilder* file the *CDocBuilder.SetProperty* method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilder.SetProperty` method is not used explicitly. The argument itself is used instead as an additional property for the executable. See the example below. ## Parameters -| Name | Type | Description | -| ------- | ---- | ------------------------------------------------------------------------ | -| *name* | str | The parameter name in the UTF8 format, the value is always *--argument*. | -| *value* | str | The parameter value which will be used in the document. | + + +- name + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The parameter name in the UTF8 format, the value is always `--argument`. + +- value + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The parameter value which will be used in the document. + + ## Supported properties -| Name | Type | Default | Description | -| --------------------------- | ---- | ------- | -------------------------------------------------------------------------------------------------------------------------- | -| *--use-doctrenderer-scheme* | bool | false | Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. | -| *--check-fonts* | bool | true | Specifies if the system fonts are cached for faster work. | -| *--work-directory* | str | "" | The path to the temporary directory. | -| *--cache-scripts* | bool | true | Specifies if the sdkjs scripts are cached. | -| *--save-use-only-names* | bool | false | Specifies if the destination paths are used (for server work). For example: /home/user/1.txt => /tmp/1.txt | -| *--all-fonts-path* | str | "" | The path to the *AllFonts.js* script. | -| *--argument* | str | "" | The JSON argument which is sent to the global parameters of all the opened JS context. | -| *--fonts-system* | bool | true | Specifies if the system fonts are used. | -| *--fonts-dir* | str | "" | The path to the additional fonts directory (may be many records). | + + +- --use-doctrenderer-scheme, default: false + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. + +- --check-fonts, default: true + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the system fonts are cached for faster work. + +- --work-directory, default: "" + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The path to the temporary directory. + +- --cache-scripts, default: true + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the sdkjs scripts are cached. + +- --save-use-only-names, default: false + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the destination paths are used (for server work). For example: `/home/user/1.txt` => `/tmp/1.txt`. + +- --all-fonts-path, default: "" + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The path to the `AllFonts.js` script. + +- --argument, default: "" + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The JSON argument which is sent to the global parameters of all the opened JS context. + +- --fonts-system, default: true + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the system fonts are used. + +- --fonts-dir, default: "" + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The path to the additional fonts directory (may be many records). + + -Once added, the argument will be available as the **Argument** variable with its parameter values set: +Once added, the argument will be available as the `Argument` variable with its parameter values set: ``` py Argument.name === "ONLYOFFICE" # true @@ -48,7 +144,7 @@ docbuilder.exe "--argument={\"name\":\"ONLYOFFICE\"}" test.docbuilder ## Adding or removing fonts -It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the **check-fonts** variable is used: +It is also possible to update the font list when you either add new fonts or remove old ones. To do this, the `check-fonts` variable is used: ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/SetTmpFolder/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/SetTmpFolder/index.md index 4bd8ae7fd..febfcbd23 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/SetTmpFolder/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/SetTmpFolder/index.md @@ -1,12 +1,33 @@ -`def SetTmpFolder(self, folder);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: SetTmpFolder} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: folder} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: )} +``` + +## Description Sets the path to the folder where the program will temporarily save files needed for the program correct work. After the successful document file creation, all the files will be deleted from the folder. If no temporary folder is set, the system one will be used. ## Parameters -| Name | Type | Description | -| -------- | ---- | --------------------------------------------------------------- | -| *folder* | str | The path to the folder where the temporary files will be saved. | + + +- folder + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The path to the folder where the temporary files will be saved. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/WriteData/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/WriteData/index.md index bb2ad9525..23add4824 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/WriteData/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/WriteData/index.md @@ -1,16 +1,59 @@ -`def WriteData(self, path, value, append);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: WriteData} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: path} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: ", "} +- {type: parameter, text: value} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: ", "} +- {type: parameter, text: append} +- {type: text, text: ": "} +- {type: type, text: bool} +- {type: text, text: )} +``` + +## Description Writes data to the log file. It is used for logs in JS code. -> Please note, that for the *.docbuilder* file the *CDocBuilder.WriteData* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilder.WriteData` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ---- | ---------------------------------------------------------------------------------------------------------- | -| *path* | str | The path to the file where all the logs will be written. | -| *value* | str | The data which will be written to the log file. | -| *append* | bool | Specifies if the new data will be appended to the already existing log file or a new file will be created. | + + +- path + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The path to the file where all the logs will be written. + +- value + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The data which will be written to the log file. + +- append + + ```yml signature.variant="inline" + - {type: type, text: bool} + ``` + + - : Specifies if the new data will be appended to the already existing log file or a new file will be created. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/index.md index ea4ca70d8..f295de1cf 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilder/index.md @@ -1,23 +1,46 @@ -`new CDocBuilder` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilder} +``` -Base class used by **ONLYOFFICE Document Builder** for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. +## Description -## Methods +Base class used by ONLYOFFICE Document Builder for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. -| Name | Description | -| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| [CloseFile](CloseFile/index.md) | Closes the file to stop working with it. | -| [CreateFile](CreateFile/index.md) | Creates a new file. | -| [Dispose](Dispose/index.md) | Unloads the **ONLYOFFICE Document Builder** from the application memory when it is no longer needed. | -| [ExecuteCommand](ExecuteCommand/index.md) | Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF). | -| [GetContext](GetContext/index.md) | Returns the current JS context. | -| [GetVersion](GetVersion/index.md) | Returns the **ONLYOFFICE Document Builder** engine version. | -| [Initialize](Initialize/index.md) | Initializes the **ONLYOFFICE Document Builder** as a library for the application to be able to work with it. | -| [IsSaveWithDoctrendererMode](IsSaveWithDoctrendererMode/index.md) | Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. | -| [OpenFile](OpenFile/index.md) | Opens the document file which will be edited and saved afterwards. | -| [Run](Run/index.md) | Runs the **ONLYOFFICE Document Builder** executable. | -| [RunText](RunText/index.md) | Runs all the commands for the document creation using a single command. | -| [SaveFile](SaveFile/index.md) | Saves the file after all the changes are made. | -| [SetProperty](SetProperty/index.md) | Sets an argument which can be transferred to the program outside the [CDocBuilder.ExecuteCommand](ExecuteCommand/index.md) method. | -| [SetTmpFolder](SetTmpFolder/index.md) | Sets the path to the folder where the program will temporarily save files needed for the program correct work. | -| [WriteData](WriteData/index.md) | Writes data to the log file. | +## Instance Methods + + + +- [CloseFile](CloseFile/index.md) + - : Closes the file to stop working with it. +- [CreateFile](CreateFile/index.md) + - : Creates a new file. +- [Dispose](Dispose/index.md) + - : Unloads the ONLYOFFICE Document Builder from the application memory when it is no longer needed. +- [ExecuteCommand](ExecuteCommand/index.md) + - : Executes the command which will be used to create the document file (text document, spreadsheet, presentation, form document, PDF) +- [GetContext](GetContext/index.md) + - : Returns the current JS context. +- [GetVersion](GetVersion/index.md) + - : Returns the ONLYOFFICE Document Builder engine version. +- [Initialize](Initialize/index.md) + - : Initializes the ONLYOFFICE Document Builder as a library for the application to be able to work with it. +- [IsSaveWithDoctrendererMode](IsSaveWithDoctrendererMode/index.md) + - : Specifies if the doctrenderer mode is used when building a document or getting content from the editor when saving a file. +- [OpenFile](OpenFile/index.md) + - : Opens the document file which will be edited and saved afterwards. +- [Run](Run/index.md) + - : Runs the ONLYOFFICE Document Builder executable. +- [RunText](RunText/index.md) + - : Runs all the commands for the document creation using a single command. +- [SaveFile](SaveFile/index.md) + - : Saves the file after all the changes are made. +- [SetProperty](SetProperty/index.md) + - : Sets an argument which can be transferred to the program outside the [CDocBuilder.ExecuteCommand](ExecuteCommand/index.md) method. +- [SetTmpFolder](SetTmpFolder/index.md) + - : Sets the path to the folder where the program will temporarily save files needed for the program correct work. +- [WriteData](WriteData/index.md) + - : Writes data to the log file. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateArray/index.md index 8c0c634f0..24567c039 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateArray/index.md @@ -1,14 +1,35 @@ -`def CreateArray(self, length);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: CreateArray} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: length} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: )} +``` + +## Description -Creates an array value, an analogue of *new Array (length)* in JS. +Creates an array value, an analogue of `new Array (length)` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateArray` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ---- | ----------------- | -| *length* | int | The array length. | + + +- length + + ```yml signature.variant="inline" + - {type: type, text: int} + ``` + + - : The array length. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateNull/index.md index 9e4fcceb2..84f948971 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateNull/index.md @@ -1,8 +1,17 @@ -`def CreateNull(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: CreateNull} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Creates a null value, an analogue of *null* in JS. +Creates a null value, an analogue of `null` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateNull* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateNull` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateObject/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateObject/index.md index 307e2d614..9c10b67eb 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateObject/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateObject/index.md @@ -1,8 +1,17 @@ -`def CreateObject(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: CreateObject} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Creates an empty object, an analogue of *{}* in JS. +Creates an empty object, an analogue of `{}` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateObject* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateObject` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateScope/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateScope/index.md index c417a1d3b..ba942ed36 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateScope/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateScope/index.md @@ -1,8 +1,17 @@ -`def CreateScope(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: CreateScope} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description Creates a [context scope](../../CDocBuilderContextScope/index.md) which sets the execution context for all operations executed within a local scope. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateScope* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateScope` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateUndefined/index.md index 3767017cd..f191f014a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/CreateUndefined/index.md @@ -1,8 +1,17 @@ -`def CreateUndefined(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: CreateUndefined} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Creates an undefined value, an analogue of *undefined* in JS. +Creates an undefined value, an analogue of `undefined` in JS. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.CreateUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.CreateUndefined` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/GetGlobal/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/GetGlobal/index.md index 4afe83816..21e01b06e 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/GetGlobal/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/GetGlobal/index.md @@ -1,8 +1,17 @@ -`def GetGlobal(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: GetGlobal} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description Returns the global object for the current context. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.GetGlobal* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.GetGlobal` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/IsError/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/IsError/index.md index afbdb8cb6..54b2c2e3d 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/IsError/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/IsError/index.md @@ -1,8 +1,17 @@ -`def IsError(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: IsError} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Checks for errors in JS. The error message and call stack will be written to *std::cerr*. +Checks for errors in JS. The error message and call stack will be written to `std::cerr`. -> Please note, that for the *.docbuilder* file the *CDocBuilderContext.IsError* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContext.IsError` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/index.md index 0ec916714..bf30d59b3 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContext/index.md @@ -1,15 +1,30 @@ -`new CDocBuilderContext` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderContext} +``` -Class used by **ONLYOFFICE Document Builder** for getting JS context for working. +## Description -## Methods +Class used by ONLYOFFICE Document Builder for getting JS context for working. -| Name | Description | -| ------------------------------------------- | ------------------------------------------------------------- | -| [CreateArray](CreateArray/index.md) | Creates an array, an analogue of *new Array (length)* in JS. | -| [CreateNull](CreateNull/index.md) | Creates a null value, an analogue of *null* in JS. | -| [CreateObject](CreateObject/index.md) | Creates an empty object, an analogue of *{}* in JS. | -| [CreateScope](CreateScope/index.md) | Creates a context scope. | -| [CreateUndefined](CreateUndefined/index.md) | Creates an undefined value, an analogue of *undefined* in JS. | -| [GetGlobal](GetGlobal/index.md) | Returns the global object for the current context. | -| [IsError](IsError/index.md) | Checks for errors in JS. | +## Instance Methods + + + +- [CreateArray](CreateArray/index.md) + - : Creates an array, an analogue of `new Array (length)` in JS. +- [CreateNull](CreateNull/index.md) + - : Creates a null value, an analogue of `null` in JS. +- [CreateObject](CreateObject/index.md) + - : Creates an empty object, an analogue of `{}` in JS. +- [CreateScope](CreateScope/index.md) + - : Creates a context scope. +- [CreateUndefined](CreateUndefined/index.md) + - : Creates an undefined value, an analogue of `undefined` in JS. +- [GetGlobal](GetGlobal/index.md) + - : Returns the global object for the current context. +- [IsError](IsError/index.md) + - : Checks for errors in JS. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContextScope/Close/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContextScope/Close/index.md index c13c79ac5..96149c8e1 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContextScope/Close/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContextScope/Close/index.md @@ -1,8 +1,17 @@ -`def Close(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: Close} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description Closes the current scope. This method will be called automatically when the descructor is executed. -> Please note, that for the *.docbuilder* file the *CDocBuilderContextScope.Close* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderContextScope.Close` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContextScope/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContextScope/index.md index 83f7cfb6e..cd60ed76c 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContextScope/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderContextScope/index.md @@ -1,9 +1,18 @@ -`new CDocBuilderContextScope` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderContextScope} +``` -The stack-allocated class used by **ONLYOFFICE Document Builder** which sets the execution context for all operations executed within a local scope. All opened scopes will be closed automatically when the builder [CloseFile](../CDocBuilder/CloseFile/index.md) method is called. +## Description -## Methods +The stack-allocated class used by ONLYOFFICE Document Builder which sets the execution context for all operations executed within a local scope. All opened scopes will be closed automatically when the builder [CloseFile](../CDocBuilder/CloseFile/index.md) method is called. -| Name | Description | -| ----------------------- | ------------------------- | -| [Close](Close/index.md) | Closes the current scope. | +## Instance Methods + + + +- [Close](Close/index.md) + - : Closes the current scope. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Call/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Call/index.md index 86fc4fb8a..2eadfd233 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Call/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Call/index.md @@ -1,15 +1,48 @@ -`def Call(self, name, *args);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: Call} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: name} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: ", "} +- {type: text, text: "*"} +- {type: parameter, text: args} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: )} +``` + +## Description Calls the specified Document Builder method. See the [Text document API](../../../../../Office%20API/Usage%20API/Text%20Document%20API/index.md), [Spreadsheet API](../../../../../Office%20API/Usage%20API/Spreadsheet%20API/index.md), [Presentation API](../../../../../Office%20API/Usage%20API/Presentation%20API/index.md) or [Form API](../../../../../Office%20API/Usage%20API/Form%20API/index.md) sections for more information which methods are available for various document types. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Call* method is not used explicitly. The method itself is used instead. See the example below. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Call` method is not used explicitly. The method itself is used instead. See the example below. ## Parameters -| Name | Type | Description | -| -------- | ------------- | ------------------------------------------------------------------- | -| *name* | str | The name of the Document Builder method. | -| *\*args* | CBuilderValue | The parameters that the Document Builder method takes as arguments. | + + +- name + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The name of the Document Builder method. + +- args + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} + ``` + + - : The parameters that the Document Builder method takes as arguments. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Clear/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Clear/index.md index 19d122918..9245a51ed 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Clear/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Clear/index.md @@ -1,8 +1,17 @@ -`def Clear(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: Clear} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Clears the **CDocBuilderValue** object. +Clears the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Clear* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Clear` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/CreateArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/CreateArray/index.md index 3daac8c47..54931e0e2 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/CreateArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/CreateArray/index.md @@ -1,14 +1,33 @@ -`def CreateArray(length);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: CreateArray} +- {type: text, text: (} +- {type: parameter, text: length} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: )} +``` + +## Description Creates an array value. This method returns the current [context](../../CDocBuilderContext/index.md) and calls its [CreateArray](../../CDocBuilderContext/CreateArray/index.md) method. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.CreateArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.CreateArray` method is not used. ## Parameters -| Name | Type | Description | -| -------- | ---- | ----------------- | -| *length* | int | The array length. | + + +- length + + ```yml signature.variant="inline" + - {type: type, text: int} + ``` + + - : The array length. + + ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/CreateNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/CreateNull/index.md index 14c342f8d..741c51a4f 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/CreateNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/CreateNull/index.md @@ -1,8 +1,16 @@ -`def CreateNull();` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: CreateNull} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Creates a null value. This method returns the current [context](../../CDocBuilderContext/index.md) and calls its [CreateNull](../../CDocBuilderContext/CreateNull/index.md) method. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.CreateNull* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.CreateNull` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/CreateUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/CreateUndefined/index.md index 635911a47..169d85bcd 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/CreateUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/CreateUndefined/index.md @@ -1,8 +1,16 @@ -`def CreateUndefined();` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: CreateUndefined} +- {type: text, text: (} +- {type: text, text: )} +``` + +## Description Creates an undefined value. This method returns the current [context](../../CDocBuilderContext/index.md) and calls its [CreateUndefined](../../CDocBuilderContext/CreateUndefined/index.md) method. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.CreateUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.CreateUndefined` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Get/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Get/index.md index 4382f49ec..d0cd633d5 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Get/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Get/index.md @@ -1,14 +1,35 @@ -`def Get(self, key);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: Get} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: key} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: )} +``` + +## Description Returns an array value by its index. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Get* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Get` method is not used. ## Parameters -| Name | Type | Description | -| ----- | ---- | ----------------------------- | -| *key* | int | The index of the array value. | + + +- key + + ```yml signature.variant="inline" + - {type: type, text: int} + ``` + + - : The index of the array value. + + ## Example @@ -24,7 +45,7 @@ charts = document.Call("GetAllCharts") chart = charts.Get(1); ``` -The **default\[]** postfix expression can be also used to get an array value by its index: +The `default[]` postfix expression can be also used to get an array value by its index: ``` py property CDocBuilderValue default[int] diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/GetLength/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/GetLength/index.md index 80c97e72b..a7985a928 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/GetLength/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/GetLength/index.md @@ -1,8 +1,17 @@ -`def GetLength(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: GetLength} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Returns the length if the **CDocBuilderValue** object is an array. Otherwise, returns 0. +Returns the length if the `CDocBuilderValue` object is an array. Otherwise, returns 0. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.GetLength* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.GetLength` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/GetProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/GetProperty/index.md index 4b3a8f40f..67cee8211 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/GetProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/GetProperty/index.md @@ -1,14 +1,35 @@ -`def GetProperty(self, name);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: GetProperty} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: name} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: )} +``` + +## Description -Returns a property of the **CDocBuilderValue** object. +Returns a property of the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.GetProperty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.GetProperty` method is not used. ## Parameters -| Name | Type | Description | -| ------ | ---- | ----------------------------------------------------- | -| *name* | str | The name of the **CDocBuilderValue** object property. | + + +- name + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The name of the `CDocBuilderValue` object property. + + ## Example @@ -23,9 +44,9 @@ document = api.Call("GetDocument") docPr = document.GetProperty("color") ``` -There are two more ways to get a property of the **CDocBuilderValue** object: +There are two more ways to get a property of the `CDocBuilderValue` object: -1. use the **Get** method that takes an argument in the string format: +1. use the `Get` method that takes an argument in the string format: ``` py def Get(self, name); @@ -44,7 +65,7 @@ There are two more ways to get a property of the **CDocBuilderValue** object: docPr = document.Get("color") ``` -2. use the **default\[]** postfix expression that takes an argument in the string format: +2. use the `default[]` postfix expression that takes an argument in the string format: ``` py property CDocBuilderValue default[str] diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsArray/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsArray/index.md index 3e178e6d2..3da733541 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsArray/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsArray/index.md @@ -1,8 +1,17 @@ -`def IsArray(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: IsArray} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an array. +Returns true if the `CDocBuilderValue` object is an array. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsArray* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsArray` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsBool/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsBool/index.md index 8c0c4b5e0..5e5f1e302 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsBool/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsBool/index.md @@ -1,8 +1,17 @@ -`def IsBool(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: IsBool} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a boolean value. +Returns true if the `CDocBuilderValue` object is a boolean value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsBool* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsBool` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsDouble/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsDouble/index.md index eac93485e..9bb0dfa9b 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsDouble/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsDouble/index.md @@ -1,8 +1,17 @@ -`def IsDouble(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: IsDouble} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a double value. +Returns true if the `CDocBuilderValue` object is a double value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsDouble* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsDouble` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsEmpty/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsEmpty/index.md index 94532db09..f4164ffd2 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsEmpty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsEmpty/index.md @@ -1,8 +1,17 @@ -`def IsEmpty(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: IsEmpty} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is empty. +Returns true if the `CDocBuilderValue` object is empty. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsEmpty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsEmpty` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsFunction/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsFunction/index.md index f63f2d011..5dcd06da5 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsFunction/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsFunction/index.md @@ -1,8 +1,17 @@ -`def IsFunction(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: IsFunction} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a function. +Returns true if the `CDocBuilderValue` object is a function. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsFunction* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsFunction` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsInt/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsInt/index.md index b6d1bfbfc..43632d006 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsInt/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsInt/index.md @@ -1,8 +1,17 @@ -`def IsInt(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: IsInt} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an integer. +Returns true if the `CDocBuilderValue` object is an integer. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsInt* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsInt` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsNull/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsNull/index.md index 6c39457de..79f719f6a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsNull/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsNull/index.md @@ -1,8 +1,17 @@ -`def IsNull(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: IsNull} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is null. +Returns true if the `CDocBuilderValue` object is null. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsNll* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsNull` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsObject/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsObject/index.md index 31b4c4982..949abf4c3 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsObject/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsObject/index.md @@ -1,8 +1,17 @@ -`def IsObject(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: IsObject} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is an object. +Returns true if the `CDocBuilderValue` object is an object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsObject* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsObject` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsString/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsString/index.md index 0591de83a..37146ac44 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsString/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsString/index.md @@ -1,8 +1,17 @@ -`def IsString(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: IsString} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is a string. +Returns true if the `CDocBuilderValue` object is a string. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsString* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsString` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsUndefined/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsUndefined/index.md index 6928c5ec8..9accceccc 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsUndefined/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/IsUndefined/index.md @@ -1,8 +1,17 @@ -`def IsUndefined(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: IsUndefined} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Returns true if the **CDocBuilderValue** object is undefined. +Returns true if the `CDocBuilderValue` object is undefined. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.IsUndefined* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.IsUndefined` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Set/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Set/index.md index a8c292f9c..eb7a0e248 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Set/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/Set/index.md @@ -1,15 +1,47 @@ -`def Set(self, key, value);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: Set} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: key} +- {type: text, text: ": "} +- {type: type, text: int} +- {type: text, text: ", "} +- {type: parameter, text: value} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: )} +``` + +## Description Sets an array value by its index. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.Set* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.Set` method is not used. ## Parameters -| Name | Type | Description | -| ------- | ---------------- | ----------------------------- | -| *key* | int | The index of the array value. | -| *value* | CDocBuilderValue | The array value to be set. | + + +- key + + ```yml signature.variant="inline" + - {type: type, text: int} + ``` + + - : The index of the array value. + +- value + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} + ``` + + - : The array value to be set. + + ## Example @@ -29,7 +61,7 @@ chart = api.Call("CreateChart", "bar3D", [ charts.Set(1, oChart) ``` -The **default[]** postfix expression can be also used to set an array value by its index: +The `default[]` postfix expression can be also used to set an array value by its index: ``` py property CDocBuilderValue default[int] diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/SetProperty/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/SetProperty/index.md index b1b8b911b..97eea2554 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/SetProperty/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/SetProperty/index.md @@ -1,15 +1,47 @@ -`def SetProperty(self, name, value);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: SetProperty} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: ", "} +- {type: parameter, text: name} +- {type: text, text: ": "} +- {type: type, text: str} +- {type: text, text: ", "} +- {type: parameter, text: value} +- {type: text, text: ": "} +- {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} +- {type: text, text: )} +``` + +## Description -Sets a property to the **CDocBuilderValue** object. +Sets a property to the `CDocBuilderValue` object. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.SetProperty* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.SetProperty` method is not used. ## Parameters -| Name | Type | Description | -| ------- | ---------------- | ------------------------------------------------------ | -| *name* | str | The name of the **CDocBuilderValue** object property. | -| *value* | CDocBuilderValue | The value of the **CDocBuilderValue** object property. | + + +- name + + ```yml signature.variant="inline" + - {type: type, text: str} + ``` + + - : The name of the `CDocBuilderValue` object property. + +- value + + ```yml signature.variant="inline" + - {id: ../../CDocBuilderValue/index.md, token: {type: type, text: CDocBuilderValue}} + ``` + + - : The value of the `CDocBuilderValue` object property. + + ## Example @@ -24,9 +56,9 @@ document = api.Call("GetDocument") document.SetProperty("color", {"zX":{"red":112,"green":173,"blue":71,"alpha":255},"type":"srgb","Zvf":null,"type":"uniColor"}) ``` -There are two more ways to set a property to the **CDocBuilderValue** object: +There are two more ways to set a property to the `CDocBuilderValue` object: -1. use the **Set** method that takes the object property name and value as arguments: +1. use the `Set` method that takes the object property name and value as arguments: ``` py def Set(self, name, value); @@ -45,7 +77,7 @@ There are two more ways to set a property to the **CDocBuilderValue** object: document.Set("color", {"zX":{"red":112,"green":173,"blue":71,"alpha":255},"type":"srgb","Zvf":null,"type":"uniColor"}) ``` -2. use the **default[]** postfix expression: +2. use the `default[]` postfix expression: ``` py property CDocBuilderValue default[str] diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToBool/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToBool/index.md index acbfe2810..75fda732a 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToBool/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToBool/index.md @@ -1,8 +1,17 @@ -`def ToBool(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: ToBool} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a boolean value. +Converts the `CDocBuilderValue` object to a boolean value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToBool* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToBool` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToDouble/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToDouble/index.md index 20f50b69f..146170d04 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToDouble/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToDouble/index.md @@ -1,8 +1,17 @@ -`def ToDouble(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: ToDouble} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a double value. +Converts the `CDocBuilderValue` object to a double value. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToDouble* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToDouble` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToInt/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToInt/index.md index 40d5a364f..319285740 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToInt/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToInt/index.md @@ -1,8 +1,17 @@ -`def ToInt(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: ToInt} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to an integer. +Converts the `CDocBuilderValue` object to an integer. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToInt* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToInt` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToString/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToString/index.md index d39d68249..5b08135fb 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToString/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/ToString/index.md @@ -1,8 +1,17 @@ -`def ToString(self);` +```yml signature +- {type: keyword, text: def} +- {type: text, text: " "} +- {type: entity, text: ToString} +- {type: text, text: (} +- {type: parameter, text: self} +- {type: text, text: )} +``` + +## Description -Converts the **CDocBuilderValue** object to a string. +Converts the `CDocBuilderValue` object to a string. -> Please note, that for the *.docbuilder* file the *CDocBuilderValue.ToString* method is not used. +> Please note, that for the `.docbuilder` file the `CDocBuilderValue.ToString` method is not used. ## Example diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/index.md index e9d293d92..b6276ccea 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/CDocBuilderValue/index.md @@ -1,32 +1,64 @@ -`new CDocBuilderValue` +```yml signature +- {type: keyword, text: class} +- {type: text, text: " "} +- {type: entity, text: CDocBuilderValue} +``` -Class used by **ONLYOFFICE Document Builder** for getting the results of called JS commands. It represents a wrapper for a JS object. +## Description -## Methods +Class used by ONLYOFFICE Document Builder for getting the results of called JS commands. It represents a wrapper for a JS object. -| Name | Description | -| ------------------------------------------- | ---------------------------------------------------------- | -| [Call](Call/index.md) | Calls the specified Document Builder method. | -| [Clear](Clear/index.md) | Clears the object. | -| [CreateArray](CreateArray/index.md) | Creates an array value. | -| [CreateNull](CreateNull/index.md) | Creates a null value. | -| [CreateUndefined](CreateUndefined/index.md) | Creates an undefined value. | -| [Get](Get/index.md) | Returns an array value by its index. | -| [GetLength](GetLength/index.md) | Returns the length if this object is an array/typed array. | -| [GetProperty](GetProperty/index.md) | Returns a property of this object. | -| [IsArray](IsArray/index.md) | Returns true if this object is an array. | -| [IsBool](IsBool/index.md) | Returns true if this object is a boolean value. | -| [IsDouble](IsDouble/index.md) | Returns true if this object is a double value. | -| [IsEmpty](IsEmpty/index.md) | Returns true if this object is empty. | -| [IsFunction](IsFunction/index.md) | Returns true if this object is a function. | -| [IsInt](IsInt/index.md) | Returns true if this object is an integer. | -| [IsNull](IsNull/index.md) | Returns true if this object is null. | -| [IsObject](IsObject/index.md) | Returns true if this object is an object. | -| [IsString](IsString/index.md) | Returns true if this object is a string. | -| [IsUndefined](IsUndefined/index.md) | Returns true if this object is undefined. | -| [Set](Set/index.md) | Sets an array value by its index. | -| [SetProperty](SetProperty/index.md) | Sets a property to this object. | -| [ToBool](ToBool/index.md) | Converts this object to a boolean value. | -| [ToDouble](ToDouble/index.md) | Converts this object to a double value. | -| [ToInt](ToInt/index.md) | Converts this object to an integer. | -| [ToString](ToString/index.md) | Converts this object to a string. | +## Instance Methods + + + +- [Call](Call/index.md) + - : Calls the specified Document Builder method. +- [Clear](Clear/index.md) + - : Clears the object. +- [CreateArray](CreateArray/index.md) + - : Creates an array value. +- [CreateNull](CreateNull/index.md) + - : Creates a null value. +- [CreateUndefined](CreateUndefined/index.md) + - : Creates an undefined value. +- [Get](Get/index.md) + - : Returns an array value by its index. +- [GetLength](GetLength/index.md) + - : Returns the length if this object is an array. +- [GetProperty](GetProperty/index.md) + - : Returns a property of this object. +- [IsArray](IsArray/index.md) + - : Returns true if this object is an array. +- [IsBool](IsBool/index.md) + - : Returns true if this object is a boolean value. +- [IsDouble](IsDouble/index.md) + - : Returns true if this object is a double value. +- [IsEmpty](IsEmpty/index.md) + - : Returns true if this object is empty. +- [IsFunction](IsFunction/index.md) + - : Returns true if this object is a function. +- [IsInt](IsInt/index.md) + - : Returns true if this object is an integer. +- [IsNull](IsNull/index.md) + - : Returns true if this object is null. +- [IsObject](IsObject/index.md) + - : Returns true if this object is an object. +- [IsString](IsString/index.md) + - : Returns true if this object is a string. +- [IsUndefined](IsUndefined/index.md) + - : Returns true if this object is undefined. +- [Set](Set/index.md) + - : Sets an array value by its index. +- [SetProperty](SetProperty/index.md) + - : Sets a property to this object. +- [ToBool](ToBool/index.md) + - : Converts this object to a boolean value. +- [ToDouble](ToDouble/index.md) + - : Converts this object to a double value. +- [ToInt](ToInt/index.md) + - : Converts this object to an integer. +- [ToString](ToString/index.md) + - : Converts this object to a string. + + diff --git a/site/pages/Docs/Document Builder/Builder Framework/Python/index.md b/site/pages/Docs/Document Builder/Builder Framework/Python/index.md index c4acba2e8..a5d1bfb32 100644 --- a/site/pages/Docs/Document Builder/Builder Framework/Python/index.md +++ b/site/pages/Docs/Document Builder/Builder Framework/Python/index.md @@ -2,12 +2,24 @@ order: -2 --- -For the integration of **ONLYOFFICE Document Builder** into any application, the Python **doctrenderer** library is used. The current application version contains four main classes: +For the integration of ONLYOFFICE Document Builder into any application, the Python doctrenderer library is used. -- [CDocBuilder](CDocBuilder/index.md) class - used by **ONLYOFFICE Document Builder** for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. -- [CDocBuilderContext](CDocBuilderContext/index.md) class - used by **ONLYOFFICE Document Builder** for getting JS context for working. -- [CDocBuilderContextScope](CDocBuilderContextScope/index.md) class - the stack-allocated class which sets the execution context for all operations executed within a local scope. -- [CDocBuilderValue](CDocBuilderValue/index.md) class - used by **ONLYOFFICE Document Builder** for getting the results of called JS commands. It represents a wrapper for a JS object. +## Classes + +The current application version contains four main classes: + + + +- [CDocBuilder](CDocBuilder/index.md) + - : Used by ONLYOFFICE Document Builder for the document file (text document, spreadsheet, presentation, form document, PDF) to be generated. +- [CDocBuilderContext](CDocBuilderContext/index.md) + - : Used by ONLYOFFICE Document Builder for getting JS context for working. +- [CDocBuilderContextScope](CDocBuilderContextScope/index.md) + - : The stack-allocated class which sets the execution context for all operations executed within a local scope. +- [CDocBuilderValue](CDocBuilderValue/index.md) + - : Used by ONLYOFFICE Document Builder for getting the results of called JS commands. It represents a wrapper for a JS object. + + ## Example diff --git a/site/pages/Docs/Document Builder/Get Started/Debugging/index.md b/site/pages/Docs/Document Builder/Get Started/Debugging/index.md index b66d0066e..4faf2ad50 100644 --- a/site/pages/Docs/Document Builder/Get Started/Debugging/index.md +++ b/site/pages/Docs/Document Builder/Get Started/Debugging/index.md @@ -6,7 +6,7 @@ You can debug any Document Builder [component](../../Get%20Started/Overview/inde ## Executing from a browser (for plugins and macros) -1. Open the **Plugins** tab and click **Macros**. +1. Open the **View** tab and click **Macros**. 2. Use the **debugger** command in your script: diff --git a/site/pages/Docs/Office API/Usage API/Samples/Creating table document/index.md b/site/pages/Docs/Office API/Usage API/Samples/Creating table document/index.md index 101f7753e..18db020a5 100644 --- a/site/pages/Docs/Office API/Usage API/Samples/Creating table document/index.md +++ b/site/pages/Docs/Office API/Usage API/Samples/Creating table document/index.md @@ -51,7 +51,7 @@ for (let i = 1; i < 10; i += 1) { const oCell = oTable.GetRow(i).GetCell(j) oCell.SetVerticalAlign("center") const oCellContent = oCell.GetContent() - oParagraph = oCellContent.GetElement(0) + const oParagraph = oCellContent.GetElement(0) oParagraph.AddText(data[j][i - 1]) oParagraph.SetJc("center") setTextColor(oParagraph, data[j][i - 1]) diff --git a/site/pages/Docs/Plugin and Macros/Get Started/Getting started/index.md b/site/pages/Docs/Plugin and Macros/Get Started/Getting started/index.md index bd25ae869..7819c466c 100644 --- a/site/pages/Docs/Plugin and Macros/Get Started/Getting started/index.md +++ b/site/pages/Docs/Plugin and Macros/Get Started/Getting started/index.md @@ -2,96 +2,191 @@ order: -1 --- -Here are some fundamental concepts for building plugins step by step: - -1. Preparing -2. Coding -3. Adjusting the plugin style -4. Localizing -5. Preparing the plugin for publication -6. Testing -7. Publishing - -## Step 1. Preparing - -1. To create a plugin and publish it in the **ONLYOFFICE Plugin Marketplace**, you need an account on [GitHub](https://github.com/). Sing in to an existing account or create a new one. - -2. Fork the plugin marketplace repository: . - - You get a repository with the following address - `https://github.com/YOUR-USERNAME/ONLYOFFICE/onlyoffice.github.io`. - -3. Build your own GitHub Pages site from this repository to test your plugin in the web version later. Explore the official [GitHub documentation](https://docs.github.com/en/pages/quickstart) to learn how to do it. +Let's see how to build the simplest [Hello world](https://github.com/ONLYOFFICE/sdkjs-plugins/tree/master/helloworld) plugin, which inserts the *Hello World!* phrase when you press the button. + +## Building a plugin + +1. Create a plugin folder. Follow the plugin structure described [here](../../Structure/index.md). The plugin folder must contain three files required for the plugin to work: [config.json](../../Structure/Manifest/index.md), [index.html](../../Structure/Entry%20point/index.md), [pluginCode.js](../../Interacting%20with%20editors/Overview/index.md): + + ![Structure](/assets/images/plugins/plugins-structure.png) + + ### config.json + + ``` json + { + "name": "hello world", + "guid": "asc.{0616AE85-5DBE-4B6B-A0A9-455C4F1503AD}", + "baseUrl": "", + "variations": [ + { + "description": "hello world", + "url": "index.html", + "icons": ["resources/img/icon.png", "resources/img/icon@2x.png"], + "isViewer": false, + "EditorsSupport": ["word"], + "isVisual": false, + "isModal": true, + "isInsideMode": false, + "initDataType": "none", + "initData": "", + "isUpdateOleOnResize": true, + "buttons": [] + }, + { + "description": "About", + "url": "index_about.html", + "icons": ["resources/img/icon.png", "resources/img/icon@2x.png"], + "isViewer": false, + "EditorsSupport": ["word"], + "isVisual": true, + "isModal": true, + "isInsideMode": false, + "initDataType": "none", + "initData": "", + "isUpdateOleOnResize": true, + "buttons": [ + { + "text": "Ok", + "primary": true + } + ], + + "size": [392, 147] + } + ] + } + ``` -4. Clone the fork to your local computer. + ### index.html + + ``` html + + + + + Hello world + + + + + + + + + ``` -5. Add a folder for your plugin to *onlyoffice.github.io/sdkjs-plugins/content/*. + ### pluginCode.js - ![New folder](/assets/images/plugins/new-folder.png) + ``` ts + // Example insert text into editors (different implementations) + ((window) => { + const text = "Hello world!" + window.Asc.plugin.init = () => { + const variant = 2 + + switch (variant) { + case 0: + // serialize command as text + let sScript = "var oDocument = Api.GetDocument();" + sScript += "oParagraph = Api.CreateParagraph();" + sScript += "oParagraph.AddText('Hello world!');" + sScript += "oDocument.InsertContent([oParagraph]);" + this.info.recalculate = true + this.executeCommand("close", sScript) + break + case 1: + // call command without external variables + this.callCommand(() => { + const oDocument = Api.GetDocument() + const oParagraph = Api.CreateParagraph() + oParagraph.AddText("Hello world!") + oDocument.InsertContent([oParagraph]) + }, true) + break + case 2: + // call command with external variables + Asc.scope.text = text // export variable to plugin scope + this.callCommand(() => { + const oDocument = Api.GetDocument() + const oParagraph = Api.CreateParagraph() + oParagraph.AddText(Asc.scope.text) // or oParagraph.AddText(scope.text); + oDocument.InsertContent([oParagraph]) + }, true) + break + default: + break + } + } + + window.Asc.plugin.button = (id) => {} + })(window) + ``` -## Step 2. Coding + Use plugin [methods](../../Interacting%20with%20editors/Methods/index.md) and events while writing the plugin code. For example, in the **Hello world** plugin, we use the `init` and `button` events, and the `callCommand` and `executeMethod` methods. -[Develop](../../Tutorials/Developing/index.md) a plugin. Follow the plugin structure described [here](../../Structure/index.md). The plugin folder must contain three files required for the plugin to work: [config.json](../../Structure/Manifest/index.md), [index.html](../../Structure/Entry%20point/index.md), [pluginCode.js](../../Interacting%20with%20editors/Overview/index.md). + Read the plugin [customization](../../Customization/index.md) section to find out how the plugin can be displayed in the editor: as context menu items, toolbar buttons, windows, left or right panels, input helpers. Choose the option that is suitable for your plugin and customize it following our instructions. -![Structure](/assets/images/plugins/plugins-structure.png) +2. Add the ONLYOFFICE [style sheet](../../Structure/Styles/index.md) to the *index.html* file to adjust your plugin to the ONLYOFFICE editor style: -Use plugin [methods](../../Interacting%20with%20editors/Methods/index.md) and [events](../../Interacting%20with%20editors/Events/index.md) while writing the plugin code. +``` html + +``` -Read the plugin [customization](../../Customization/index.md) section to find out how the plugin can be displayed in the editor: as context menu items, toolbar buttons, windows, left or right panels, input helpers. Choose the option that is suitable for your plugin and customize it following our instructions. +3. [Localize](../../Structure/Localization/index.md) your plugin if needed. -## Step 3. Adjusting the plugin style +4. Create an informative **About** window for your plugin. Add a short description and the plugin version, the company developer name and link to its website. Follow the instructions [here](../../Structure/Manifest/Variations/index.md) to create an **About** variation in the *config.json* file. -Add the ONLYOFFICE [style sheet](../../Structure/Styles/index.md) to the *index.html* file to adjust your plugin to the ONLYOFFICE editor style: + ![About window](/assets/images/plugins/about-variation.png) -``` html - -``` + Don't forget to create the *index_about.html* file for the **About** window. -![Controls](/assets/images/plugins/controls.png) +## Connecting a plugin to the editors -## Step 4. Localizing +### To desktop editors -Create the *translations* folder in the plugin directory with *.json* files for each language you want to add the translation for. Follow the instructions [here](../../Structure/Localization/index.md) to localize and apply the translations. +1. Pack all the plugin files within the plugin folder into a `zip` archive and change its extension to `.plugin` (all the plugin files and subfolders must be at the archive root). -## Step 5. Preparing the plugin for publication +2. Install a plugin [through the Plugin Manager](../../Tutorials/Installing/ONLYOFFICE%20Desktop%20Editors/index.md#adding-plugins-through-the-plugin-manager). -1. Create an informative **About** window for your plugin. Add a short description and the plugin version, the company developer name and link to its website. Follow the instructions [here](../../Structure/Manifest/Variations/index.md) to create an **About** variation in the *config.json* file. +3. The plugin will appear in the *sdkjs-plugins* directory. The path to the folder depends on the operating system you use: -2. ![About window](/assets/images/plugins/about-variation.png) + - For Linux - `home//.local/share/onlyoffice/desktopeditors/sdkjs-plugins/` + - For Windows - `C:\Users\\AppData\Local\ONLYOFFICE\DesktopEditors\data\sdkjs-plugins\` + - For macOS - `Users//Library/Application Support/asc.onlyoffice.ONLYOFFICE/sdkjs-plugins/` - Prepare icons for the plugin and put them into the *resources* folder. Follow the instructions [here](../../Structure/Icons/index.md) to specify icon parameters in the *config.json* file. + A plugin **GUID** will be used as the folder name. For example, *{07FD8DFA-DFE0-4089-AL24-0730933CC80A}*. - > Please note that you need to prepare 8 icons for the plugin to display correctly in the plugin marketplace: 4 icon scaling types (125%, 150%, 175%, 200%) for both light and dark themes. + ![Sdkjs-plugins folder](/assets/images/plugins/sdkjs-plugins-folder.png) -3. Don’t forget about the *readme* file where you can add a detailed plugin description, installation and usage instructions, known issues, etc. Put this file into the main plugin folder. + You can edit the plugin and reload it to see the changes. -## Step 6. Testing + To debug the plugin in the desktop editors, follow the instructions [here](../../Tutorials/Developing/For%20desktop%20editors/index.md#debugging). -Put all the prepared files to the plugin folder and push it to the remote repository. That’s it! Now you can connect it to the desktop or web versions of ONLYOFFICE editors and test. +### To web editors -1. Test the plugin in the [ONLYOFFICE Desktop Editors](../../Tutorials/Installing/ONLYOFFICE%20Desktop%20Editors/index.md). +1. Start distributing a folder. To do this, open the created folder and run the following commands: - You can run this app in the debug mode with the *--ascdesktop-support-debug-info* flag. To do this, follow the instructions [here](../../../Desktop%20Editors/Usage%20API/Debugging/index.md) depending on the operating system you use. + ``` sh + npm install http-server -g + http-server -p --cors + ``` - ![Hello world gif](/assets/images/plugins/hello-world.gif) + where **port** is the port number with ONLYOFFICE Docs installed. -2. Test the plugin in the web version. + > CORS requests are needed so that plugin files can be loaded from any server. - To create an extension, open the *onlyoffice.github.io/store/plugin-dev/extension/inject.js* file and assign the path to your plugin on GitHub Pages site to the **URL\_TO\_PLUGIN** variable: +2. Open the developer console in any ONLYOFFICE web editor, go to the **Console** tab, choose the **frameEditor** from the drop-down list, and run the following command: ``` ts - const URL_TO_PLUGIN = "https://YOUR-USERNAME.github.io/onlyoffice.github.io/sdkjs-plugins/content/helloworld/" + Asc.editor.installDeveloperPlugin("https://:/config.json") ``` - The *onlyoffice.github.io/store/plugin-dev/extension* folder is a new extension. Upload it to the [browser](../../Tutorials/Installing/ONLYOFFICE%20Cloud/index.md#step-2-uploading-extensions-to-the-browser), run your ONLYOFFICE Docs and find the plugin in the [Plugin Manager](../../Tutorials/Installing/ONLYOFFICE%20Docs%20on-premises/index.md#adding-plugins-through-the-plugin-manager). + where **documentserver** is the name of the server, and **port** is the port number with the ONLYOFFICE Docs installed. - To debug ONLYOFFICE plugins in the web editors, follow the instructions [here](../../Tutorials/Developing/For%20web%20editors/index.md). + ![Developer console](/assets/images/plugins/developer-console.png) > Please note that this is important to open your plugin in the **Plugin Manager** and check how it looks like in the **My Plugins** tab both in the light and dark themes. Improve the plugin display if necessary. - ![Plugin manager](/assets/images/plugins/plugin-manager.png) - -## Step 7. Publishing - -If you want your plugin to be available to other users in the **ONLYOFFICE Plugin Marketplace**, suggest it for publishing by creating a [pull request](https://github.com/ONLYOFFICE/onlyoffice.github.io/pulls) from your fork to `https://github.com/ONLYOFFICE/onlyoffice.github.io`. If your plugin works properly, your pull request will be approved and the plugin will appear in the marketplace. + The plugin will be displayed within the **Plugins** tab. You can edit the plugin and reload it to see the changes. -You can discuss plugin development, request a feature, or report a bug by posting an issue in the [marketplace repository](https://github.com/ONLYOFFICE/onlyoffice.github.io/issues). + To debug the plugin in the web editors, follow the instructions [here](../../Tutorials/Developing/For%20web%20editors/index.md#debugging). diff --git a/site/pages/Docs/Plugin and Macros/Get Started/Overview/index.md b/site/pages/Docs/Plugin and Macros/Get Started/Overview/index.md index 08edc2f08..a306093cb 100644 --- a/site/pages/Docs/Plugin and Macros/Get Started/Overview/index.md +++ b/site/pages/Docs/Plugin and Macros/Get Started/Overview/index.md @@ -11,7 +11,7 @@ This documentation describes: - How to [build](../../Structure/Manifest/index.md), [localize](../../Structure/Localization/index.md), run, [test](../../Tutorials/Developing/index.md) and [publish](../../Tutorials/Publishing/index.md) a plugin - How to customize plugins: create [context menu items](../../Customization/Context%20menu/index.md), [toolbar buttons](../../Customization/Toolbar/index.md), [windows and panels](../../Customization/Windows%20and%20panels/index.md), [input helpers](../../Customization/Input%20helper/index.md), process [buttons](../../Customization/Buttons/index.md) - How to [write](../../Macros/Writing%20macros/index.md), [debug](../../Macros/Debugging/index.md) and run a macro, add a custom function, or [convert](../../Macros/Converting%20VBA%20macros/index.md) VBA macros to use in ONLYOFFICE -- How to [interact with the editors](../../Interacting%20with%20editors/index.md), use ONLYOFFICE [methods](../../Interacting%20with%20editors/Methods/index.md) and [events](../../Interacting%20with%20editors/Events/index.md) +- How to [interact with the editors](../../Interacting%20with%20editors/index.md), use ONLYOFFICE [methods](../../Interacting%20with%20editors/Methods/index.md) and events - Where to find guides and [plugin](../../Tutorials/Samples/index.md)/[macro](../../Macros/Samples/index.md) code samples to get started ## What plugins can do diff --git a/site/pages/Docs/Plugin and Macros/Interacting with editors/Events/index.md b/site/pages/Docs/Plugin and Macros/Interacting with editors/Events/index.md deleted file mode 100644 index 643547e95..000000000 --- a/site/pages/Docs/Plugin and Macros/Interacting with editors/Events/index.md +++ /dev/null @@ -1,3 +0,0 @@ ---- -order: -1 ---- diff --git a/site/pages/Docs/Plugin and Macros/Macros/Adding custom functions/index.md b/site/pages/Docs/Plugin and Macros/Macros/Adding custom functions/index.md index 134aa3f7c..1bc44585c 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Adding custom functions/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Adding custom functions/index.md @@ -4,7 +4,7 @@ order: -4 Starting from version 8.1, you can add custom functions to the spreadsheets using the **Macros** plugin: -1. Open the **Plugins** tab and select **Macros**. The macros window will pop up. +1. Open the **View** tab and select **Macros**. The macros window will pop up. 2. In the **Custom functions** section, click ![Plus icon](/assets/images/plugins/plus.svg). You will be presented with the custom function template: diff --git a/site/pages/Docs/Plugin and Macros/Macros/Debugging/index.md b/site/pages/Docs/Plugin and Macros/Macros/Debugging/index.md index ac457ad2f..1eda319cb 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Debugging/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Debugging/index.md @@ -4,7 +4,7 @@ order: -3 To debug ONLYOFFICE macros, follow the instructions below. -1. Open the **Plugins** tab and click **Macros**. +1. Open the **View** tab and click **Macros**. 2. Use the **debugger** command in your script: diff --git a/site/pages/Docs/Plugin and Macros/Macros/Getting started/index.md b/site/pages/Docs/Plugin and Macros/Macros/Getting started/index.md index 879afee67..5062cee58 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Getting started/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Getting started/index.md @@ -16,7 +16,7 @@ You can find ready-to-use macros [here](../Samples/index.md) or create your own How to start writing your macro: -1. Open the **Plugins** tab and click **Macros**. +1. Open the **View** tab and click **Macros**. 2. Consult the [API documentation](../../../Office%20API/Get%20Started/Overview/index.md) to write the script. 3. [Write](../Writing%20macros/index.md) code for your macro. 4. To rename the macro, click ![Dots icon](/assets/images/plugins/dots.svg) next to the macro name and select **Rename**. Enter a new name for the macro and click **Ok**. diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Add chart/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Add chart/index.md index 60e83514a..cca33a852 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Add chart/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Add chart/index.md @@ -1,5 +1,5 @@ --- -order: -12 +order: -13 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Add comments and change cell colors in spreadsheet/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Add comments and change cell colors in spreadsheet/index.md new file mode 100644 index 000000000..e403e7b8b --- /dev/null +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Add comments and change cell colors in spreadsheet/index.md @@ -0,0 +1,48 @@ +--- +order: -1 +--- + +## Description + +Adds comments to the cells in the selection and can also change the background color of the cells. + + + + + +```ts +(function () { + var oWorksheet = Api.GetActiveSheet(); + var oRange = Api.GetSelection(); + oRange.ForEach(function (range) { + var sValue = range.GetValue(); + if (sValue > 100) { + range.AddComment("The value is bigger than 100."); + range.SetFillColor(Api.CreateColorFromRGB(255, 213, 191)); + } else { + range.AddComment("The value is less than 100."); + range.SetFillColor(Api.CreateColorFromRGB(204, 255, 255)); + } + }); +})(); +``` + +Methods used: GetActiveSheet, GetSelection, ForEach, GetValue, AddComment, SetFillColor, CreateColorFromRGB + +## Reference Microsoft VBA macro code + + + +```vb +Sub SimpleAddCommentsAndChangeColor() + Range("A1").ClearComments + Range("A1").AddComment "This is a comment for A1" + Range("A1").Interior.Color = RGB(255, 255, 0) +End Sub +``` + +## Result + + + +![Add comments and change cell colors in spreadsheet](/assets/images/plugins/add-comments-and-highlight-cells-spreadsheet.png) diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Change cell background color/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Change cell background color/index.md index 4ca31e312..de33deb5c 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Change cell background color/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Change cell background color/index.md @@ -1,5 +1,5 @@ --- -order: -19 +order: -20 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Change cell font color/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Change cell font color/index.md index 677354bb8..48cc7de97 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Change cell font color/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Change cell font color/index.md @@ -1,5 +1,5 @@ --- -order: -18 +order: -19 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Complete address information/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Complete address information/index.md index f4c561fa2..b8f0fbee9 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Complete address information/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Complete address information/index.md @@ -1,5 +1,5 @@ --- -order: -2 +order: -3 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Currency exchange rates/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Currency exchange rates/index.md index b3b7c6f8a..035d740a6 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Currency exchange rates/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Currency exchange rates/index.md @@ -1,5 +1,5 @@ --- -order: -8 +order: -9 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Format range as a table/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Format range as a table/index.md index 424e199c9..67d4ac370 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Format range as a table/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Format range as a table/index.md @@ -1,5 +1,5 @@ --- -order: -13 +order: -14 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Highlight duplicates/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Highlight duplicates/index.md index 94af5a5bf..02fceec00 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Highlight duplicates/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Highlight duplicates/index.md @@ -1,5 +1,5 @@ --- -order: -11 +order: -12 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Import CSV or TXT data/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Import CSV or TXT data/index.md index 686dc0202..3c1badac7 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Import CSV or TXT data/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Import CSV or TXT data/index.md @@ -1,5 +1,5 @@ --- -order: -7 +order: -8 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Insert text/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Insert text/index.md index 13e15d303..d711a52b4 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Insert text/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Insert text/index.md @@ -1,5 +1,5 @@ --- -order: -9 +order: -10 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Insert unique id/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Insert unique id/index.md index 1154a8873..e8e6c0332 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Insert unique id/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Insert unique id/index.md @@ -1,5 +1,5 @@ --- -order: -3 +order: -4 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Make cell font bold/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Make cell font bold/index.md index 48c63f483..b255c0520 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Make cell font bold/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Make cell font bold/index.md @@ -1,5 +1,5 @@ --- -order: -17 +order: -18 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Merge cell range/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Merge cell range/index.md index d9a1cb3c4..bb6d96569 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Merge cell range/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Merge cell range/index.md @@ -1,5 +1,5 @@ --- -order: -16 +order: -17 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Next blank row/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Next blank row/index.md index eb33b972a..ed3fbd0f6 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Next blank row/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Next blank row/index.md @@ -1,5 +1,5 @@ --- -order: -10 +order: -11 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Recalculate worksheet values/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Recalculate worksheet values/index.md index c5f9b23f5..085af91ed 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Recalculate worksheet values/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Recalculate worksheet values/index.md @@ -1,5 +1,5 @@ --- -order: -6 +order: -7 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Remove shapes from slides/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Remove shapes from slides/index.md index dbe3e51c5..26f6dc098 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Remove shapes from slides/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Remove shapes from slides/index.md @@ -1,5 +1,5 @@ --- -order: -4 +order: -5 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Replace words in document/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Replace words in document/index.md index 5bc2c9f2b..9027891c5 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Replace words in document/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Replace words in document/index.md @@ -1,5 +1,5 @@ --- -order: -1 +order: -2 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Set column width/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Set column width/index.md index 64c1bec70..5e08e0a96 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Set column width/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Set column width/index.md @@ -1,5 +1,5 @@ --- -order: -14 +order: -15 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Unhide all rows and columns/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Unhide all rows and columns/index.md index 7a7e9686a..ca19ba486 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Unhide all rows and columns/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Unhide all rows and columns/index.md @@ -1,5 +1,5 @@ --- -order: -5 +order: -6 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Unmerge cell range/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Unmerge cell range/index.md index b20add227..9d627a330 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Unmerge cell range/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Unmerge cell range/index.md @@ -1,5 +1,5 @@ --- -order: -15 +order: -16 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/Write data to worksheet cell/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/Write data to worksheet cell/index.md index 807c79811..75d93090e 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/Write data to worksheet cell/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/Write data to worksheet cell/index.md @@ -1,5 +1,5 @@ --- -order: -20 +order: -21 --- ## Description diff --git a/site/pages/Docs/Plugin and Macros/Macros/Samples/index.md b/site/pages/Docs/Plugin and Macros/Macros/Samples/index.md index 683b0c1df..a25f07778 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Samples/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Samples/index.md @@ -124,6 +124,12 @@ In this example we are replacing words in the text editor. [More](Replace%20words%20in%20document/index.md) +## Add comments and change cell colors in spreadsheet + +In this example we are adding comments and changing the background colors of selected cells. + +[More](Add%20comments%20and%20change%20cell%20colors%20in%20spreadsheet/index.md) + ## Support If you want to request a feature or report a bug regarding macros, use the issues section [on GitHub.](https://github.com/ONLYOFFICE/plugin-macros/issues) diff --git a/site/pages/Docs/Plugin and Macros/Macros/Writing macros/index.md b/site/pages/Docs/Plugin and Macros/Macros/Writing macros/index.md index 8abe3dc98..24cae5c25 100644 --- a/site/pages/Docs/Plugin and Macros/Macros/Writing macros/index.md +++ b/site/pages/Docs/Plugin and Macros/Macros/Writing macros/index.md @@ -5,7 +5,7 @@ order: -5 Now that you know how macros work, try to write your own macro. We have a table and need to color the alternate table rows (odd will be colored green, even will become red). The table contains 200 rows and columns from **A** to **S**. It would take a lot of time to do that manually. So, using macros will be the best solution for this problem. 1. Open ONLYOFFICE editors and create a new spreadsheet. -2. Now open the **Plugins** tab and select **Macros**. The macros window will pop up. You will be presented with the basic function wrapper which will allow you to enter the necessary code: +2. Now open the **View** tab and select **Macros**. The macros window will pop up. You will be presented with the basic function wrapper which will allow you to enter the necessary code: diff --git a/site/pages/Docs/Plugin and Macros/Structure/Manifest/index.md b/site/pages/Docs/Plugin and Macros/Structure/Manifest/index.md index 20d4d4d0f..959dfdbdf 100644 --- a/site/pages/Docs/Plugin and Macros/Structure/Manifest/index.md +++ b/site/pages/Docs/Plugin and Macros/Structure/Manifest/index.md @@ -64,7 +64,7 @@ Example: "" ## group -Plugin group that is separated from other plugins in the **Plugins** tab. The first group usually includes the **Plugin Manager** and **Background plugins**, if they exist. The second group is for **Macros**. Other plugins are placed after them in the third group. You can add as many groups as you need. If this parameter is omitted, the plugin will be added to the last group. +Plugin group that is separated from other plugins in the **Plugins** tab. The first group usually includes the **Plugin Manager** and **Background plugins**, if they exist. Other plugins are placed after them in the second group. You can add as many groups as you need. If this parameter is omitted, the plugin will be added to the last group. Type: object diff --git a/site/pages/Docs/Plugin and Macros/Tutorials/Publishing/index.md b/site/pages/Docs/Plugin and Macros/Tutorials/Publishing/index.md index fd956a579..06f4bf4f5 100644 --- a/site/pages/Docs/Plugin and Macros/Tutorials/Publishing/index.md +++ b/site/pages/Docs/Plugin and Macros/Tutorials/Publishing/index.md @@ -2,14 +2,28 @@ order: -2 --- -If you want your plugin to be available to other users in the **ONLYOFFICE Plugin Marketplace**, suggest it for publishing: +If you want your plugin to be available to other users in the ONLYOFFICE Plugin Marketplace, suggest it for publishing: -1. Create a fork of the repository. +1. Sing in to an existing [GitHub](https://github.com/) account or create a new one. -2. Add your plugin to this fork. +2. Fork the plugin marketplace repository: . -3. Create a [pull request](https://github.com/ONLYOFFICE/onlyoffice.github.io/pulls) from your fork to `https://github.com/ONLYOFFICE/onlyoffice.github.io`. You can use the **Submit your own plugin** button in the Plugin Manager window. + You get a repository with the following address - `https://github.com/YOUR-USERNAME/ONLYOFFICE/onlyoffice.github.io`. + +3. Build your own GitHub Pages site from this repository to test your plugin in the web version later. Explore the official [GitHub documentation](https://docs.github.com/en/pages/quickstart) to learn how to do it. + +4. Clone the fork to your local computer. + +5. Add a folder for your plugin to *onlyoffice.github.io/sdkjs-plugins/content/*. + + ![New folder](/assets/images/plugins/new-folder.png) + +6. Push the plugin folder to the remote repository.  + +7. Create a [pull request](https://github.com/ONLYOFFICE/onlyoffice.github.io/pulls) from your fork to `https://github.com/ONLYOFFICE/onlyoffice.github.io`. You can use the **Submit your own plugin** button in the Plugin Manager window. ![Submit plugin](/assets/images/plugins/submit-plugin.png) + + If your plugin works properly, your pull request will be approved and the plugin will appear in the marketplace. -4. If your plugin works properly, your pull request will be approved and the plugin will appear in the marketplace. + You can discuss plugin development, request a feature, or report a bug by posting an issue in the [marketplace repository](https://github.com/ONLYOFFICE/onlyoffice.github.io/issues). diff --git a/site/resources/docspace.ts b/site/resources/docspace.ts index 78979f97d..9e45b3c1f 100644 --- a/site/resources/docspace.ts +++ b/site/resources/docspace.ts @@ -4,6 +4,7 @@ import {type Resource, nop} from "@onlyoffice/service-resource" const require = createRequire(import.meta.url) +export const apisystem = or("apisystem") export const data = or("data") export const files = op("files") export const people = op("people")