# docx-editor-document-list

> Document list dialog opens named Word documents by author into the editor with a title bar.

**Framework:** javascript  **Component:** DocxEditor  **Variant:** document-list

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/javascript/docx-editor-document-list.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-documenteditor @syncfusion/ej2-popups
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/docx-editor-document-list/docx-editor.html

```html
<div class="control-section" style="min-height: auto;">
    <div id="Grid" style="height: calc(100vh - 160px);"></div>
    <!-- Initialize default Dialog -->
    <div id="defaultDialog">
        <div id='documenteditor_titlebar' class="e-de-ctn-title" ></div>
        <div id=documenteditor_container_body style="display: block; height: calc( -230px + 100vh);">
            <div id="container"></div>
        </div>
    </div>
</div>

<script id="fileNameTemplate">
    <div>
        <svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M3 3C3 1.34315 4.34315 0 6 0H16.7574C17.553 0 18.3161 0.316071 18.8787 0.87868L26.1213 8.12132C26.6839 8.68393 27 9.44699 27 10.2426V27C27 28.6569 25.6569 30 24 30H6C4.34315 30 3 28.6569 3 27V3Z" fill="#4889EF"/>
            <path d="M17.5 11H25V10.5042C25 9.76949 24.7304 9.0603 24.2422 8.51114L19.9463 3.67818C18.9974 2.61074 17.6374 2 16.2092 2H16V9.5C16 10.3284 16.6716 11 17.5 11Z" fill="#D6E5FE"/>
            <path d="M10.3044 12H10.8868H11.104H11.6817L12.6231 16.3922L13.3963 12H15L13.5719 19H12.777H12.5552H11.8943L10.993 15.0093L10.1103 19H9.44945H9.22761H8.42808L7 12H8.60832L9.38188 16.3816L10.3044 12Z" fill="white"/>
            <rect x="7" y="21" width="16" height="2" rx="1" fill="white"/>
            <rect x="7" y="25" width="11" height="2" rx="1" fill="white"/>
        </svg><span style="vertical-align: super;">${FileName}</span>
    </div>
</script>
<style>
@import '../style.css';
    .ej2-new {
        height: 590px;
    }
    #documenteditor_titlebar {
        border-bottom: 1px solid #2B3481;
        height: 36px;
        line-height: 26px;
        width: 100%;
        font-size: 12px;
        padding-left: 15px;
        padding-right: 10px;
        font-family: inherit;
    }

    #documenteditor_title_contentEditor {
        height: 26px;
        max-width: 85%;
        width: auto;
        overflow: hidden;
        display: inline-block;
        padding-left: 4px;
        padding-right: 4px;
        margin: 5px;
    }

    .single-line {
        cursor: text !important;
        outline: none;
    }

    .single-line:hover {
        border-color: #e4e4e4 !important;
    }

    [contenteditable="true"].single-line {
        white-space: nowrap;
        border-color: #e4e4e4 !important;
    }

    [class^="e-de-icon-"],
    [class*=" e-de-icon-"] {
        font-family: 'Sample brower icons' !important;
    }

    .e-de-icon-Print:before {
        content: "\e723";
    }

    .e-de-icon-Download:before {
        content: "\e728";
    }

    /** sample level font icons ends*/

/* Table styling (Bootstrap-like) */
#Grid table {
    border: 1px solid #d7d7d7;
    table-layout: fixed;
    width: 100%;
}
#Grid table th,
#Grid table td {
    border: 1px solid #d7d7d7;
    padding: 12px 8px;
    overflow: hidden;
    white-space: nowrap;
}
#Grid table th {
    width: 33.33%;
    font-weight: 600;
    text-align: left;
}
#Grid table th.e-de-table-actions-header {
    text-align: center;
}
#Grid table td {
    width: 33.33%;
}
#Grid table td.e-de-table-actions-cell {
    text-align: center;
}
#Grid table td.e-de-table-author-cell {
    padding-top: 20px;
}
/* Hide center column (Author) borders */
#Grid table th:nth-child(1),
#Grid table td:nth-child(1) {
    border-right: none;
}
#Grid table td:nth-child(1) {
  overflow: hidden;
  white-space: nowrap;
}
#Grid table th:nth-child(2),
#Grid table td:nth-child(2) {
    border-left: none;
    border-right: none;
}
#Grid table th:nth-child(3),
#Grid table td:nth-child(3) {
    border-left: none;
}
#Grid table tbody tr:hover {
    background-color: #f9f9f9;
}
/* Action button styles and icons */
.e-de-view-btn,
.e-de-edit-btn {
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 6px !important;
    margin: 0 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    text-decoration: none;
    outline: none;
    box-sizing: border-box;
}
.e-de-view-btn:hover,
.e-de-edit-btn:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    text-decoration: none;
    outline: none;
}
.e-de-view-btn:focus,
.e-de-edit-btn:focus {
    outline: none;
    text-decoration: none;
}
.e-de-view-btn:active,
.e-de-edit-btn:active {
    background-color: #efefef;
    border-color: #999;
    outline: none;
}
.e-de-view-icon,
.e-de-edit-icon {
    font-size: 16px;
    color: #7a8a99;
    display: inline-block;
    text-decoration: none;
    font-weight: 600;
    line-height: 1;
}
.e-de-view-btn:hover .e-de-view-icon,
.e-de-edit-btn:hover .e-de-edit-icon {
    color: #5a6a7a;
    text-decoration: none;
    font-weight: 600;
}
.e-de-view-btn:active .e-de-view-icon,
.e-de-edit-btn:active .e-de-edit-icon {
    color: #333;
    text-decoration: none;
    font-weight: 600;
}
#Grid table tbody tr:hover {
    background-color: var(--de-row-hover, rgba(0, 0, 0, 0.04));
}
/* Dark theme override */
body.e-dark-mode #Grid table tbody tr:hover,
body[class*='-dark'] #Grid table tbody tr:hover {
    background-color: var(--de-row-hover-dark, rgba(255, 255, 255, 0.07));
}
</style>

```

