Tablora

Tablora · Library

Keep angle brackets and ampersands inside a cell

Cell text such as A&B <sample> contains characters that XML reserves. The text-safe XLSX escapes them in the file and shows the original text.

Characters the workbook format reserves

An XLSX file is a ZIP package of XML documents, and XML gives special meaning to the ampersand, the angle brackets and quotation marks. A product note like A&B <sample> cannot be written into the sheet as it stands, or the file would be damaged and the spreadsheet would refuse to open it or offer to repair it.

The text-safe converter escapes those characters inside the package. When the spreadsheet opens the file, the cell shows the same characters you entered. Nothing in the cell becomes an HTML element, an XML tag or a link.

A&B <sample> from paste to cell

The page example has one column named note and the value A&B <sample>. The expected cell text in the workbook is A&B <sample>, stored as an explicit text cell rather than a formula or a number. In the preview on this page the value is also shown as plain text, so the angle brackets appear as characters, not as markup.

Quotation marks and apostrophes in a note are escaped the same way inside the file and also arrive unchanged.

Steps for text that contains markup

When the converter refuses the text

Some characters cannot be stored in XML at all, such as most ASCII control characters left behind by old exports or copy and paste from terminals. The converter rejects text that contains them and shows Check the entered values and try again, rather than dropping characters silently. Find the invisible character in your source, remove or replace it in a copy, and calculate again.

This is different from what the Tablora app does when it writes an XLSX from a photo or PDF: it escapes ampersands and brackets the same way, but it removes characters that XML cannot hold, so the file always opens. If a cell's text matters character by character, compare it with the source before export.

Related escape case

Ampersands and brackets are only one kind of escaping. Text that looks like a SpreadsheetML character code, such as _x0041_, needs its own protection, which the text-safe converter also applies.

Original synthetic example

Input
note A&B <sample>
Expected cell text
A&B <sample>
Cell storage
Explicit text, not a formula or numeric cell

Tools

Sources