# Document editor # Content export template editor ## Open and navigate **Administration → Module Export Builder → module → template**, `/content-export-templates/:moduleKey/editor/:id` (`new` for a new form). This is a document editor, not an editor of source records. Start from the [template library](/en/docs/content-export-templates) to select the correct source. The title bar contains Back, save indicator, name, language (RU/EN/HY), history and Save. | Ribbon | Purpose | |---|---| | Home | Undo/redo, clipboard, fonts, size, emphasis, alignment, lists, find/replace, text formatting. | | Insert | Tables, pictures, variables, shared blocks, other elements and document properties. Type `/` in text to open insertion commands. | | Layout | Paper (A3, A4, A5, Letter), orientation, margins, borders, page color, breaks, selected block spacing. Unimplemented commands such as line numbers are disabled. | | View | View mode, zoom, workspace appearance and real document preview. | The settings sidebar depends on selection: document, sheet, block, variable or repeating group. Changing an option is not saving to the server. ## Document and sheet properties - Name appears in the title bar (at least one nonempty translation, up to 255 characters). Switch language to enter names, descriptions, text and labels; translation is not automatic. - Status and default flag concern the document; educational degree and learning format define applicability. Empty criteria are universal. A default must be active. - Form settings (presenter options) come from the specific module. Do not invent missing fields. The Approval date switch adds export input `export.approval_date`; the document must also contain the intended text and variable. - Each sheet has a name, paper, portrait/landscape orientation, margins, pagination settings and header/footer. Disable a band or choose an appropriate [reusable partial](/en/docs/content-export-partials). - Add and manage sheets from the bottom tabs. Each sheet has its own settings; the last cannot be removed. A hidden sheet is not intended for ordinary display; repeating sheets use the special `lecturer_sheets` source where supported. - Text can specify display languages and multiple-translation layout: inline or stacked. Test each document language. ## Content and variables Insert paragraphs, headings, tables, images, page breaks, input, select, signature, date, divider, spacer or group. Select blocks to configure their type-specific properties, size and style; use available commands to place and remove them. Insert a variable from the catalog rather than printing its technical key as text. The catalog depends on module and source: common values, record fields and current-row fields in repeating sources. Loop variables only appear where the source is supported. To create a repeating group, choose a source in document properties; its contents repeat over data. Grouping and sorting are restricted to fields that the source supports. Complete any required variable properties, such as signatory selection. See [shared blocks](/en/docs/content-export-snippets) for reusing a complete block. ## Tables and data sources 1. Insert a table and choose the row/column count. It starts as a regular table; enter text, values and variables manually. 2. For a data table, open table settings and change the source to module data. This option requires a loaded module schema. Select the correct section; columns and sources are refreshed from its catalog. 3. Configure visibility, ordering, labels and nested columns, each column's data field, width/automatic sizing, alignment, header rotation, number display, cell and header styles. For regular tables configure rows and cell merges/splits. Module data tables support source-specific row filters, totals, calculations and generated columns where the schema permits. Do not invent identifiers. 4. Check overflow and repeated headers across pages on several records. Close the table settings before saving the document. | Module | Table sections | |---|---| | Learning plan | Main, process graph (`process_graph`), official plan (`official_plan`). | | Workload | Subjects (`subjects`), assignments (`assignments`), teaching load (`teaching_load`); `all` and `main` are legacy sources. | | Lecturer and department workload | Main, teaching load (`teaching_load`), rate (`rate`). | | Other modules | Main (`main`); `all` is a legacy alias of main, not every table together. | Each source has different fields. A section can be absent from a selected record even if the catalog supports it. When designing a learning plan, test [process schedules](/en/docs/process-schedules) separately; for workload see [workload details](/en/docs/workload-details). ## Preview, saving and history Save first. In View, select a real record from the candidate panel, complete required dependent filters and export input fields if shown. Refresh PDF; printing PDF and downloading XLSX are available when the preview is ready. The server creates the actual result from the saved form and selected data. Unsaved changes do not change this PDF; refresh after changing the form or data. Editor pagination is not the final PDF layout. Save submits the entire document, translations, status, applicability, background and page settings. A new document receives a permanent ID after saving. Leaving a dirty document prompts a warning; the editor can offer local draft recovery when reopened. A local draft is not a saved server revision. Open the history of a saved form to select and inspect an earlier revision. Restoring a document revision creates a new copy with creation permission, rather than silently overwriting the current document. Activate the completed form from the list. ## Example Create a learning plan draft “Learning plan — subject table”. Fill name translations, insert a heading and a variable from the learning plan catalog. Insert a table, switch it to module data, and choose main or official-plan data as appropriate. Configure subject names and their fields. Add a separate sheet for the process graph if needed, with a `process_graph` table. Choose a header, save, then check PDF and XLSX against plans of different lengths in all three languages before activation. ## Permissions and troubleshooting `ContentExportTemplatesTablePull` opens the editor, catalogs and history; `ContentExportTemplatesCreateAction` creates a new template; `ContentExportTemplatesEditAction` saves an existing one. Without the applicable permission, the editor is read-only. Creating a shared block requires `ContentExportSnippetsCreateAction`. Record and signatory candidate lookup follows Faculty/Profession/Department restrictions of relevant models, not template-target criteria. - Missing variable or section: verify module, block/loop context and catalog loading. - Preview unavailable: save, select an accessible record and complete required inputs. - No candidates: check source records, dependent selections and role scopes. - Save rejected: check name, active status of default, required variable properties and layout validity. On version conflict compare with server version before proceeding. - Rows overflow: review paper margins, font size, widths and repeated headers; test PDF independently from XLSX. ## Verified source files - [DocumentEditor.tsx](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/features/documentEditor/DocumentEditor.tsx) - [TemplateProperties.tsx](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/features/documentEditor/TemplateProperties.tsx) - [DocumentHistory.tsx](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/features/documentEditor/DocumentHistory.tsx) - [InsertRibbon.tsx](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/features/documentEditor/InsertRibbon.tsx) - [LayoutRibbon.tsx](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/features/documentEditor/LayoutRibbon.tsx) - [HomeRibbon.tsx](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/features/documentEditor/HomeRibbon.tsx) - [ViewRibbon.tsx](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/features/documentEditor/ViewRibbon.tsx) - [RepeatProperties.tsx](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/features/documentEditor/RepeatProperties.tsx) - [TableBlockEditor.tsx](https://gitlab.kamoorj.com/development/frontend-edusystems/-/blob/b928b3290040bab5c888b195b813f6705170e309/src/admin/src/features/documentBuilder/TableBlockEditor.tsx) - [ContentExportTemplateVariableCatalog.php](https://gitlab.kamoorj.com/development/backend-edusystems/-/blob/83e0edc8d75daf02ae011b433d0be83afe994212/app/Modules/ContentExportTemplates/Services/ContentExportTemplateVariableCatalog.php) - [ContentExportCapabilityManifest.php](https://gitlab.kamoorj.com/development/backend-edusystems/-/blob/83e0edc8d75daf02ae011b433d0be83afe994212/app/Modules/ContentExportTemplates/Services/ContentExportCapabilityManifest.php) - [ContentExportTemplatePreviewService.php](https://gitlab.kamoorj.com/development/backend-edusystems/-/blob/83e0edc8d75daf02ae011b433d0be83afe994212/app/Modules/ContentExportTemplates/Services/ContentExportTemplatePreviewService.php) - [TiptapDocumentCompiler.php](https://gitlab.kamoorj.com/development/backend-edusystems/-/blob/83e0edc8d75daf02ae011b433d0be83afe994212/app/Modules/ContentExportTemplates/Services/TiptapDocumentCompiler.php) - [ContentExportModule.php](https://gitlab.kamoorj.com/development/backend-edusystems/-/blob/83e0edc8d75daf02ae011b433d0be83afe994212/app/Modules/ContentExportTemplates/Enums/ContentExportModule.php) - [api.php](https://gitlab.kamoorj.com/development/backend-edusystems/-/blob/83e0edc8d75daf02ae011b433d0be83afe994212/app/Modules/ContentExportTemplates/routes/api.php)