Layout from excel

From SteelMorgan/1c-agent-based-dev-framework · View interactive version

Layout from excel is an AI agent skill from the GitHub repository SteelMorgan/1c-agent-based-dev-framework. Transfer a layout from Excel to 1C through structural analysis or platform import into SpreadsheetDocument: what is preserved, what is lost, and how to use imported MXL honestly as a visual framework.

How to use this skill

Skill file

Layout from Excel

Purpose

Use this skill when the layout source is an Excel file (.xlsx, .xls) and you need to understand

how to transfer it honestly into the world of SpreadsheetDocument/MXL.

An Excel source should not be processed as an image by default. Unlike PNG/JPG, Excel already

contains structural data:

The basic strategy should be programmatic, not visual.

Skill scope

This skill handles converting an Excel source into a verifiable spreadsheet document framework.

It does not mean automatically obtaining:

The result of this skill is usually one of two things:

  1. Either an Excel structural specification for subsequent manual implementation.
  2. Or an imported MXL/SpreadsheetDocument used as a visual framework for

further application-level population.

Two working paths

1. Structural workbook analysis

Use when you need to:

This is done with a tool that reads the workbook as a structure, not as an image —

for example, openpyxl. A ready-made script for comparing “source vs round-trip result”:

references/compare_xlsx_fidelity.py (sheets, grid, merges, values, widths, heights,

number formats, formulas, freeze panes, auto filter, print area).

2. Platform Import `Excel -> ТабличныйДокумент`

The platform can read Excel directly:

ТабДок = Новый ТабличныйДокумент;
ТабДок.Прочитать("template.xlsx");
ТабДок.Записать("result.mxl");

Treat this route as evidence of behavior narrower than “full Excel transfer”:

In practice, this import often requires the thick client. If the method or route is unavailable in the thin client, document this limitation explicitly in the proof and account for it when choosing the runtime route.

Ready-made generalized procedures for this route:

restore column widths, row heights, and numeric formats in code;

coordinates, platform recalculation of totals, print form mode;

with actual run numbers.

3. Generating `Template.xml` with the `1c-form-viewer` MCP tool

If the 1c-form-viewer (BslEdit) MCP server is connected in the environment, the print form layout

is built from .xlsx without launching the platform:

convert_xlsx_to_template(xlsx_path, output_path, sheet?, overwrite?) — writes

<Объект>/Templates/<Макет>/Ext/Template.xml and opens a preview immediately.

number formats, headers and footers, page settings, print area, images.

text with [Имя] inside becomes a template. Prepare the workbook for this convention in advance.

print rows — the response summary lists losses, which are included in the proof.

This is a generation tool (like xml-gen for a single operation), not manual XML editing: the ban

on manual editing does not apply to it. Procedure:

  1. The Template metadata object itself (the layout description in the owner object's XML) is created normally

through xml-gen; convert_xlsx_to_template writes only the Ext/Template.xml body.

  1. Check the result: capture_preview and list_markup from the same server — areas and parameters.
  2. The strongest check is loading the configuration/extension into the infobase (Designer build), not just

the preview.

  1. A generation defect is recorded in the project's tools defect registry, as with xml-gen.

What Is Usually Preserved by Platform Import

Check with an actual file, but as a baseline expectation, an imported document usually preserves:

This makes imported MXL a good candidate for use as a visual framework.

What Cannot Be Assumed to Be Preserved

Do not promise an Excel round-trip without checking. Losses and conversions are typical for the platform route:

Therefore, interpret imported MXL as a visual-structural framework, not as an exact copy of

all Excel features.

How to Use Imported MXL Honestly

If an imported document became the basis for a report or print form, distinguish two layers:

  1. What the import itself transferred:
  1. What had to be built on top of it with application code:

Imported MXL can be used:

But imported MXL does not by itself become a declarative СКД layout and does not automatically create

named areas for an application print form.

Workflow

  1. Record the workbook as the structural source of truth: sheets, ranges, merged areas, important

styles, formulas, and Excel-specific functions.

  1. Decide whether you need structural analysis of the workbook, platform import, or generation of Template.xml

with the convert_xlsx_to_template tool (route 3 is preferred for a spreadsheet layout in

configuration source files).

  1. If platform import is selected, obtain the runtime ТабличныйДокумент and save it at least in

MXL and XLSX formats.

  1. Compare what was preserved and what was lost:
  1. Determine the next implementation layer:

writing by coordinates.

  1. In the proof, explicitly separate:

Reference materials

| File | What it provides | How to use it |

|---|---|---|

| references/platform-import-roundtrip.bsl | platform import, saving as MXL/XLSX, restoring geometry and formats | move the procedures to the processing module, pass paths as parameters |

| references/imported-scaffold-fill.bsl | writing data/totals to the scaffold by coordinates, print mode | call after Прочитать(), when the scaffold becomes a report or printed form |

| references/platform-import-fidelity.md | measured matrix of property preservation | read before promising “what will survive the import” |

| references/compare_xlsx_fidelity.py | structural comparison of two .xlsx files by fidelity categories | python3 compare_xlsx_fidelity.py source.xlsx result.xlsx [--json out.json]; openpyxl dependency; exit code 1 if there are losses |

What Not to Do

groupTemplate, and parameters.

Related Skills


depends_on: []


Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.