{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "docx-editor-form-fields",
  "framework": "angular",
  "type": "registry:component",
  "component": "DocxEditor",
  "variant": "form-fields",
  "dependencies": [
    "@syncfusion/ej2-angular-documenteditor",
    "@syncfusion/ej2-angular-popups"
  ],
  "description": "Word editor loads a form-fields document with fillable form content and spinner loading.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": true,
    "platformIndex": "https://ai.syncfusion.com/angular/llms.txt",
    "skillPack": "syncfusion/angular-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/angular/docx-editor-form-fields.md"
  },
  "files": [
    {
      "target": "src/components/docx-editor-form-fields/docx-editor.component.html",
      "content": "<div class=\"control-section\">\n    <div>\n        <div id=\"default_title_bar\" class=\"e-de-ctn-title\"></div>\n        <div style=\"display:block; height: calc(100vh - 230px);\">\n            <ejs-documenteditorcontainer #documenteditor_default id=\"container\" [enableToolbar]=true [locale]=\"culture\" [toolbarMode]=\"'Ribbon'\" (created)=\"onCreate()\" [showPropertiesPane]=false\n            [documentEditorSettings]=\"settings\" (documentChange)=\"onDocumentChange()\" [serviceUrl]=\"hostUrl\"  height=\"100%\" style=\"display:block;\"  [fileMenuItems]=\"fileMenuItems\" (fileMenuItemClick)=\"fileMenuItemClick($event)\"></ejs-documenteditorcontainer>\n        </div>\n    </div>\n</div>\n<style>\n@import '../style.css';\n#documenteditor_title_contentEditor {\n        height: 26px;\n        max-width: 75%;\n        width: auto;\n        overflow: hidden;\n        display: inline-block;\n        padding-left: 4px;\n        padding-right: 4px;\n        margin: 5px;\n    }\n\n    .single-line {\n        cursor: text !important;\n        outline: none;\n    }\n\n    #default_title_bar {\n        height: 36px;\n        line-height: 26px;\n        width: 100%;\n        font-size: 12px;\n        padding-left: 15px;\n        padding-right: 10px;\n        font-family: inherit;\n\t\tbox-sizing: border-box;\n    }\n\n    [class^=\"e-de-icon-\"],\n    [class*=\" e-de-icon-\"] {\n        font-family: 'Sample brower icons' !important;\n    }\n\n    .e-de-icon-Print:before {\n        content: \"\\e723\";\n    }\n\n    .e-de-icon-Download:before {\n        content: \"\\e728\";\n    }\n\n    /** sample level font icons ends*/\n</style>\n<script>\n    window.onbeforeunload = function () {\n        return 'Want to save your changes?';\n    };    \n</script>"
    },
    {
      "target": "src/components/docx-editor-form-fields/docx-editor.component.ts",
      "content": "import { Component, ViewEncapsulation, ViewChild } from '@angular/core';\nimport { ToolbarService, RibbonService, DocumentEditorContainerComponent, LayoutType, DocumentEditorContainerModule, DocumentEditorSettingsModel } from '@syncfusion/ej2-angular-documenteditor';\nimport { TitleBar } from '../title-bar';\nimport { formfields, WEB_API_ACTION } from '../datasource/docx-editor-data';\nimport { isNullOrUndefined } from '@syncfusion/ej2-base';\n\nimport { createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-angular-popups';\n\n/**\n * Document Editor Component\n */\n@Component({\n    selector: 'control-content',\n    templateUrl: 'docx-editor.component.html',\n    encapsulation: ViewEncapsulation.None,\n    providers: [ToolbarService, RibbonService],\n    standalone: true,\n    imports: [DocumentEditorContainerModule]\n})\nexport class FormFieldsComponent {\n    public hostUrl: string = 'https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/';\n    public settings: DocumentEditorSettingsModel = { showRuler: true };\n    @ViewChild('documenteditor_default')\n    public container!: DocumentEditorContainerComponent;\n    public culture: string = 'en-US';\n    titleBar!: TitleBar;\n    layoutType: LayoutType = \"Continuous\";\n\n    public fileMenuItems: any = [\n        'New',\n        'Open',\n        {\n            text: 'Export',\n            id: 'custom_item',\n            iconCss: 'e-icons e-export',\n            items: [\n                { id: 'sfdt', text: 'Syncfusion Document Text (*.sfdt)' },\n                { id: 'docx', text: 'Word Document (*.docx)' },\n                { id: 'dotx', text: 'Word Template (*.dotx)' },\n                { id: 'text', text: 'Plain Text (*.txt)' },\n                { id: 'pdf', text: 'PDF (*.pdf)' },\n                { id: 'html', text: 'HyperText Markup Language (*.html)' },\n                { id: 'rtf', text: 'Rich Text Format (*.rtf)' },\n                { id: 'md', text: 'Markdown (*.md)' },\n                { id: 'odt', text: 'OpenDocument Text (*.odt)' },\n                { id: 'wordml', text: 'Word XML Document (*.xml)' }\n            ],\n        },\n        'Print',\n    ];\n\n    public fileMenuItemClick(args: any): void {\n        if (args.item.id) {\n            let value: string = args.item.id;\n            switch (value) {\n                case 'docx':\n                this.container.documentEditor.save('Sample', 'Docx');\n                break;\n                case 'sfdt':\n                this.container.documentEditor.save('Sample', 'Sfdt');\n                break;\n                case 'text':\n                this.container.documentEditor.save('Sample', 'Txt');\n                break;\n                case 'dotx':\n                this.container.documentEditor.save('Sample', 'Dotx');\n                break;\n                case 'pdf':\n                this.formatSave('Pdf');\n                break;\n                case 'html':\n                this.formatSave('Html');\n                break;\n                case 'odt':\n                this.formatSave('Odt');\n                break;\n                case 'md':\n                this.formatSave('Md');\n                break;\n                case 'rtf':\n                this.formatSave('Rtf');\n                break;\n                case 'wordml':\n                this.formatSave('Xml');\n                break;\n            }\n        }\n    }\n\n    public formatSave(type: string): void {\n        createSpinner({\n            target: document.getElementById('container')!,\n        });\n        showSpinner(document.getElementById('container')!);\n        let format: string = type;\n        let url = this.container.documentEditor.serviceUrl + 'Export';\n        let http = new XMLHttpRequest();\n        http.open('POST', url);\n        http.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');\n        http.responseType = 'blob'; // Set the responseType to 'blob' to handle binary data\n\n        // Prepare data to send\n        let sfdt = {\n            Content: this.container.documentEditor.serialize(),\n            Filename: this.container.documentEditor.documentName,\n            Format: '.' + format,\n        };\n\n        // Set up event listener for the response\n        http.onload = () => {\n            if (http.status === 200) {\n                // Handle the response blob here\n                let responseData = http.response;\n\n                // Create a Blob URL for the response data\n                let blobUrl = URL.createObjectURL(responseData);\n\n                // Create a link element and trigger the download\n                let downloadLink = document.createElement('a');\n                downloadLink.href = blobUrl;\n                downloadLink.download = this.container.documentEditor.documentName + '.' + format.toLowerCase();\n                document.body.appendChild(downloadLink);\n                hideSpinner(document.getElementById('container')!);\n                downloadLink.click();\n\n                // Cleanup: Remove the link and revoke the Blob URL\n                document.body.removeChild(downloadLink);\n                URL.revokeObjectURL(blobUrl);\n            } else {\n                // Handle errors\n                console.error('Request failed with status:', http.status);\n                hideSpinner(document.getElementById('container')!);\n            }\n        };\n\n        // Send the request with JSON.stringify(sfdt) as the request body\n        http.send(JSON.stringify(sfdt));\n    }\n\n    onCreate(): void {\n        let titleBarElement: HTMLElement = document.getElementById('default_title_bar')!;\n        this.titleBar = new TitleBar(titleBarElement, this.container.documentEditor, true);\n        this.container.documentEditor.open(JSON.stringify(formfields));\n        this.container.documentEditor.documentName = 'Form Fields';\n        this.container.documentEditorSettings.showRuler = true;\n        this.titleBar.updateDocumentTitle();\n        this.titleBar.showButtons(false);\n    }\n\n    onDocumentChange(): void {\n        if (!isNullOrUndefined(this.titleBar)) {\n            this.titleBar.updateDocumentTitle();\n        }\n        this.container.documentEditor.focusIn();\n    }\n}\n"
    }
  ]
}