### src/components/docx-editor-document-list/docx-editor.ts

```typescript
// tslint:disable-next-line:max-line-length
import { DocumentEditorContainer, Toolbar} from '@syncfusion/ej2-documenteditor';
import { Dialog } from '@syncfusion/ej2-popups';
import { TitleBar } from '../title-bar';
import { defaultDocument, characterFormat, paragraphFormat, styles, weblayout } from '../datasource/docx-editor-data';

let gridData: Object[] = [
    {
        FileName: 'Getting Started.docx', Author: 'Ryan Hodson'
    },
    {
        FileName: 'Character Formatting.docx', Author: 'Elton Stoneman'
    },
    {
        FileName: 'Paragraph Format.docx', Author: 'Peter Shaw'
    },
    {
        FileName: 'Style.docx', Author: 'Cody Lindley'
    },
    {
        FileName: 'Web Layout.docx', Author: 'Scott Allen'
    },
];
export function initDocxEditorDocumentList(): void {

    let dialogObj: Dialog= new Dialog({
        width: '90%',
        height: '90%',
        visible: false,
        enableResize: true,
        isModal: true,
        zIndex: 1500,
        position: { X: 'center', Y: 'center' }
      });
    dialogObj.appendTo('#defaultDialog');

    let hostUrl: string = 'https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/';
    let container: DocumentEditorContainer = new DocumentEditorContainer({ height:"90%", serviceUrl:hostUrl, enableToolbar: true , zIndex: 3000 , documentEditorSettings:{ showRuler: true}});
    DocumentEditorContainer.Inject(Toolbar);
    container.appendTo('#container'); 
    let titleBar: TitleBar = new TitleBar(document.getElementById('documenteditor_titlebar'), container.documentEditor, true, false, dialogObj);
    container.documentChange = (): void => {
        titleBar.updateDocumentTitle();
        container.documentEditor.focusIn();
    };

    let commandClick: any = function(args:any){
        let mode = args.mode;
        let currentDocument = args.rowData.FileName;
        container.documentEditor.documentName = currentDocument.replace(".docx", "");
        titleBar.updateDocumentTitle();
        switch (currentDocument) {
            case "Getting Started.docx":
                container.documentEditor.open(JSON.stringify((<any>defaultDocument))); break;
            case "Character Formatting.docx":
                container.documentEditor.open(JSON.stringify((<any>characterFormat))); break;
            case "Paragraph Formatting.docx":
                container.documentEditor.open(JSON.stringify((<any>paragraphFormat))); break;
            case "Styles.docx":
                container.documentEditor.open(JSON.stringify((<any>styles))); break;
            case "Web layout.docx":
                container.documentEditor.open(JSON.stringify((<any>weblayout))); break;
        }
        if(mode === 'View'){
            container.documentEditor.enableContextMenu = false;
            container.documentEditor.isReadOnly = true;
            container.showPropertiesPane = false;
            const share = document.getElementById('documenteditor-share');
            if (share) share.style.display = 'none';
            container.toolbarItems = ['Open', 'Separator', 'Find'];
        } else {
            container.documentEditor.enableContextMenu = true;
            container.documentEditor.isReadOnly = false;
            container.showPropertiesPane = true;
            const share = document.getElementById('documenteditor-share');
            if (share) share.style.display = 'block';
            container.toolbarItems = ['New', 'Open', 'Separator', 'Undo', 'Redo', 'Separator', 'Image', 'Table', 'Hyperlink', 'Bookmark', 'TableOfContents', 'Separator', 'Header', 'Footer', 'PageSetup', 'PageNumber', 'Break', 'InsertFootnote', 'InsertEndnote', 'Separator', 'Find', 'Separator', 'Comments', 'TrackChanges', 'Separator', 'LocalClipboard', 'RestrictEditing', 'Separator', 'FormFields', 'UpdateFields'];
        }
        dialogObj.show();
    };

    function createTableHeader() {
        const thead = document.createElement('thead');
        const tr = document.createElement('tr');
        const headerCells: string[] = ['File Name', 'Author', 'Actions'];
        headerCells.forEach((headerText) => {
            const th = document.createElement('th');
            th.setAttribute('scope', 'col');
            th.textContent = headerText;
            if (headerText === 'Actions') {
                th.classList.add('e-de-table-actions-header');
            }
            tr.appendChild(th);
        });
        thead.appendChild(tr);
        return thead;
    }

    function createIconSpan(iconClass: any) {
        const span = document.createElement('span');
        span.className = 'e-icons ' + iconClass + ' e-flat';
        if (iconClass.includes('e-eye')) {
            span.classList.add('e-de-view-icon');
        } else if (iconClass.includes('e-edit')) {
            span.classList.add('e-de-edit-icon');
        }
        return span;
    }

    function renderBootstrapTable(): void {
        const gridContainer = document.querySelector('#Grid');
        const tplScript = document.getElementById('fileNameTemplate') as HTMLScriptElement;
        const tplHtml = tplScript ? tplScript.innerHTML.trim() : '';
        let tplNode: HTMLElement | undefined;
        if (tplHtml) {
            const tmp = document.createElement('div');
            tmp.innerHTML = tplHtml;
            tplNode = tmp.firstElementChild as HTMLElement;
        }

        const table = document.createElement('table');
        table.className = 'table table-hover table-borderless align-middle';
        table.appendChild(createTableHeader());
        const tbody = document.createElement('tbody');

        gridData.forEach((row: any) => {
            const tr = document.createElement('tr');

            // File name cell (with template)
            const fileNameTd = document.createElement('td');
            if (tplNode) {
                const clone = tplNode.cloneNode(true) as HTMLElement;
                const span = clone.querySelector('span');
                if (span) { span.textContent = row.FileName; }
                fileNameTd.appendChild(clone);
            } else {
                fileNameTd.textContent = row.FileName;
            }
            tr.appendChild(fileNameTd);

            // Author cell
            const authorTd = document.createElement('td');
            authorTd.textContent = row.Author;
            authorTd.classList.add('e-de-table-author-cell');
            tr.appendChild(authorTd);

            // Actions cell
            const actionTd = document.createElement('td');
            actionTd.classList.add('e-de-table-actions-cell');

            const viewBtn = document.createElement('button');
            viewBtn.type = 'button';
            viewBtn.className = 'btn btn-sm btn-link text-secondary p-2 e-de-view-btn';
            viewBtn.title = 'View';
            viewBtn.appendChild(createIconSpan('e-eye'));
            viewBtn.addEventListener('click', () => {
                commandClick({ mode: 'View', rowData: row });
            });

            const editBtn = document.createElement('button');
            editBtn.type = 'button';
            editBtn.className = 'btn btn-sm btn-link text-secondary p-2 e-de-edit-btn';
            editBtn.title = 'Edit';
            editBtn.appendChild(createIconSpan('e-edit'));
            editBtn.addEventListener('click', () => {
                commandClick({ mode: 'Edit', rowData: row });
            });

            actionTd.appendChild(viewBtn);
            actionTd.appendChild(editBtn);
            tr.appendChild(actionTd);
            tbody.appendChild(tr);
        });

        table.appendChild(tbody);
        (gridContainer as HTMLElement).innerHTML = '';
        (gridContainer as HTMLElement).appendChild(table);
    }

    function destroyed() {
        container.destroy();
        dialogObj.destroy();
    }

    // Initial render
    renderBootstrapTable();

    // cleanup on unload
    window.addEventListener('beforeunload', destroyed, { once: true });
}

```
