Abstract
This demo focuses on spreadsheet import and styled data extraction.
For comparison, see how the same table is rendered using standard import (without the types attribute). The spreadsheet is ingested with its inconsistencies, potentially passing semantically incorrect data (like "10 units" instead of number 10) silently into your final document:
| ID | Produto | Receita (Esperado Moeda) | Qtd (Esperado Num) |
|---|---|---|---|
| 1 | Cadeira Gamer | 1500.5 | 10 un |
| 2 | Mouse | R$ 120.00 | 50 |
| 3 | R$ 300.00 | 5 |
The LibreOffice (.ods) version:
| ID | Produto | Receita (Esperado Moeda) | Qtd (Esperado Num) |
|---|---|---|---|
| 1 | Cadeira Gamer | 1500,5 | 10 un |
| 2 | Mouse | R$120,00 | 50 |
| 3 | R$300,00 | 5 |
In this complex example, we import the Formulas sheet containing dynamic columns like Total (using SUM), Average (using AVERAGE), and Performance (using IF). MarkCharm and its internal spreadsheet engine (formulas) calculate equations in real time during import.
Cells respect both currency formatting and correct type extraction (including conditional logic returning string).
| Vendedor | Vendas Q1 | Vendas Q2 | Total | Média | Desempenho (IF) |
|---|---|---|---|---|---|
| Ana | R$ 5,000.00 | R$ 6,000.00 | R$ 11,000.00 | R$ 5,500.00 | Excelente |
| Bruno | R$ 2,000.00 | R$ 3,000.00 | R$ 5,000.00 | R$ 2,500.00 | Bom |
| Carlos | R$ 8,000.00 | R$ 9,000.00 | R$ 17,000.00 | R$ 8,500.00 | Excelente |
And the same dynamic test evaluating functions inside a native .ods file:
| Vendedor | Vendas Q1 | Vendas Q2 | Total | Média | Desempenho (IF) |
|---|---|---|---|---|---|
| Ana | R$5.000,00 | R$6.000,00 | R$11.000,00 | R$5.500,00 | Excelente |
| Bruno | R$2.000,00 | R$3.000,00 | R$5.000,00 | R$2.500,00 | Bom |
| Carlos | R$8.000,00 | R$9.000,00 | R$17.000,00 | R$8.500,00 | Excelente |
MarkCharm's xlsx_loader (and its counterpart ods_loader) is not a simple plain text extractor — it maps the visual architecture and styling of spreadsheets directly to inline HTML.
Our engine processes the following source spreadsheet layout metadata:
pt), bold, italic, text colors (RGB to HEX), and underlines.rowspan) and horizontally (colspan) merged cells.background-color).1px solid #000).Below, we import a heavily styled spreadsheet. Note how individual alignment options (right-aligned text), colors, and borders are captured. By default, the table fluently adapts to page layout (ignoring fixed Excel heights and widths for responsive presentation):
| Tabela de Estilos Avançados (Bordas e Cores) | |||||
| ID | Produto | Categoria | Preço | Estoque | Status |
| 1 | Notebook | Eletrônicos | 3500 | 15 | Ativo |
| 2 | Mouse Gamer RGB | 150 | 50 | Ativo | |
| 3 | Cadeira Ergonomica | Móveis | 800 | 0 | Esgotado |
| 4 | Mesa de Escritório | 1200 | 5 | Ativo | |
| 5 | Teclado Mecânico (Red) | Acessórios | 300 | 10 | Promoção |
| 6 | Monitor Ultrawide (Blue) | 2100 | 2 | Limitado | |
| 7 | Headset Pro (Green) | 450 | 30 | Lançamento | |
| Total Geral | 8500 | ||||
Faithfully extracted version from LibreOffice (.ods):
| Tabela de Estilos Avançados (Bordas e Cores) | |||||
| ID | Produto | Categoria | Preço | Estoque | Status |
| 1 | Notebook | Eletrônicos | 3500 | 15 | Ativo |
| 2 | Mouse Gamer RGB | 150 | 50 | Ativo | |
| 3 | Cadeira Ergonomica | Móveis | 800 | 0 | Esgotado |
| 4 | Mesa de Escritório | 1200 | 5 | Ativo | |
| 5 | Teclado Mecânico (Red) | Acessórios | 300 | 10 | Promoção |
| 6 | Monitor Ultrawide (Blue) | 2100 | 2 | Limitado | |
| 7 | Headset Pro (Green) | 450 | 30 | Lançamento | |
| Total Geral | 8500 | ||||
To stress-test the RGB -> HEX color extraction engine, we generated a classic 5x5 Magic Square (where the sum of all rows, columns, and diagonals equals 65).
Each cell has a distinct rainbow color filled dynamically based on its numerical value. Font color automatically adapts between black and white depending on background luminosity:
| 17 | 24 | 1 | 8 | 15 |
| 23 | 5 | 7 | 14 | 16 |
| 4 | 6 | 13 | 20 | 22 |
| 10 | 12 | 19 | 21 | 3 |
| 11 | 18 | 25 | 2 | 9 |
The ODS version:
| 17 | 24 | 1 | 8 | 15 |
| 23 | 5 | 7 | 14 | 16 |
| 4 | 6 | 13 | 20 | 22 |
| 10 | 12 | 19 | 21 | 3 |
| 11 | 18 | 25 | 2 | 9 |
Often you want to import data without bringing along heavy formatting embedded by spreadsheet users. For these scenarios, the flag styled="false" is supported in MarkCharm.
Below is the same table and region A1:F10 imported without styles (notice how colors, fixed dimensions, borders, and typography were suppressed to inherit native document styles):
| Tabela de Estilos Avançados (Bordas e Cores) | |||||
| ID | Produto | Categoria | Preço | Estoque | Status |
| 1 | Notebook | Eletrônicos | 3500 | 15 | Ativo |
| 2 | Mouse Gamer RGB | 150 | 50 | Ativo | |
| 3 | Cadeira Ergonomica | Móveis | 800 | 0 | Esgotado |
| 4 | Mesa de Escritório | 1200 | 5 | Ativo | |
| 5 | Teclado Mecânico (Red) | Acessórios | 300 | 10 | Promoção |
| 6 | Monitor Ultrawide (Blue) | 2100 | 2 | Limitado | |
| 7 | Headset Pro (Green) | 450 | 30 | Lançamento | |
| Total Geral | 8500 | ||||
Raw extraction via LibreOffice (.ods):
| Tabela de Estilos Avançados (Bordas e Cores) | |||||
| ID | Produto | Categoria | Preço | Estoque | Status |
| 1 | Notebook | Eletrônicos | 3500 | 15 | Ativo |
| 2 | Mouse Gamer RGB | 150 | 50 | Ativo | |
| 3 | Cadeira Ergonomica | Móveis | 800 | 0 | Esgotado |
| 4 | Mesa de Escritório | 1200 | 5 | Ativo | |
| 5 | Teclado Mecânico (Red) | Acessórios | 300 | 10 | Promoção |
| 6 | Monitor Ultrawide (Blue) | 2100 | 2 | Limitado | |
| 7 | Headset Pro (Green) | 450 | 30 | Lançamento | |
| Total Geral | 8500 | ||||
Below, we import a "Scorecard" testing spreadsheet extractor boundaries. It showcases extreme vertical alignments (Top, Middle, Bottom), combined horizontal alignments, and varied border thicknesses.
To prove geometry was extracted (40px and 60px row heights, asymmetric column widths), we pass the flag geometry="true".
Additionally, we intentionally pass title_cell="A1" and title="My Flawed Title" simultaneously. You can see warning [WARNING] MCW-SPR-001 in the compiler log complaining about this collision (where title_cell takes precedence):
| Top Left | Center Middle | Bottom Right |
| Rotated? | Merged B3:C3 | |
LibreOffice (.ods) version:
| Top Left | Center Middle | Bottom Right |
| Rotated? | Merged B3:C3 | |
For technical reports requiring printing or subdued palettes, MarkCharm allows neutralizing spreadsheet colors while keeping original structure.
Below, we extract styled_table and the Magic Square in grayscale (grayscale="true"). The engine dynamically calculates YIQ luminosity to convert all RGB colors into shades of gray:
| Tabela de Estilos Avançados (Bordas e Cores) | |||||
| ID | Produto | Categoria | Preço | Estoque | Status |
| 1 | Notebook | Eletrônicos | 3500 | 15 | Ativo |
| 2 | Mouse Gamer RGB | 150 | 50 | Ativo | |
| 3 | Cadeira Ergonomica | Móveis | 800 | 0 | Esgotado |
| 4 | Mesa de Escritório | 1200 | 5 | Ativo | |
| 5 | Teclado Mecânico (Red) | Acessórios | 300 | 10 | Promoção |
| 6 | Monitor Ultrawide (Blue) | 2100 | 2 | Limitado | |
| 7 | Headset Pro (Green) | 450 | 30 | Lançamento | |
| Total Geral | 8500 | ||||
| Tabela de Estilos Avançados (Bordas e Cores) | |||||
| ID | Produto | Categoria | Preço | Estoque | Status |
| 1 | Notebook | Eletrônicos | 3500 | 15 | Ativo |
| 2 | Mouse Gamer RGB | 150 | 50 | Ativo | |
| 3 | Cadeira Ergonomica | Móveis | 800 | 0 | Esgotado |
| 4 | Mesa de Escritório | 1200 | 5 | Ativo | |
| 5 | Teclado Mecânico (Red) | Acessórios | 300 | 10 | Promoção |
| 6 | Monitor Ultrawide (Blue) | 2100 | 2 | Limitado | |
| 7 | Headset Pro (Green) | 450 | 30 | Lançamento | |
| Total Geral | 8500 | ||||
| 17 | 24 | 1 | 8 | 15 |
| 23 | 5 | 7 | 14 | 16 |
| 4 | 6 | 13 | 20 | 22 |
| 10 | 12 | 19 | 21 | 3 |
| 11 | 18 | 25 | 2 | 9 |
| 17 | 24 | 1 | 8 | 15 |
| 23 | 5 | 7 | 14 | 16 |
| 4 | 6 | 13 | 20 | 22 |
| 10 | 12 | 19 | 21 | 3 |
| 11 | 18 | 25 | 2 | 9 |
When currency is expected, a cell with a pure number that lacks active currency formatting in Excel will be considered invalid. This reinforces visual semantics for the spreadsheet operator.
MarkCharm supports extracting Title, Source, Notes, and Observations (Misc) directly from your spreadsheet (.xlsx and .ods).
In the table below, we extract metadata dynamically pointing to arbitrary cells as proof of concept (e.g. A1 as source). We also force an intentional error declaring title_cell="A1" twice. The compiler will emit [WARNING] MCW-SPR-004: Multiple assignments for attribute 'title_cell'. Additionally, static text Source: My Static Source is included after the table. The compiler will emit MCW-SPR-002 warning that the spreadsheet dynamic version (source_cell) won the collision and overwrote the static text!
Excel Version (.xlsx):
| ID | Produto | Receita (Esperado Moeda) | Qtd (Esperado Num) |
| 1 | Cadeira Gamer | 1500.5 | 10 un |
| 2 | Mouse | R$ 120.00 | 50 |
| 3 | R$ 300.00 | 5 |
LibreOffice Version (.ods):
| ID | Produto | Receita (Esperado Moeda) | Qtd (Esperado Num) |
| 1 | Cadeira Gamer | 1500,5 | 10 un |
| 2 | Mouse | R$120,00 | 50 |
| 3 | R$300,00 | 5 |
Below, we demonstrate the {$DATA} directive connecting this document to an external JSON (data.json). MarkCharm extracts keys from JSON and automatically converts them into ready-to-use macros!
Dynamic Project Report