Table of Contents

Method FromMarkdownTable

Namespace
DocWright.Spreadsheet
Assembly
DocWright.Spreadsheet.dll

FromMarkdownTable(TextReader)

Makes a workbook of one sheet from the first Markdown table in a text.

public static XlsxDocument FromMarkdownTable(TextReader reader)

Parameters

reader TextReader

The text. It is read to the end of the table and not closed.

Returns

XlsxDocument

A workbook as Create(XlsxCreateSettings?) starts one, its sheet holding the table from A1, the heading in row 1.

Remarks

The table is a pipe table of GitHub Flavored Markdown: a row of cells, a row of dashes (with or without the colons that align a column) of as many cells, then the rows until a blank line, a line with no vertical bar, or the end. What comes before the table is passed over. A row with fewer cells than the heading leaves the rest empty; one with more loses the excess, as the table itself does when it is rendered.

Every cell becomes text, trimmed. \| is a vertical bar, \\ a backslash and <br> a line break: what ToMarkdown(TextWriter, XlsxMarkdownOptions?) writes. Other Markdown in a cell is kept as the characters it is.

Exceptions

ArgumentNullException

reader is null.

InvalidDocumentException

The text holds no table, or the table cannot be put on a worksheet: a cell of more than 32,767 characters, more columns or rows than a worksheet has.

ResourceLimitExceededException

The table has more than two million cells that hold something.