STC to Markdown

Your spreadsheet never leaves your browser, and nothing is downloaded to make this work. An STC is a ZIP of XML and your browser can already unzip; the rest is reading.

Set from what the sheet looks like.

…or drop one anywhere on this page.

A Markdown table, for a README or a wiki.

Numeric columns get the alignment marker, pipes inside cells are escaped so the table keeps its shape, and a cell containing a line break is joined with a space and counted — a Markdown table row is one line and the format has no escape for a break inside a cell.

The one thing OpenDocument does that nothing else does

An STC does not store a thousand empty cells. It stores one cell and a count: table:number-columns-repeated. That is a sensible way to keep a file small, and it means a row that looks like three cells may be three hundred columns wide.

It gives two opposite ways to get a spreadsheet wrong. A cell repeated five times in the middle of a row means everything after it sits five columns further along — so a converter that ignores the attribute puts every later column in the wrong place. Silently. In a file that opens perfectly in LibreOffice. A column of numbers ends up against the wrong names and nothing looks amiss.

And LibreOffice pads every row out to the full width of the sheet, so a three-column table ends with a repeat in the thousands. Expand that literally and four values become a sixteen-thousand-column table. Both are handled here, and both are tested against odfpy — with the naive answer worked out alongside and checked to be different, because a test that would also pass with the broken version is not a test.

A formatted number is not its own text

Every cell carries two things: what it is and what it shows. A cell holding 1200 formatted as currency stores office:value="1200" alongside a display string of “1,200.00” or “£1,200”. Read the display and every formatted number in your file becomes a string with a comma in it, which sorts wrongly and adds up to nothing. The value is what is read; for dates, where the displayed form is usually the one you typed, that is kept instead.

What does not come across

Formulas. A spreadsheet stores the last answer beside each formula, and the answer is what is read — which is what you were looking at, and all a table can hold. Colours, column widths, merged cells, conditional formatting, charts and pivot tables do not come across either. A table is the values and their shape.

What an OpenOffice.org 1.x file is

StarOffice 6, StarOffice 7 and OpenOffice.org 1.x wrote these between 2000 and 2005. OpenOffice 2.0 replaced them with OpenDocument — the .odt, .ods and .odp everything uses now — and LibreOffice has been able to read them but not write them since version 4.3. Nothing current produces one, which is exactly why people still have them and nothing will open them.

It is almost OpenDocument, and the gap is small and specific. The namespaces are the old http://openoffice.org/2000/… ones, there is no mimetype entry in the package — the type lives in META-INF/manifest.xml, and in an office:class attribute the specification put there for the purpose — and, the one that matters, the content sits directly inside <office:body> with no wrapper round it. OpenDocument added <office:text>, <office:spreadsheet>, <office:presentation> and <office:drawing>.

That last one is why a converter written by resemblance can hand back an empty file rather than an error: it looks for an element that was never there and finds nothing. What this page does is put the missing element back and then read the file as the OpenDocument it almost is. Everything inside — the paragraphs, the tables, the draw pages — is named identically.

All of that is read from the OpenOffice.org XML File Format technical reference, version 2, December 2002, and not from the file looking similar. What has not been done is said plainly: no file written by a real OpenOffice.org 1.x has been read here. There is none to test against on the machine this was built on, so it is built to the published specification. If yours does not open, that is worth knowing about.

It does not open .sxc, the OpenOffice 1.x format from before OpenDocument, and it says so rather than failing quietly. If you hand it an .odt or an .odp it will tell you which it is and point at the right page.

Where to go next