gofastooxml

package module
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 28 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-fast-ooxml

Extracts Word, Excel and PowerPoint files (.docx, .xlsx, .pptx, their macro and template variants, Excel's binary workbooks, .xlsb, any of these saved as one XML file, Flat OPC, and Office 2003's XML formats, WordprocessingML 2003 and SpreadsheetML 2003) into the shared go-fast document model, gofastcore.Document. Standard library and go-fast modules only.

Status: released as v0.5.2. What changed in each release is in CHANGELOG.md. What it promises about files from strangers is in SECURITY.md.

Format State
Word Text and structure are extracted: headings, list items with their computed labels, tables with merged cells, footnotes and endnotes with the numbers the document's settings and sections give them, comments, tracked changes, headers and footers, text boxes, pictures, embedded files, the data of charts and the text of SmartArt diagrams. Word's Horizontal Line, a shape the file marks as one, is a thematic_break in the body (not in a table, text box, header or note); a paragraph that only has a border is not one, and section, page and column breaks are layout and give no block. What the file declares about the display of text is kept (see below). With Options.Spans, bold, italic, underline, strike-through, superscript, subscript and links are reported as spans
Excel Every sheet is a part; its cells are tables, with what each cell displays: numbers through their number formats, dates in ISO 8601, formulas as their stored results. Declared tables, pivot tables, merged cells, comments, drop-down lists, text in shapes, pictures, charts, chart sheets, SmartArt and embedded files are read. What the file declares about the display of text is kept (see below). Sheets are read in parallel. A binary workbook (.xlsb) gives what the same workbook as .xlsx gives, its formulas read back from their compiled form
PowerPoint Every slide is a part, with the size of the slide. Its title is a heading and the slide's name; body text is list items with their bullets or numbers, or paragraphs; tables keep their merged cells; pictures, charts, SmartArt, speaker's notes and comments are read, and so is the text the layout and master put on every slide. Every block has its place on the slide. What the file declares about the display of text is kept (see below). Slides are read in parallel

How fast

Against the Python tools in use for these formats, each reading the same file once in a process of its own, on one machine (a 12-core Ryzen 9 9900X). The table is generated by bench/compare.py; the corpus results, the method and the versions are in bench/comparison.md.

File Tool Time Peak memory Time against this library
large.docx: 1.5 million words this library, all workers 0.076 s 39 MB
this library, one worker 0.104 s 43 MB 1.4 times
docx2txt 0.158 s 152 MB 2.1 times
markitdown 3.75 s 325 MB 49 times
python-docx 4.12 s 199 MB 54 times
large.xlsx: 2 million cells this library, all workers 0.249 s 194 MB
this library, one worker 0.710 s 140 MB 2.9 times
openpyxl-readonly 9.44 s 307 MB 38 times
openpyxl 12.31 s 1,136 MB 49 times
markitdown 63.33 s 1,392 MB 254 times
large.pptx: 1,500 slides this library, all workers 0.020 s 43 MB
this library, one worker 0.056 s 33 MB 2.8 times
python-pptx 0.366 s 114 MB 18 times
markitdown 1.78 s 214 MB 89 times

The time for this library is the whole run of its command, writing text; for the others it leaves out importing the library. docx2txt gives the text of a Word file and none of its structure. In the library itself, without starting a process, the three files take 0.03, 0.13 and 0.01 seconds with all workers, and 0.06, 0.58 and 0.05 with one.

With more than one worker (Options.Workers, all the CPUs by default), a Word body or a sheet of 1 MiB or more is decompressed on a goroutine of its own, ahead of its reading. Since parts are inflated by go-fast-core's decompressor, about twice as fast as compress/flate, this gains less than it did: on 162 Word and Excel files whose largest body or sheet is 1 MiB or more, a Word file is read 1.04 to 1.18 times as fast, the larger the more, and a workbook 1.06 to 1.11 times (it was 1.16 to 1.26); a sheet read through File.Rows 1.36 times (it was 1.66). Under 1 MiB a part is read as before. The document is the same with any number of workers (bench/README.md).

On the 788 real files of the corpus, which include damaged, encrypted and hostile ones, this library reads 773 and refuses 15 with a reason: seven need a password, four are archives too damaged to read, and the rest are other formats, a legacy .xls, a document type declaration and a cipher other than AES. None makes it crash or hang. The same holds for 5,852 more from other projects' test suites (bench/README.md).

A batch of files in one process

On 1,980 Word, Excel and PowerPoint files from Common Crawl, read in one process against the Rust and Python libraries for these formats (bench/batch):

Batch Workers This library Fastest other
All 1,980 files 1 4.31 s, 111 MB kreuzberg: 11.3 s, 2.9 GB
24 0.58 s, 275 MB kreuzberg: 3.81 s, 11.7 GB
1,411 Word files 1 1.69 s, 35 MB kreuzberg: 1.75 s, 116 MB
499 Excel files 1 2.44 s, 105 MB calamine: 4.30 s, 1.6 GB
70 PowerPoint files 1 0.12 s, 52 MB kreuzberg: 0.10 s, 27 MB
Memory against speed: GOGC

The library leaves Go's garbage collector as it is set. A program that has memory to spare can make the collector run less often, with the GOGC environment variable or debug.SetGCPercent, and bound the heap with debug.SetMemoryLimit. On the batch of all 1,980 files:

GOGC One worker 24 workers
100 (Go's default) 4.31 s, 111 MB 0.58 s, 275 MB
200 4.06 s, 112 MB 0.50 s, 466 MB
400 3.94 s, 141 MB 0.47 s, 790 MB

The more workers, the more a larger setting saves, and the more memory it costs. On one of the large generated files, GOGC=400 saves 6 to 8%.

Using it

import (
    "github.com/AOShei/go-fast-core"
    "github.com/AOShei/go-fast-ooxml"
)

// The whole file as one document, in the model every go-fast library shares.
doc, err := gofastooxml.ExtractFile(ctx, "report.docx", nil)
doc, err := gofastooxml.Extract(ctx, readerAt, size, &gofastcore.Options{Spans: true})
fmt.Println(doc.Markdown())

Extract reads from anything that can be read at an offset (a file, bytes in memory); the format is decided from the file itself, never from its name. Options are gofastcore.Options; the settings only this library has are fields of Extractor (MaxCells, MaxArchiveMembers, MaxSpinCount), which implements gofastcore.Extractor. Errors wrap the shared ones (ErrMalformed, ErrUnsupported, ErrLimitExceeded, ErrNoPartsSelected, ErrPasswordRequired, ErrWrongPassword, ErrKeyRequired). A file that is damaged in part is not an error: what could be read is returned, with warnings that say what could not.

  • Pictures are blocks. Every picture is an image block with its place, its size and its alternative text, unless Options.Images is ImagesNone; ImagesData adds the bytes.
  • Symbol fonts are translated. Text in Symbol, Wingdings, Wingdings 2, Wingdings 3 or Webdings is codes of the font, not letters: "ü" in Wingdings is a check mark. It is written as the characters Unicode gives those symbols, in all three formats, whether the font is set on the run, its style or the cell, and for bullets. A code Unicode has no character for (the Windows logo) is U+FFFD, and the part says how many with text.unmapped_glyphs.
  • A file cut short has lost the directory at the end of its archive. Its members are then found by their own headers, as far as they go: a file that lost only its directory gives the whole document, one cut inside its body gives the body up to there. The document carries input.repaired, which says how many members were found and which one breaks off. Where too little is left to tell what the file is, the error is ErrMalformed. The recovery is go-fast-core's ziprecover, shared by every go-fast library that reads zip archives, so a cut file is read the same way and reported in the same words in each.
  • A document holds at most Limits.MaxTextBytes of text, 256 MiB by default, counted as often as it occurs and together with the files embedded in it. A small file can say a long text many times (one string that every cell refers to); the part that reaches the limit is cut off there with limit.exceeded. Every block counts 128 bytes besides its text, and every cell of a table 16, empty or not (core's BlockCost and CellCost): a file decides how many there are as freely as how long a string is. A table with no room for all its rows keeps those that fit. The targets of links count as text does, each time a link is written: one address may be linked to any number of times. An address is kept whole up to 8 KiB. The other limits are in SECURITY.md.
  • What a fixed bound leaves out is said. Besides the limits a caller sets, the reader keeps to fixed bounds, far beyond what Office writes: 16,384 columns of a slide's table, 64 KiB of a field code, 16,384 defined names, 1,024 series of a chart (the list is in SECURITY.md). A file that goes past one keeps what fits, and the part says what was left out with limit.exceeded, severity error, once for each bound, with how many: "table cells past column 16384 were not read (3 cells)", and for text cut short, how many bytes: "(2 names, 90 bytes left out)". Names and labels that reach the output (authors, names of sheets and shapes, a cell's stored value) are kept to 1,024 bytes and said the same way. What belongs to no part (sheets past the 65,536th, links to other workbooks, document properties) is said on the document. limit.exceeded is the only code for a cut, so its absence means nothing was cut.
  • An event every go-fast library can meet has the shared code. Control characters removed, content of a kind not read, a supporting part or the document properties damaged, a formula with no stored result, a sparse area of a sheet written a row at a time, a file decrypted: text.control_characters_removed, input.unread_content, input.stream_damaged, table.formula_no_value, table.region_split, input.decrypted (go-fast-core v0.1.2). Only ooxml.table_flattened and ooxml.integrity_mismatch are this library's own.
  • A warning that could repeat is said once. Parts that could not be read to their end, and drawings that name a chart or diagram the file does not have, are one input.stream_damaged warning each, with how many and the first eight: "12 parts could not be read to their end (a, b, …, and 4 more)". Core keeps at most 1,000 warnings on a part or a document and counts the rest in warnings.omitted.

A part at a time. Open gives a File, which reads a part when it is asked for: the body of a Word document, a sheet, a slide.

f, err := gofastooxml.Open("deck.pptx", nil)   // also OpenBytes, OpenReaderAt
defer f.Close()
f.Format(); f.NumParts(); f.Metadata(); f.Sheets()

for part, err := range f.Parts(ctx) {          // gofastcore.Part, in order
    ...                                        // nothing holds on to it afterwards
}
part, err := f.Part(ctx, 12)                   // one part, by number
doc, err := f.Document(ctx)                    // everything: what Extract returns
f.Warnings(); f.Children(ctx)

The parts are the ones Extract returns, each complete, with its warnings and what the file declares about the display of its text. With more than one worker, up to four parts a worker are read ahead, and each is handed on as soon as it and those before it are read; what is held does not grow with the number of parts. A File is safe for concurrent use, and each pass over it counts the limits afresh.

A sheet too long to hold is read a band of rows at a time:

for band, err := range f.Rows(ctx, sheetNumber, 1000) {
    for _, b := range band.Blocks { ... }      // the tables of these 1,000 rows
}

Each band is a part like any other, with the sheet's number and name and what the file declares about the display of its cells. Two million cells are read in 20 to 25 MB, where the sheet read whole takes over 100 (bench/README.md). The price: the sheet's part is read twice, a table that runs past the end of a band is cut there and goes on in the next as a table marked Continued, declared tables are not looked up, and comments, drop-down lists, shapes and pictures are left to Part. Bands follow the order of the rows in the file; a damaged file that gives its rows out of order has them sorted within a band, not across bands. With more than one worker (Options.Workers, all the CPUs by default) the sheet is decompressed on a goroutine of its own, ahead of the reading of its rows: about 1.4 times as fast, with the same bands.

The command

go install github.com/AOShei/go-fast-ooxml/cmd/gofastooxml@latest

gofastooxml report.docx                      # the document as JSON
gofastooxml -format markdown deck.pptx       # or markdown, or text
gofastooxml -format text -exclude-display contract.docx
gofastooxml ./archive > documents.jsonl      # every Office file under a directory

A directory stands for the Office files in it and below it: those named as the formats are (.docx, .xlsx, .pptx, their variants, .xlsb), and the .xml files that are Office files saved as XML, told by their root element; other .xml files are passed over without a word. A file named on the command line is read whatever its name, and refused, with the exit status 1, if it is not an Office file.

JSON is written a part at a time, a sheet or a slide as soon as it is read, and within a part a block at a time and a table a row at a time, so the command holds about one part and not its encoding as well; the output is the same bytes as for the document read whole. A workbook of 64 MB of text (poc-shared-strings.xlsx in the corpus) peaks at 18 MB rather than 1.7 GB, large.docx at 43 MB rather than 110. Markdown and text are written once the document is read.

Flag
-format json|markdown|text What to print. JSON is the shared document; with several inputs each document is one line
-o file Write there instead of standard output
-parts 3, -parts 2-5 Only those parts: sheets or slides by number
-images meta|data|none Pictures: a block for each, with its place, size and alternative text (the default); their bytes too; or not at all
-spans Bold, italic and the like, and links, as spans
-exclude-display, -exclude-display=hidden In Markdown and text, leave out text the file declares not shown or drawn with no ink: all of it (also =true, =all), or what has the reasons named (hidden, no_ink, joined by , or +); =false or = leaves nothing out. JSON always has everything
-furniture, -part-markers In Markdown and text: include running headers and footers; put a line before each part saying which it is
-stored, -stored=field_code,macro In Markdown and text, include what the file stores and shows nowhere: all of it (also =true, =all), or only the kinds named (joined by , or +; see What a file stores); =false or = leaves it out
-children In Markdown and text, the documents a file embeds, each after a line naming it ([child 1: book.xlsx]); on by default, -children=false leaves them out
-workers n Sheets or slides read at a time
-max-cells n, -max-decoded-bytes n, -max-text-bytes n The limits; -1 for none
-password p The password of an encrypted file, and of encrypted files embedded in it
-key file A private key (RSA; PEM or DER, PKCS #1 or #8) for a file encrypted for its certificate, and for encrypted files embedded in it; may be given more than once. An encrypted key file is not read
-max-spin-count n Rounds of hashing an encrypted file may ask for when a password is tried
-quiet, -version

Only documents go to standard output. A file that cannot be read is reported on standard error and makes the exit status 1; the other inputs are still read. Unless -quiet is given, a line on standard error names the files that have a warning of severity error. Office files embedded in a document are extracted too, into its children.

Office files saved as XML

Flat OPC

Word and PowerPoint can save a document as one XML file in place of a zip archive ("Word XML Document", "PowerPoint XML Presentation"): Flat OPC, whose root is pkg:package in the namespace http://schemas.microsoft.com/office/2006/xmlPackage. Each part of the package is an element stating its name and content type, with its XML inline or its bytes in base64. Such a file is read as the package it stands for, by the same readers, and gives the same document: its format and mime are those of the package (docx, xlsx or pptx), and metadata.extra["packaging"] is flat_opc. Every file of the corpus and of the soak set written as Flat OPC gives the document the file gives (TestFlatOPCReadsAsItsPackage, 6,502 files; the others are refused, or read by a recovery path, as packages).

A part's XML is read where it is in the file, with the namespaces declared around it; a binary part is decoded as it is read, and counts against Limits.MaxDecodedBytes as a decompressed part does. One pass over the file finds the parts, reading only the package's own elements and skipping over the parts' content, so a part whose XML is malformed fails as that part, as in an archive. A file cut short is read up to the last complete part, with an input.repaired warning saying where it breaks off. A file in UTF-16 or a single-byte encoding is converted to UTF-8 in memory first (Office writes UTF-8). A document type declaration is refused, as everywhere.

SpreadsheetML 2003

Excel 2002 and 2003 saved workbooks as "XML Spreadsheet 2003": one XML file whose root is Workbook in the namespace urn:schemas-microsoft-com:office:spreadsheet. It is a schema of its own, older than .xlsx, but what it says of cells is what .xlsx says, and it is read into the same sheets by the same code: number formats, dates in ISO 8601, cell types, merged cells, hidden rows, columns and sheets, comments, links (with Options.Spans), drop-down lists, defined names (in the stored part), table splitting, limits, File.Sheets and File.Rows. Its format is spreadsheetml and its mime application/vnd.ms-spreadsheetml. Every workbook of the corpus written as SpreadsheetML 2003 by the test harness shows the cells, merged ranges and hidden rows and columns its .xlsx shows (TestSpreadsheetMLReadsAsXlsx, 1,776 workbooks; the others are refused or read past damage as .xlsx). The 37 SpreadsheetML files in LibreOffice's, PhpSpreadsheet's and Tika's test suites are read (one, malformed on purpose, up to where it breaks off).

What the format does differently, and how it is read:

  • Positions. Rows and cells follow one another; ss:Index (from 1) jumps ahead, and ss:Span repeats a row or column. A cell with no index comes after the cell before it, past the cells merged with it or with a cell above.
  • Styles are named (ss:StyleID) and inherit through ss:Parent. A cell with none has its row's, then its column's, then the style named Default. Number formats are format codes, or the names Excel gives its built-in formats there ("General Number", "General Date", "Long Date", "Medium Date", "Short Date", "Long Time", "Medium Time", "Short Time", "Currency", "Euro Currency", "Fixed", "Standard", "Percent", "Scientific", "Yes/No", "True/False", "On/Off"), which are those of Visual Basic's Format function. A date's format decides only whether a date, a time or both are shown, since dates are given in ISO 8601.
  • Dates are written as dates (ss:Type="DateTime") and read into the serial numbers .xlsx holds, in the workbook's date system (1900, with Excel's 29 February 1900, or 1904). A date whose style is General is shown as a date and time.
  • Merged cells are the extra cells a cell covers: ss:MergeAcross, ss:MergeDown.
  • Formulas are in R1C1 notation (=R[-1]C+1); with Options.Cells they are given in A1 notation (=B4+1), as are defined names and the cells a drop-down list is for.
  • Comments are inside their cells (Comment), links are a cell's ss:HRef. Rich text is HTML inside ss:Data; its text is read, and its formatting is not.
  • The format holds no pictures, charts or shapes.

The file is indexed once, as Flat OPC is (internal/xmlindex): its worksheets, styles, names and properties are elements, each read as a part, so a worksheet whose XML is malformed fails alone, and a file cut short gives the sheets complete before the cut, with an input.repaired warning. Document properties come from o:DocumentProperties and o:CustomDocumentProperties, under the keys the .xlsx properties use.

Files of this format written by programs other than Office declare many encodings: besides UTF-8, UTF-16, ISO 8859-1 and Windows-1252, the scanner reads ISO 8859-15, the other Windows code pages (1250 to 1258, 874) and the double-byte ones (Shift JIS, GBK, EUC-KR as code page 949, Big5), in every format.

WordprocessingML 2003

Word 2003 saved documents as "XML Document": one XML file whose root is w:wordDocument in the namespace http://schemas.microsoft.com/office/word/2003/wordml. It is the direct ancestor of the WordprocessingML of .docx, and is read by translating it into the parts of the .docx it corresponds to, which the Word reader then reads as any other (internal/wordml): headings from styles and their basedOn chains, lists with their computed labels, tables with merged cells, footnotes and endnotes, comments, tracked changes (text given with insertions accepted, deletions as notes), headers and footers, links, fields, hidden text, pictures. Its format is wordml and its mime application/vnd.ms-wordml.

What is translated:

  • Names 2003 hyphenates are camel-cased (sz-cs is szCs, line-rule lineRule, h-ansi hAnsi); fareast is eastAsia, vmerge vMerge.
  • Styles (w:styles), lists (w:lists) and settings (w:docPr) are in the document; they become their parts. A paragraph's w:listPr (w:ilvl, w:ilfo) is w:numPr; w:listDef and w:list are w:abstractNum and w:num; a level's number format is a number (w:nfc), translated into its name.
  • Footnotes, endnotes and comments are written where they are cited; they go into their parts, with a reference where they were. Headers and footers are written in their section's w:sectPr; they become parts the section names (odd is default).
  • Revisions, comments and bookmarks are aml:annotation elements: Word.Insertion is w:ins, Word.Deletion w:del, Word.Comment a comment with Word.Comment.Start and .End around its range, Word.Bookmark.Start and .End a bookmark. Formatting changes are left out.
  • Links are w:hlink, with the address in w:dest and a place in the document in w:bookmark.
  • Pictures are VML whose v:imagedata names a w:binData, the picture in base64, by a wordml:// name; each becomes a media part, counted against Limits.MaxDecodedBytes.
  • wx:sect and wx:sub-section, which only group, are left out around what they hold, as are smart tags and other elements of namespaces the format does not define; Word's hints (wx:) are dropped.

Word 2003 has no charts or equations of its own kind: it saves a picture of each, which is read as a picture. Tika's test suite has one document saved both ways, as Word 2003 XML and as Flat OPC from a later Word; the two give the same blocks but for those pictures, a move that 2003 records as an insertion and a deletion, and two citation fields and the bibliography's sources, which the 2003 file does not hold. LibreOffice was asked to write 200 corpus documents as Word 2003 XML and wrote 189; their words agree with their .docx documents' at 0.75 on average, and each difference looked at (the documents that differ most, and those whose headings differ) came from what LibreOffice's writing lost or changed: the text of text boxes, tables and content controls, tabs, charts and equations written as objects, and heading styles under LibreOffice's own names with no outline level.

A body whose XML is malformed, or that a cut file breaks off in, is read up to that place, with an input.repaired warning.

The root element decides: XML of any other kind is refused with ErrUnsupported, its root named in the message, so that XML sent here by mistake is seen to be. Office's <?mso-application?> instruction is not needed, and not trusted.

Encrypted files

A file encrypted with a password is opened with Options.Password:

doc, err := gofastooxml.ExtractFile(ctx, "accounts.xlsx", &gofastcore.Options{Password: "..."})

Both ways Office has of encrypting with a password are read: the one of Office 2007 ("standard": AES, SHA-1), which LibreOffice still writes, and the one of Office 2010 and later ("agile": AES-128, 192 or 256 with SHA-1, SHA-256, SHA-384, SHA-512 or MD5). The document is the one the file would give unencrypted, with Metadata.Encrypted set and an input.decrypted warning that names the scheme and what opened it.

  • The password is verified before anything is decrypted. Without one the error is ErrPasswordRequired; with one that does not open the file, ErrWrongPassword.
  • Excel's own password is tried without being asked for. A workbook that is protected, but has no password to open it, is encrypted by Excel with a fixed password that Excel itself tries silently. Such a file opens with no password given, and the warning says that is how. Metadata.Encrypted is set all the same: it says what the file was, not who supplied the password.
  • Nothing is held decrypted. The package is decrypted piece by piece as the parts are read, also from several workers at once.
  • A file that was changed after it was encrypted says so. The agile scheme stores a keyed hash of the encrypted file; where it does not match, the document carries ooxml.integrity_mismatch, and is extracted all the same.
  • What a wrong guess costs is the file's to say, as rounds of hashing: Office writes 100,000, about a hundredth of a second. Extractor.MaxSpinCount bounds it (a million by default); a file that asks for more is refused with ErrLimitExceeded. The check stops when the context is cancelled.
  • An encrypted file embedded in a document is opened with the same password; if that does not open it, it is listed with child.encrypted. A document and everything embedded in it share one allowance for password checks, ten times MaxSpinCount, so that a document with thousands of encrypted attachments cannot cost thousands of checks; past it, further encrypted files are listed with child.failed and the reason.

Encrypted for a certificate. The agile scheme can encrypt the file's key for certificates as well as for the password: whoever has the private key of one opens the file without the password. Such a file is opened with the key in Options.Keys, a crypto.Decrypter, so the key may be kept in hardware or in another process:

doc, err := gofastooxml.ExtractFile(ctx, "board.docx", &gofastcore.Options{Keys: []crypto.Decrypter{rsaKey}})
  • A key is tried on the certificates whose public key is its own, and the file's verifier for the certificate is checked before anything is decrypted. The keys are RSA, the only kind the scheme uses. A key costs no rounds of hashing, and is tried before any password.
  • The input.decrypted warning names the certificate that opened the file. Opened with the password, it says what certificates the key is also encrypted for.
  • Opened with neither, the error wraps ErrKeyRequired, beside ErrPasswordRequired or ErrWrongPassword when the file can also be opened with a password, as the specification requires of every file. The message names the certificates (at most three).
  • No file encrypted for a certificate by Office was at hand. The reader follows the published specification ([MS-OFFCRYPTO] 2.3.4.10), and is tested against an encryptor written for the tests from the same text. The specification does not say how the key is padded for RSA: PKCS #1 v1.5, which Office's cryptographic interface gives by default, is tried first, then OAEP; the verifier decides. A mistake in this reading shows as a refusal, never as wrong text, because the verifier and the integrity check both fail on a wrong key.

Not read: files protected by rights management, ciphers other than AES, and the legacy binary formats (.doc, .xls, .ppt), which share the container of encrypted files: each is refused with ErrUnsupported and a message that says which it is. A file protected by rights management cannot be read here at all: its key is in a licence that a rights-management server issues to the people the document names, and this library contacts no server. The message says so, and an embedded one is listed with child.unsupported and the same message.

Excel workbooks

Cells are given as displayed. A cell holding 1234.5 with the format #,##0.00 is 1,234.50; 0.125 as 0.0% is 12.5%. The number-format engine (go-fast-core's numfmt) handles sections for negative numbers, zero and text, conditions, thousands and scaling, percent, scientific and engineering notation, fractions, durations, currency and literal text. It agrees with LibreOffice on a table of 7,392 pairs of a format and a value, and on the cells of 446 real workbooks, apart from the differences bench/README.md lists.

Four things are not as displayed, on purpose:

  • Dates and times are in ISO 8601 whatever the format: 2026-03-04, 2026-03-04T14:30:00, 14:30:00. 03/04/2026 is two different days depending on where the file was made. What is written follows the value, so nothing it holds is lost: a cell formatted to show only the date still gives its time of day if it has one. Durations ([h]:mm) are not dates and are given as displayed.
  • General numbers keep all fifteen digits a spreadsheet stores. Excel shows a number of twelve digits or more in scientific notation; an account number should not become 1.23457E+11.
  • Padding is one space. Formats can ask for blank space as wide as some character, or for a character repeated to fill the cell. Neither is reproduced.
  • A value its format displays as nothing is written out, with the reason hidden, except zero: formats blank zeros as a matter of course.

A formula gives its stored result. Formulas are not evaluated, and one stored without a result is an empty cell, reported as table.formula_no_value.

What a cell holds besides its text is in Table.Cells, an entry for each cell that has something:

  • with Options.Spans, where the cell links to: an address, or # and a place in the workbook;
  • with Options.Cells, its formula as Excel shows it, without = (a formula a range of cells shares is moved to each cell, as Excel moves it), and the type of its value (number, date, bool, error, text) with the value where the text does not show it in full: 0.333 in a cell showing 33%, a date's serial number. Across the 30,144 formulas and 1,326 links of the corpus's workbooks, these agree with openpyxl's (TestExcelCellDetailsAsOpenpyxl); openpyxl leaves out spaces some shared formulas have, which are kept here. On a sheet of numbers there is an entry for every cell: large.xlsx takes about half as long again to read with Cells, and allocates three times as much.

Markdown writes the links of cells; formulas and values are only in the document, since a formula can hold text nobody sees on the sheet.

What a workbook stores and shows on no sheet is in a last part of kind stored: its defined names (Rate: 0.2; a name can stand for a text that appears nowhere else), the code of its Excel 4 macro sheets, one formula to a line, the code of its VBA project, the records of pivot caches whose source is gone and the formulas of calculated fields, and custom XML data (see What a file stores and shows nowhere). It is read as data, never evaluated, and comes with the whole document, not with a range of parts.

Drop-down lists (data validations of type list) are note blocks of type choices at the cells they are for, with those cells in loc.range: the values of a list written out in the file, one per line, or the reference a list is taken from (=$D$1:$D$3, =Lists!$A$1:$A$12), since those values are in the text of their cells. A list whose arrow the file hides, or whose cells are all in hidden rows or columns, has the reason hidden. Both the older kind and the newer kind kept in the sheet's extension list are read. The 56 lists of the corpus's workbooks agree with openpyxl's (TestExcelDropDownListsAsOpenpyxl); openpyxl does not read the newer kind. Other kinds of validation offer nothing to choose from and are not read.

Tables. A table the workbook declares is one table block, with its header row. The other cells are grouped into blocks separated by empty rows and columns; those boundaries are a reading of the layout, so such tables have origin: inferred. Every block has its place on the sheet in loc.range. An area whose cells are so scattered that the rectangle around them is nearly all empty is written as one table per run of adjacent cells, with table.region_split. A table of more than about a million cells is written as several, each a run of its rows.

Limits. Besides the limits of gofastcore.Options, Extractor.MaxCells bounds the cells kept from a workbook (20 million by default), and the text of the cells is bounded by Limits.MaxTextBytes, counted each time it is used: a long string that a million cells refer to is small in the file and large in the result. A sheet that reaches a limit is cut off there, with limit.exceeded.

A chart's table is not cells of the sheet: its loc.range is the cell the chart is anchored to, and its role is chart (see Charts and SmartArt). A chart sheet is a part with no cells; its chart's blocks have no loc.range.

Pivot tables. A pivot table is the cells it fills, written when it was last laid out: they are read as one table, like a declared table, with the pivot table's name and role pivot, its header rows those above its first row of values. A pivot table that is laid out only when the file is opened has no cells yet, and gives no table. A pivot table is drawn from a cache, the records of its source kept in the workbook. Where the source is a range or table of the workbook, the records repeat cells that are read and are not read again. Where it is another workbook, a connection to a database, scenarios, or a sheet or name the workbook no longer has, the records are data the file holds and shows nowhere: they are a table in the stored part, with stored pivot_cache, the names of the cache's fields as its header row and a row for each record (or, for a cache that keeps no records, the values each field takes, a column each). Over the corpus and the soak set, every pivot table openpyxl finds whose region has cells is such a table, and every cache whose source is gone is in the stored part with its fields and its number of records (TestPivotsAsOpenpyxl, GOFAST_PIVOTS_SOAK=1 for the soak set).

Binary workbooks (.xlsb). Excel's binary format is the package of an .xlsx file whose workbook, sheets, shared strings, styles, comments and tables are records (MS-XLSB) in place of XML; its theme, drawings and charts are XML as in .xlsx. The records are read into what the XML gives, so formats, dates, tables, display reasons, limits and reading by bands are the same code for both: the same workbook written both ways gives the same document (TestXlsbAsXlsx). The source's format is xlsx, its mime that of .xlsb.

Formulas in this format are compiled: tokens in reverse Polish order, functions by number. They are turned back into the text Excel shows: cells' formulas (with Options.Cells), defined names, drop-down lists, the code of macro sheets and the calculated fields of pivot caches. That includes references to a table's columns by name (Sales[Amount], Sales[[#This Row],[Amount]], Sales[#All]), to other workbooks by the number of their link ([1]Rates!A1, '[1]Q 2'!A1, [1]!Tax), the functions of add-ins by the name the workbook lists, and the functions and commands of Excel 4 macro sheets (GET.CELL, ALERT), whose names are those of the specification's tables. A formula that still cannot be read back is left out and counted in input.unread_content ("binary formulas not read back"): wrong text would be worse than none. That is one through a DDE or OLE link, or that names a table, column, sheet or name the workbook does not have.

How this is checked:

  • Each feature is written as a workbook in both formats, and the two documents are compared whole (TestXlsbAsXlsx, TestXlsbFormulasAsXlsx, TestXlsbPivotsAsXlsx).
  • Over the binary workbooks of the soak set, every cell pyxlsb reads holds the same here (905 cells, TestXlsbAgainstPyxlsb).
  • Every formula read back is the one LibreOffice writes when it saves the workbook as .xlsx (324 formulas, TestXlsbFormulasAgainstLibreOffice). The exception is one reference to a workbook whose path the file records as missing: [1]ab!C1 here, #REF! in LibreOffice.
  • LibreOffice reads the test workbook's references to other workbooks with the same text, and resolves each reference to a table's columns to the same table, rows and columns, though it writes them as ranges of its own (TestXlsbFormulasAgainstLibreOfficeToo).
  • LibreOffice reads neither another workbook's names nor the functions of macro sheets, so those two are checked against the specification only.

The pivot tables of the three soak-set workbooks that have them have the same names and places as in LibreOffice's .xlsx, except one that LibreOffice lays out again. Their calculated fields have the same formulas, except that LibreOffice quotes every field's name.

Not read: dialog sheets (counted in input.unread_content), and the formulas of a pivot table's calculated items. Macro sheets and VBA projects are reported as input.active_content, and their code is read as text, never run.

PowerPoint presentations

One part per slide, in the order of the presentation, hidden slides included. Width and Height are the size of the slide in points, and every block that comes from a shape has loc.bbox: the shape's box on the slide, after the groups it is in have moved, scaled, turned and mirrored it. A placeholder that does not say where it is has the place of the placeholder it takes after, on the layout or the master.

On the slide In the model
Title heading level 1, and the part's Name. A title of several paragraphs is one heading
Subtitle heading level 2
Body text and text boxes list_item where the paragraph has a bullet or a number, with its level, and the bullet or the number as shown in Marker (•, 3., b), IV.); paragraph where it has none
Table table, with merged cells, and the first row as header where the table says it is one
Picture image, with its description as text, unless Options.Images asks for none
Date, footer and slide-number placeholders footer. A slide-number field shows the slide's number
Text the layout or the master has of its own header if it is in the upper half of the slide, footer if in the lower; on every slide that shows it, once where layout and master repeat each other
Speaker's notes note blocks of type speaker, one for each paragraph
Header and footer of the notes pages header and footer blocks after a slide's notes: the notes page's own, or the notes master's, with the master's own text. A header or footer the master switches off (p:hf) has the reason hidden. The date and the page number are not read
Header and footer of the handouts header and footer blocks from the handout master, once, after the first slide
Comments, in both the older and the threaded form note blocks of type comment, with author and date; replies follow the comment

Whether a paragraph has a bullet, how large its text is and what colour it has are often not said on the slide: they come from the placeholder on the layout, from the one on the master, from the master's style for that kind of text, or from the presentation's defaults. All of those are read. The "Click to edit" text of the placeholders on layouts and masters is not on any slide and is not extracted.

Reading order. Shapes are stored in the order they were drawn, not the order they are read in. The blocks of a slide are given title first, then from the top down, and from left to right among shapes that start beside each other. A group is read as one thing, at the place of the group. Shapes that lie wholly outside the slide come after those on it, then the layout's and master's text and pictures, the notes and the comments. The order is a reading of the layout; what each block is and where it ends are declared, so blocks stay origin: native.

Limits. Extractor.MaxCells bounds the cells of tables as it does for workbooks. The text of a master is on every slide that uses it, so a long master and many slides can ask for much more than the file holds: at most about a million blocks are repeated in this way over a presentation, and a slide past that says so with limit.exceeded. What a limit leaves out is the same for any number of workers.

Not read: sound and video clips, counted in input.unread_content; animations. An action that starts a program or runs a macro is reported as input.active_content and never run.

Charts and SmartArt

The same in all three formats.

A chart is its data, as the chart's cache holds it: a caption block with its title, then a table block with role chart, the chart's type in chart (bar, line, pie; several, space-separated, for a chart that combines them; the newer kinds by their layout: waterfall, sunburst, treemap, funnel, boxwhisker, clusteredcolumn for a histogram), its name in name, and the titles of its axes in x_axis and y_axis. The header row has the names of the series; the first columns, with an empty header, the categories, outermost first; then a column of values for each series, written through their number formats as the chart labels them (a date as a date, in ISO 8601). A bubble chart has a second column for each series, the sizes of its bubbles. Series that do not share their categories, such as those of a scatter chart, are tables of their own. A title with no text of its own is the name of the chart's one series, as Office shows it.

  • The cache is what the chart was drawn from when the file was saved. The workbook a chart in Word or PowerPoint embeds is handed to Options.Child as an embedded file: it may hold more than the chart shows. Excel keeps the data of its newer charts on the sheet and none in the chart: such a chart's table has the names of its series only.
  • Series a chart's filter leaves out are in the file, declared not drawn: they are read, in a table of their own with the reason hidden.
  • A chart holds at most about two million points; a larger one is cut off with limit.exceeded.
  • Across 1,413 series in the corpus and the soak set, the names, categories and values agree with python-pptx and openpyxl (TestChartsAsOracles).

A SmartArt diagram is the text of its data model, in the order and nesting the model declares: a list_item for each paragraph of a node, its level the node's depth. Office also keeps the drawing it made of the diagram; where the file has it, each item has the place of the shape it is drawn in (on a slide), and what the drawing declares is kept: a shape marked hidden, text drawn with no ink. A node the layout draws nowhere is in the file and on no slide, but nothing in the file switches it off: it is an item with no reason, like any other. A drawing that is empty, or draws none of the model, is out of date and is not used. Text on the connectors between nodes (an arrow's label) is an item between the nodes it joins. Against LibreOffice, which imports the drawing, over the 111 presentations with SmartArt in the corpus and the soak set, all 961 diagram paragraphs it shows are in this library's text (TestSmartArtAsLibreOffice, GOFAST_SMARTART_SOAK=1 for the soak set). Where a diagram has no drawing, LibreOffice lays the model out itself and may leave text out; that text is given here.

What a file stores and shows nowhere

A file can keep text that nobody who opens it sees. All of it is read as data, never run or followed, and bounded by the limits. What belongs to the file as a whole is in a last part of kind stored, which comes with the whole document, not with a range of parts; each block says what it is in stored. Word's field codes stay where their fields are, in the body or a header or footer, marked stored all the same. The renderers leave out the stored part, and every block marked stored wherever it is, unless RenderOptions.Stored is set, or RenderOptions.StoredKinds names its kind; a consumer can keep stored data from a model, or review it, by its kind.

Being stored says where the text comes from. It sets no display reason: the file declares nothing about the display of such data, and its length is not judged.

stored What
macro The code of a VBA project, in all three formats: a code block for each module, language vba, name the module's. Decompressed as [MS-OVBA] describes, and decoded from the project's code page: the Windows code pages 874, 932, 936, 949, 950 and 1250 to 1258, Mac Roman, ISO 8859-1 and UTF-8, from Microsoft's tables of them. A character a code page does not define, or text in another code page, is U+FFFD, counted by text.unmapped_glyphs. All 246 modules of the corpus and the soak set are the same as olevba's (TestMacrosAsOlevba, GOFAST_MACROS_SOAK=1 for the soak set). In Excel also the formulas of Excel 4 macro sheets, language excel4
custom_xml Custom XML data with text, in all three formats: a block for each part, a line for each element with text of its own (Abstract: …). Attribute values are not read. Data a content control is bound to is also in the body, where the control shows it
document_variable Word's document variables, name: value
defined_name Excel's defined names
pivot_cache The records of an Excel pivot cache whose source is gone, as a table, and the formulas of calculated fields (Margin: =Sales*0.1)
field_code Every code of a Word field: a note of type field after the paragraph its field ends in (see below)
after_end Data appended after the end of the zip archive, where Office stops reading: its text, if it is text (UTF-8), up to 1 MiB. The stored part also carries input.trailing_data, which says how many bytes follow the end, whatever they are

Field codes in Word are the instructions of fields, whose results are the text: a page number (PAGE), a cross-reference, a table of contents, a merge field, an index entry (XE "…"), the branches of IF, a citation tool's data (ADDIN). The result is text where the field is. The code is never shown, and every code is kept, whatever the field: a note block of type field after the paragraph its field ends in, marked stored field_code, so that rendered text has the results and not the codes unless RenderOptions.Stored is set. A code has no display reason of its own; one in a header or footer the document switches off takes the header's or footer's. A field in another's code is written into that code in braces, as Word shows it (IF { MERGEFIELD Title } = "Dr" …), and its result, which nothing shows, is not text. An equation field (EQ) and a macro button (MACROBUTTON) show their codes' text.

Equations

Equations in Word and PowerPoint are written in UnicodeMath, the linear form Word shows when an equation is switched to linear (Unicode Technical Note 28): x=(-b±√(b^2-4ac))/(2a), ∑_(k=0)^n▒((n¦k)x^k a^(n-k)), lim┬(n→∞)⁡a_n, ■(a&b@c&d). Every character of the equation is kept, in order. A Word paragraph that is a display equation and nothing else is a formula block with notation unicodemath; an equation in a sentence stays in the sentence.

What the file declares

Everything a file holds is extracted. Where the file itself declares that text is not shown, or that it is drawn with no ink, the block says so in Display (JSON display), as go-fast-core defines it (its README, "What the file declares"). This library reports declarations and nothing else: it does not judge whether a reader could see the text, or whether it is harmful, and a block with no reason says nothing about either. Threat detection is outside this library.

Reason Meaning
hidden The file switches the content off
no_ink The file declares the text drawn with no paint

A declaration is one switch or one value, found by following the file's own inheritance (a style, a placeholder, a master). Nothing that needs two values compared or a threshold is reported: not colour against what is behind it, not text size, not a place off the page or slide, not a box too small for its text, not a shape over the text, not conditional formatting.

What is reported, by format:

Format hidden no_ink
Word Hidden text (w:vanish, w:specVanish), on the run or through its character style, its paragraph's style or the document defaults; hidden text and a hidden paragraph style cancel, as in Word. A footnote, text box or picture anchored in hidden text. A drawing whose wp:docPr is hidden, a legacy shape whose style says visibility:hidden. A header or footer the document's own settings switch off: a first-page one where no section has a different first page, an even-page one where the document does not have different odd and even pages. (A header or footer part that no section names is used by nothing, and has no reason.) A Word 2010 text fill (w14:textFill) of nothing, or fully transparent
Excel A hidden or very hidden sheet: the part and all its blocks. Hidden rows and columns, filtered rows among them. A value its number format displays as nothing (;;;), other than zero. A shape or picture marked hidden; the hidden stand-in Excel writes for a form control kept in the legacy drawing is not one. A drop-down list whose arrow is hidden or whose cells are all hidden. The series a chart's filter leaves out Shape text with no fill, or a fill of zero opacity
PowerPoint A hidden slide (show="0"): the part and all its blocks, its notes included. A shape or group marked hidden. Text in a table cell that a merged cell covers. A notes or handout header or footer the master switches off (p:hf). The series a chart's filter leaves out Text with no fill and no outline, or a fill of zero opacity, through the run, its level, the placeholders it takes after, the master's styles and the presentation's defaults

Where only part of a paragraph has a reason, a span over that part carries it; in a table, regions of cells do (table.display), cells side by side or one under another with the same reasons making one region, so a hidden column is one entry however long it is. A part's reason (a hidden sheet or slide) is on all of its blocks. RenderOptions.ExcludeDisplay leaves the text with the reasons named out of rendered output; by default it is in.

Characters that display as nothing (Unicode tag characters, bidirectional controls, zero-width characters, variation selectors) are kept in the text as the file has them, with no reason.

Content shown on no page but extracted by design has its own place in the model, and no reason for that: document properties, alternative text of pictures, comments, speaker's notes, the values of drop-down lists, field codes, and what the file stores (see above). Formulas, with Options.Cells, are in Table.Cells, apart from what cells show.

Not extracted at all: in Excel, the records of a pivot cache whose source is in the workbook (they repeat its cells), and the formulas of a pivot table's calculated items; in Word, the building blocks of its glossary document; in PowerPoint, the tags that add-ins store on slides and shapes; attribute values of custom XML data.

Layout

Path Content
extract.go, file.go The public entry points: Extract, ExtractFile, Extractor; Open and File, for reading a part at a time
cmd/gofastooxml The command
internal/xmlscan Pull tokenizer for XML: no allocation per token, bounded memory, namespace-aware, refuses DTDs
internal/opc The package container: zip archive, content types, relationships, decompression budget. An archive that has lost its directory is read through go-fast-core's ziprecover. A package written as XML (Flat OPC) is read by the same interface
internal/wordml WordprocessingML 2003 translated into the parts of a .docx
internal/xmlroot, internal/xmlindex Telling the Office formats saved as XML by their root element; finding where the elements of such a file are, without reading those not gone into
internal/wml The Word reader: styles, numbering, body, tables, notes, character formatting, headers and footers, fields
internal/sml The Excel reader: workbook, shared strings, cell styles, the streaming sheet reader, finding tables on a sheet, comments, shapes; the records of a binary workbook, and the elements of a SpreadsheetML 2003 workbook, read into the same
internal/xlsb The records of a binary workbook (.xlsb): splitting a part into records, reading their fields, and turning a compiled formula back into its text
internal/cfb Compound files, the container of an encrypted package (and of the legacy formats): sectors, allocation tables, directory, streams
internal/crypt The two encryption schemes of Office: reading the encryption information, verifying a password or a private key for a certificate, decrypting the package as it is read
internal/pml The PowerPoint reader: presentation, layouts and masters, the shape tree of a slide, placeholders and what they inherit, tables, reading order, notes and comments
internal/dml DrawingML, which all three formats use for what is drawn: colours and fills, where a shape lies, and the text of shapes with its list styles
internal/chart, internal/diagram Charts, of both kinds, as tables of their data; SmartArt diagrams, from their data model and the drawing Office made of them. Shared by the three readers
internal/theme, internal/media, internal/hidden, internal/label, internal/warn, internal/unit Shared by the readers: theme colours, pictures and embedded files, placing display reasons on blocks and spans, bullets and numerals, warning codes, what reading one part gives
internal/omml Equations (Office Math) of Word and PowerPoint, written in UnicodeMath
internal/formula Moving the references of a shared formula to each cell of its range; formulas in R1C1 notation read into A1
internal/symbol The characters of symbol fonts (Symbol, Wingdings, Webdings and the like) translated to Unicode
internal/stored, internal/vba, internal/codepage What a package of any format keeps and shows nowhere (the code of its VBA project, its custom XML), for the stored part; reading a VBA project's source ([MS-OVBA]); the code pages that source is kept in
internal/props, internal/clean, internal/ns Document properties; text conventions of the shared model; namespace and relationship names
internal/ooxmltest Test harness: in-memory package builder, scorers, oracle wrappers, manifest loader, the checks every extracted document must pass
testdata/fixtures, testdata/expect, testdata/fixtures.json Small generated files with exactly known content, the expected result of each in the shared model's JSON form, and their manifest
testdata/gen The fixture generator and the adapters for the comparison tools
testdata/encrypted, testdata/encrypted.json Fixtures encrypted by msoffcrypto-tool and by LibreOffice, with their passwords
testdata/fuzz The seed inputs of the fuzz tests
testdata/api.txt The exported declarations of the package; a test fails when they change
testdata/corpus.json, testdata/fetch.py Manifest of 788 real files from Apache POI's test suite and data.gov.uk, and the script that downloads them. The files are not in the repository
testdata/soak.py Fetches the soak set: 5,810 Office files from the test suites of thirteen other projects, at pinned commits. Not in the repository
bench Measurements: the comparison with the tools in use today, the soak run, the benchmarks; see bench/README.md
SECURITY.md, CHANGELOG.md What is promised about untrusted files, and how to report a problem; what changes between versions

Running the tests

go test ./...

Tests that need LibreOffice, pandoc, the Python comparison tools or the downloaded corpus skip themselves when those are absent. To run everything, see bench/README.md and python3 testdata/fetch.py.

python3 testdata/soak.py && go test -run TestSoak -v .   # 6,598 files, under a minute
go test -run 'Budgets' -v -speed .                       # allocation budgets and the speed targets

Licence

MIT. The corpus files keep their own licences, recorded per file in testdata/corpus.json.

Documentation

Overview

Package gofastooxml extracts Word, Excel and PowerPoint files (Office Open XML: .docx, .xlsx, .pptx and their macro and template variants, Excel's binary workbooks, .xlsb, any of these written as one XML file, Flat OPC, and Office 2003's XML formats, WordprocessingML 2003 and SpreadsheetML 2003) into the shared go-fast document model, gofastcore.Document.

It uses the standard library and go-fast-core only.

A Word document is one part; a workbook has a part for each sheet and a presentation one for each slide. What a file stores and shows nowhere (the code of a VBA project, defined names, custom XML) is in one more part, last, of kind gofastcore.PartStored. Headings, list items with their labels, tables with merged cells, pictures, notes and comments are read as what the file declares them to be. Everything the file holds is extracted; where the file declares text not shown (hidden formatting, a hidden sheet, row, column, slide or shape) or drawn with no ink, the block says so (gofastcore.Display). Nothing is judged from appearance; see the README.

Extract and ExtractFile return a whole document. Open returns a File, which reads a part when it is asked for, so that a caller which handles one part and lets it go holds little at a time however large the file is; File.Rows does the same within a sheet too long to hold. The command is in cmd/gofastooxml.

A file encrypted with a password is opened with Options.Password, and one whose key is also encrypted for a certificate with the certificate's private key in Options.Keys; see the README for what is and is not read.

Files are taken to come from people who are not trusted. Nothing in a file is run or followed, every cost a file can impose has a limit (Options.Limits and the fields of Extractor), and every reader stops when its context is cancelled. A file that cannot be read gives one of the shared errors of gofastcore; one that is damaged in part gives what could be read, with warnings. SECURITY.md says what is promised.

Index

Examples

Constants

View Source
const (
	// DefaultMaxInputBytes bounds the size of the file.
	DefaultMaxInputBytes = 1 << 30
	// DefaultMaxDecodedBytes bounds the decompressed bytes read from the
	// archive, over all its parts. It is what stops a decompression bomb.
	DefaultMaxDecodedBytes = 2 << 30
	// DefaultMaxArchiveMembers bounds the number of files in the archive.
	DefaultMaxArchiveMembers = 100_000
	// DefaultMaxCells bounds the cells kept from a workbook, over all its
	// sheets. Each cell kept costs memory in the result whatever the size
	// of the file, so this is what bounds the memory a workbook can ask
	// for.
	DefaultMaxCells = 20_000_000
	// DefaultMaxSpinCount bounds the rounds of hashing an encrypted file
	// may ask for to turn a password into a key. Office writes 100,000;
	// the number is the file's to choose, and each round costs time.
	DefaultMaxSpinCount = 1_000_000
)

Defaults for the limits of gofastcore.Options.Limits, used where a limit is zero. A negative limit means no limit.

View Source
const (
	// WarnTableFlattened: a table whose declared grid is far larger than
	// the cells it holds was written as lines of text, cells separated by
	// tabs, instead of as a table. Raised while a Word document is read.
	WarnTableFlattened = wml.WarnTableFlattened
	// WarnIntegrityMismatch: the encrypted file carries a keyed hash of
	// itself, and the file is not what that hash was made of: it was
	// changed after it was encrypted, or damaged. What it decrypts to is
	// extracted all the same.
	WarnIntegrityMismatch = "ooxml.integrity_mismatch"
)

Warning codes specific to this library. Each states a fact about the file. The codes shared by all go-fast libraries are in gofastcore, and this library raises these of them besides the ones about parts, limits and embedded documents:

input.active_content      the package contains a VBA project, a sheet of
                          Excel 4.0 macros, or an action on a slide
                          that starts a program or runs a macro
input.external_reference  a remote template, a linked picture, object
                          or media clip, a link to another workbook
input.repaired            the archive's directory could not be read (the
                          file is cut short); the members were found
                          by their own headers, as far as they go
input.ambiguous           the archive names a member twice, in two ways,
                          or has two members with one name; each member
                          is read under the name in its header, and the
                          first of two with one name is taken
text.tracked_changes      a Word document has tracked changes
input.trailing_data       data follows the end of the zip archive; its
                          text is in the stored part (after_end)
structure.heading_level_clamped
text.control_characters_removed
                          control characters with no meaning as text
                          were removed from extracted strings
input.unread_content      the document holds content of a kind this
                          version does not read: a sound or video
                          clip, an Excel dialog sheet, a formula of a
                          binary workbook that cannot be read back
input.stream_damaged      a supporting part (styles, numbering, notes, a
                          header), the document properties or an
                          embedded file could not be read to the end,
                          or a drawing names a chart or diagram the
                          document does not have; what was read is used
text.unmapped_glyphs      characters of a symbol font, or of macro code
                          in a code page, with no character in Unicode
                          appear as U+FFFD
table.formula_no_value    cells hold formulas with no stored result
table.region_split        an area of a sheet too thinly filled to be a
                          table was written a row at a time
input.decrypted           the file was encrypted and has been decrypted;
                          the message names the scheme and what it was
                          decrypted with (Metadata.Encrypted is set)
View Source
const (
	// WarnPropertiesDamaged was ooxml.properties_damaged.
	//
	// Deprecated: use gofastcore.WarnInputStreamDamaged; the message names
	// the document properties.
	WarnPropertiesDamaged = gofastcore.WarnInputStreamDamaged
	// WarnPropertyTruncated was raised for a property value cut at 64 KiB,
	// and for custom properties past 256.
	//
	// Deprecated: those cuts are now limit.exceeded
	// (gofastcore.WarnLimitExceeded), severity error, as every other bound
	// reports what it cuts; this code is no longer raised.
	WarnPropertyTruncated = "ooxml.property_truncated"
	// WarnControlCharsRemoved was ooxml.control_characters_removed.
	//
	// Deprecated: use gofastcore.WarnTextControlCharactersRemoved.
	WarnControlCharsRemoved = gofastcore.WarnTextControlCharactersRemoved
	// WarnUnreadContent was ooxml.unread_content.
	//
	// Deprecated: use gofastcore.WarnInputUnreadContent.
	WarnUnreadContent = gofastcore.WarnInputUnreadContent
	// WarnPartDamaged was ooxml.part_damaged.
	//
	// Deprecated: use gofastcore.WarnInputStreamDamaged.
	WarnPartDamaged = gofastcore.WarnInputStreamDamaged
	// WarnFormulaNoValue was ooxml.formula_no_value.
	//
	// Deprecated: use gofastcore.WarnTableFormulaNoValue.
	WarnFormulaNoValue = gofastcore.WarnTableFormulaNoValue
	// WarnRegionSplit was ooxml.region_split.
	//
	// Deprecated: use gofastcore.WarnTableRegionSplit.
	WarnRegionSplit = gofastcore.WarnTableRegionSplit
	// WarnDecrypted was ooxml.decrypted.
	//
	// Deprecated: use gofastcore.WarnInputDecrypted, or test
	// Metadata.Encrypted.
	WarnDecrypted = gofastcore.WarnInputDecrypted
)

Names of codes this library raised under its own prefix before go-fast-core v0.1.2 made them shared. Each is now the shared code, so a test such as w.Code == WarnPartDamaged still matches; the code strings in the output changed with them. They will be removed in a later release.

Variables

This section is empty.

Functions

func Extract

func Extract(ctx context.Context, r io.ReaderAt, size int64, opts *gofastcore.Options) (*gofastcore.Document, error)

Extract reads a Word, Excel or PowerPoint file with default settings. It is (&Extractor{}).Extract.

Example

A file that is already in memory, or anything else that can be read at an offset.

data, err := os.ReadFile("testdata/fixtures/tables.docx")
if err != nil {
	log.Fatal(err)
}
doc, err := gofastooxml.Extract(context.Background(), bytes.NewReader(data), int64(len(data)), nil)
if err != nil {
	log.Fatal(err)
}
for _, b := range doc.Parts[0].Blocks {
	if b.Table != nil {
		fmt.Printf("a table of %d rows and %d columns, %d merged cells\n", len(b.Table.Rows), len(b.Table.Rows[0]), len(b.Table.Merges))
	}
}
Output:
a table of 4 rows and 3 columns, 2 merged cells
Example (Display)

What the file declares about the display of its text: here a run formatted as hidden. Text in white or in a one-point font has no reason, since colour and size are not judged, and characters that display as nothing are kept as they are.

doc, err := gofastooxml.ExtractFile(context.Background(), "testdata/fixtures/hidden.docx", nil)
if err != nil {
	log.Fatal(err)
}
for _, b := range doc.Parts[0].Blocks {
	if b.Display != 0 {
		fmt.Printf("%s: %q\n", b.Display, b.Text)
	}
}
var shown strings.Builder
doc.WriteText(&shown, &gofastcore.RenderOptions{ExcludeDisplay: gofastcore.DisplayAny})
fmt.Println(strings.Contains(shown.String(), "Hidden by formatting."))
fmt.Println(strings.Contains(doc.Text(), "\U000E0069")) // a Unicode tag character
Output:
hidden: "Visible sentence one. Hidden by formatting. Visible sentence two."
false
true

func ExtractFile

func ExtractFile(ctx context.Context, path string, opts *gofastcore.Options) (*gofastcore.Document, error)

ExtractFile opens the named file and extracts it, with default settings. It is (&Extractor{}).ExtractFile.

Example

The whole of a file as one document.

doc, err := gofastooxml.ExtractFile(context.Background(), "testdata/fixtures/basic-pptx.pptx", nil)
if err != nil {
	log.Fatal(err)
}
fmt.Println(doc.Source.Format, "with", len(doc.Parts), "slides")
fmt.Println(doc.Parts[1].Markdown())
Output:
pptx with 5 slides
# Agenda

- Status
    - Milestones reached
- Risks

Remember to mention the budget.

Types

type Extractor

type Extractor struct {
	// MaxArchiveMembers bounds the number of files in the zip archive.
	// Zero means DefaultMaxArchiveMembers; negative means no limit.
	MaxArchiveMembers int
	// MaxCells bounds the cells kept from a workbook, over all its
	// sheets, or from the tables of a presentation, over all its slides.
	// A sheet or slide that reaches it is cut off there, with a
	// limit.exceeded warning. Zero means DefaultMaxCells; negative means
	// no limit.
	MaxCells int64
	// MaxSpinCount bounds the rounds of hashing a password-protected
	// file may ask for when a password is tried. A file that asks for
	// more is refused with ErrLimitExceeded. Zero means
	// DefaultMaxSpinCount; negative means no limit.
	MaxSpinCount int
}

Extractor extracts Word, Excel and PowerPoint files. The zero value is ready to use and safe for concurrent use. Its fields are the settings that only this library has; everything else is in gofastcore.Options.

Example

Settings that only this library has are fields of an Extractor.

e := &gofastooxml.Extractor{MaxCells: 4}
doc, err := e.ExtractFile(context.Background(), "testdata/fixtures/values.xlsx", nil)
if err != nil {
	log.Fatal(err)
}
part := doc.Parts[0]
fmt.Println("rows kept:", len(part.Blocks[0].Table.Rows))
for _, w := range part.Warnings {
	fmt.Println(w.Code+":", w.Message)
}
Output:
rows kept: 1
limit.exceeded: the limit on the number of cells was reached; the sheet is cut off there

func (*Extractor) Extract

func (e *Extractor) Extract(ctx context.Context, r io.ReaderAt, size int64, opts *gofastcore.Options) (*gofastcore.Document, error)

Extract reads size bytes from r and returns the document.

The format is decided from the package itself, never from a file name. An error wraps one of the gofastcore errors:

  • ErrMalformed: neither a zip archive nor XML, or a package too damaged to identify.
  • ErrUnsupported: a zip archive or package that is not a Word, Excel or PowerPoint file; XML that is not one of the Office formats saved as XML; a legacy binary Office file; a file encrypted in a way other than with a password or for a certificate.
  • ErrPasswordRequired, ErrWrongPassword: the file is encrypted, and Options.Password is empty or does not open it.
  • ErrKeyRequired: the file's key is also encrypted for certificates, and no key in Options.Keys is the private key of one of them. The error wraps it beside ErrPasswordRequired or ErrWrongPassword when a password would open the file too.
  • ErrLimitExceeded: the input is larger than Limits.MaxInputBytes, or a limit was reached before anything could be read.
  • ErrNoPartsSelected: Options.Parts selects none of the document's parts.

It is OpenReaderAt followed by Document.

func (*Extractor) ExtractFile

func (e *Extractor) ExtractFile(ctx context.Context, path string, opts *gofastcore.Options) (*gofastcore.Document, error)

ExtractFile opens the named file and extracts it. The file name is recorded as the document's source name unless opts.Name is set.

func (*Extractor) Formats

func (e *Extractor) Formats() []string

Formats lists the formats this library extracts, as they appear in gofastcore.Source.Format. Macro-enabled files and templates are reported as the format they are a variant of, and a binary workbook (.xlsb) as "xlsx".

func (*Extractor) Open

func (e *Extractor) Open(path string, opts *gofastcore.Options) (*File, error)

Open opens the named file. The file name is recorded as the source name unless opts.Name is set. Close the File when done with it.

func (*Extractor) OpenBytes

func (e *Extractor) OpenBytes(data []byte, opts *gofastcore.Options) (*File, error)

OpenBytes opens a file held in memory. The bytes must not change while the File is in use.

func (*Extractor) OpenReaderAt

func (e *Extractor) OpenReaderAt(r io.ReaderAt, size int64, opts *gofastcore.Options) (*File, error)

OpenReaderAt opens a file of the given size read through r, which must stay readable until the File is closed. The errors are those of Extract.

A password-protected file is opened with Options.Password. Trying a password takes as long as the file's encryption is made to take: a hundredth of a second is usual.

type File

type File struct {
	// contains filtered or unexported fields
}

File is a Word, Excel or PowerPoint file opened for reading a part at a time: a Word document's one body, a workbook's sheets, a presentation's slides. Opening a file identifies it and reads its properties and what its parts share; the parts are read when they are asked for, so a caller that handles one part and lets it go holds little at a time however large the file is.

The parts are the same as those in the document that Extract returns, each complete: its warnings are on it, and what the file declares about the display of its text is set (Part.Finish has been called).

A File is safe for concurrent use. A limit of Options.Limits counts over one pass: one call of Document, Part or Children, or one run through Parts or Rows. Passes that run at the same time share it.

func Open

func Open(path string, opts *gofastcore.Options) (*File, error)

Open opens the named file with default settings. It is (&Extractor{}).Open.

Example

A file opened to be read a part at a time. Each part is complete when it is yielded, and nothing holds on to it afterwards.

f, err := gofastooxml.Open("testdata/fixtures/basic-pptx.pptx", nil)
if err != nil {
	log.Fatal(err)
}
defer f.Close()
fmt.Println(f.Format(), f.NumParts())
for part, err := range f.Parts(context.Background()) {
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s %d %q: %d blocks", part.Kind, part.Number, part.Name, len(part.Blocks))
	if part.Display != 0 {
		fmt.Printf(", %s", part.Display)
	}
	fmt.Println()
}
Output:
pptx 5
slide 1 "Project Update": 2 blocks
slide 2 "Agenda": 5 blocks
slide 3 "Figures": 3 blocks
slide 4 "": 1 blocks, hidden
slide 5 "": 2 blocks

func OpenBytes

func OpenBytes(data []byte, opts *gofastcore.Options) (*File, error)

OpenBytes opens a file held in memory with default settings.

func OpenReaderAt

func OpenReaderAt(r io.ReaderAt, size int64, opts *gofastcore.Options) (*File, error)

OpenReaderAt opens a file of the given size read through r, with default settings.

func (*File) Children

func (f *File) Children(ctx context.Context) ([]*gofastcore.Document, error)

Children extracts the files embedded in the parts read so far (a workbook in a slide, a document in a document) through Options.Child, and returns them as in gofastcore.Document.Children. With no Options.Child each is listed, not extracted. They have what the parts read last left of the text the document may hold (Limits.MaxTextBytes), as in Document.

func (*File) Close

func (f *File) Close() error

Close closes the file if Open opened it. The File must not be used afterwards.

func (*File) Document

func (f *File) Document(ctx context.Context) (*gofastcore.Document, error)

Document reads the parts Options.Parts selects and returns the document, the same one Extract returns.

func (*File) Format

func (f *File) Format() string

Format returns the kind of file: "docx", "xlsx" or "pptx". A macro-enabled file or a template is the format it is a variant of; a binary workbook (.xlsb) is "xlsx"; a package written as one XML file (Flat OPC) is the format of the package. An Excel 2003 XML spreadsheet is "spreadsheetml", a Word 2003 XML document "wordml".

func (*File) Metadata

func (f *File) Metadata() gofastcore.Metadata

Metadata returns the document's properties.

func (*File) NumParts

func (f *File) NumParts() int

NumParts returns the number of parts: 1 for a Word document, the number of sheets of a workbook, the number of slides of a presentation. A workbook or presentation with none has one part, which says so. A document that stores what it shows nowhere (defined names, macro code) has one more, last, of kind gofastcore.PartStored; it comes with the whole document, not with a range of parts.

func (*File) Part

func (f *File) Part(ctx context.Context, number int) (gofastcore.Part, error)

Part reads the part with the given number, from 1, whether or not Options.Parts selects it.

Example

One part by its number.

f, err := gofastooxml.Open("testdata/fixtures/layout.xlsx", nil)
if err != nil {
	log.Fatal(err)
}
defer f.Close()
for _, sheet := range f.Sheets() {
	fmt.Println(sheet.Number, sheet.Name, sheet.Hidden)
}
part, err := f.Part(context.Background(), 1)
if err != nil {
	log.Fatal(err)
}
for _, b := range part.Blocks {
	fmt.Println(b.Kind, b.Loc.Range, b.Origin)
}
Output:
1 Data false
2 Secret true
3 Empty false
table A1:C4 native
table A7:B8 inferred

func (*File) Parts

func (f *File) Parts(ctx context.Context) iter.Seq2[gofastcore.Part, error]

Parts returns an iterator over the parts Options.Parts selects, in order. Each part is read when the loop reaches it, a few ahead with more than one worker, and is the caller's to keep or let go. The bytes of a picture that several parts show (Options.Images) come with the first of them.

The iterator yields an error, with an empty part, and stops: when no part is selected (gofastcore.ErrNoPartsSelected), when ctx is cancelled, or when the file can no longer be read. A part that is damaged or cut short by a limit is not an error: it is yielded with a warning that says so.

What the parts say about the document as a whole is in Warnings and Children once they have been read.

func (*File) Rows

func (f *File) Rows(ctx context.Context, number, band int) iter.Seq2[gofastcore.Part, error]

Rows returns an iterator over the cells of a sheet of a workbook, a band of rows at a time. number is the sheet's part number, from 1, and band the number of rows that have cells to a band. Each band is yielded as a part with the sheet's kind, number and name, holding the tables its cells make, with what the file declares about the display of cells as in the sheet read whole.

It is for sheets too long to hold: what is held at a time is one band, whatever the length of the sheet, and the limits on cells and text do not apply. In exchange the sheet's part is read twice; a table that runs past the end of a band is cut there, and goes on in the next band as a table marked Continued; the tables a sheet declares are not looked up, so every table is origin inferred; and comments, shapes and pictures are not read (Part reads them). A sheet with no cells yields one part with no blocks.

Bands follow the order of the rows in the file, which in a sound workbook is the order of the sheet. Rows a file gives out of order are put in order within a band and not across bands, and a cell a damaged file gives twice, which the sheet read whole has once, is in each band it falls in.

With more than one worker (Options.Workers) the sheet is decompressed on a goroutine of its own, a few chunks ahead of the reading of its rows; the bands are the same as with one.

The iterator yields an error and stops as Parts does; for a file that is not a workbook the error wraps gofastcore.ErrUnsupported.

Example

A sheet too long to hold, a band of rows at a time.

f, err := gofastooxml.Open("testdata/fixtures/values.xlsx", nil)
if err != nil {
	log.Fatal(err)
}
defer f.Close()
rows := 0
for band, err := range f.Rows(context.Background(), 1, 8) {
	if err != nil {
		log.Fatal(err)
	}
	for _, b := range band.Blocks {
		rows += len(b.Table.Rows)
		fmt.Println(b.Loc.Range, b.Table.Rows[0])
	}
}
fmt.Println(rows, "rows")
Output:
A1:C8 [Kind Value Format]
A9:C16 [percent 12.5% 0.0%]
A17:C18 [boolean TRUE General]
18 rows

func (*File) Sheets

func (f *File) Sheets() []Sheet

Sheets lists the sheets of a workbook in order, without reading them. It is empty for other formats.

func (*File) Source

func (f *File) Source() gofastcore.Source

Source returns what is known of where the document came from, as in gofastcore.Document.Source.

func (*File) Warnings

func (f *File) Warnings() []gofastcore.Warning

Warnings returns the warnings about the document as a whole, as in gofastcore.Document.Warnings: those known when the file was opened, and those that the parts read so far give rise to (content of a kind that is not read, damaged supporting parts, references to things outside the file). It is complete once every part has been read.

type Sheet

type Sheet struct {
	// Number is the sheet's part number, from 1.
	Number int
	// Name is the sheet's name.
	Name string
	// Hidden says the workbook marks the sheet hidden.
	Hidden bool
}

Sheet is a sheet of a workbook as the workbook lists it.

Directories

Path Synopsis
bench
batch/gooxml command
Command gooxml extracts the text of every file in a list with go-fast-ooxml, for the batch comparison (bench/batch/README.md): one process, WORKERS goroutines reading the files in turn (interleaved), each file with one worker of its own (Options.Workers 1, as the commands do with -j above 1); the time of each call (Extract and the text rendering, after the bytes are read), whether it failed, and the length of the text.
Command gooxml extracts the text of every file in a list with go-fast-ooxml, for the batch comparison (bench/batch/README.md): one process, WORKERS goroutines reading the files in turn (interleaved), each file with one worker of its own (Options.Workers 1, as the commands do with -j above 1); the time of each call (Extract and the text rendering, after the bytes are read), whether it failed, and the length of the text.
cmd
gofastooxml command
Command gofastooxml extracts Word, Excel and PowerPoint files into the shared document model of the go-fast libraries and prints them as JSON, Markdown or plain text.
Command gofastooxml extracts Word, Excel and PowerPoint files into the shared document model of the go-fast libraries and prints them as JSON, Markdown or plain text.
internal
cfb
Package cfb reads compound files: the container of the legacy Office formats, and of a password-protected Office Open XML file, which is an encrypted zip archive stored as a stream inside one.
Package cfb reads compound files: the container of the legacy Office formats, and of a password-protected Office Open XML file, which is an encrypted zip archive stored as a stream inside one.
chart
Package chart reads a chart part: the classic charts of DrawingML (c:) and the kinds Office added in 2016 (cx:), as Word, Excel and PowerPoint all store them.
Package chart reads a chart part: the classic charts of DrawingML (c:) and the kinds Office added in 2016 (cx:), as Word, Excel and PowerPoint all store them.
clean
Package clean turns bytes read from a file into strings that obey the text conventions of the shared document model: valid UTF-8, no control characters other than line feed and tab, and for prose no surrounding white space and no presentation-form ligatures.
Package clean turns bytes read from a file into strings that obey the text conventions of the shared document model: valid UTF-8, no control characters other than line feed and tab, and for prose no surrounding white space and no presentation-form ligatures.
codepage
Package codepage decodes text in the code pages of Windows (874, 932, 936, 949, 950, 1250 to 1258) and Mac Roman (10000), from Microsoft's tables of them (see generate.py).
Package codepage decodes text in the code pages of Windows (874, 932, 936, 949, 950, 1250 to 1258) and Mac Roman (10000), from Microsoft's tables of them (see generate.py).
crypt
Package crypt opens password-protected Office Open XML files.
Package crypt opens password-protected Office Open XML files.
diagram
Package diagram reads a SmartArt diagram: the text of its data model, in the order and nesting the model declares, and, where the file carries the drawing Office made of it, where each piece of text is drawn and what the drawing declares about its display.
Package diagram reads a SmartArt diagram: the text of its data model, in the order and nesting the model declares, and, where the file carries the drawing Office made of it, where each piece of text is drawn and what the drawing declares about its display.
dml
Package dml reads DrawingML, the part of Office Open XML that Word, Excel and PowerPoint share for what is drawn: colours and fills, where a shape lies, and the text inside shapes.
Package dml reads DrawingML, the part of Office Open XML that Word, Excel and PowerPoint share for what is drawn: colours and fills, where a shape lies, and the text inside shapes.
formula
Package formula moves the references of a spreadsheet formula.
Package formula moves the references of a spreadsheet formula.
hidden
Package hidden has what the readers of the three formats share in placing what the file declares about the display of text (hidden, no ink) on blocks and spans.
Package hidden has what the readers of the three formats share in placing what the file declares about the display of text (hidden, no ink) on blocks and spans.
label
Package label writes the labels a reader sees in front of list items: bullets, and numbers in the forms Word and PowerPoint both use.
Package label writes the labels a reader sees in front of list items: bullets, and numbers in the forms Word and PowerPoint both use.
media
Package media reads what a document carries besides its text: pictures and embedded files.
Package media reads what a document carries besides its text: pictures and embedded files.
ns
Package ns numbers the XML namespaces and names the relationship types of Office Open XML, in both forms a file may use: Transitional, which Office writes by default, and ISO Strict.
Package ns numbers the XML namespaces and names the relationship types of Office Open XML, in both forms a file may use: Transitional, which Office writes by default, and ISO Strict.
omml
Package omml writes Office Math (OMML), the equations of Word and PowerPoint, in UnicodeMath: the linear form Word itself shows when an equation is switched to "linear" (Unicode Technical Note 28).
Package omml writes Office Math (OMML), the equations of Word and PowerPoint, in UnicodeMath: the linear form Word itself shows when an equation is switched to "linear" (Unicode Technical Note 28).
ooxmltest
Package ooxmltest is the test harness of go-fast-ooxml: an in-memory builder for Office Open XML packages, scorers, oracle wrappers, the corpus manifest and the checks every extracted document must pass.
Package ooxmltest is the test harness of go-fast-ooxml: an in-memory builder for Office Open XML packages, scorers, oracle wrappers, the corpus manifest and the checks every extracted document must pass.
opc
Package opc reads the container of an Office Open XML file: a zip archive holding parts, a table of their content types, and relationship parts that link them; or the same package written as one XML document (Flat OPC, flat.go).
Package opc reads the container of an Office Open XML file: a zip archive holding parts, a table of their content types, and relationship parts that link them; or the same package written as one XML document (Flat OPC, flat.go).
pml
Package pml reads PowerPoint presentations (PresentationML) into the shared document model: one part per slide, with what each shape says as headings, paragraphs, list items, tables and pictures, each with the place on the slide it was read from.
Package pml reads PowerPoint presentations (PresentationML) into the shared document model: one part per slide, with what each shape says as headings, paragraphs, list items, tables and pictures, each with the place on the slide it was read from.
props
Package props reads the document properties of an Office Open XML package into the shared model's Metadata.
Package props reads the document properties of an Office Open XML package into the shared model's Metadata.
sml
Package sml reads Excel workbooks (SpreadsheetML) into the shared document model: one part per sheet, the cells as tables, with what each cell displays rather than what it stores.
Package sml reads Excel workbooks (SpreadsheetML) into the shared document model: one part per sheet, the cells as tables, with what each cell displays rather than what it stores.
stored
Package stored reads what an Office package of any of the three formats keeps for the file as a whole and shows on no page: the code of its VBA project, its custom XML data, and data that follows the end of the zip archive.
Package stored reads what an Office package of any of the three formats keeps for the file as a whole and shows on no page: the code of its VBA project, its custom XML data, and data that follows the end of the zip archive.
symbol
Package symbol translates the characters of symbol fonts to Unicode.
Package symbol translates the characters of symbol fonts to Unicode.
theme
Package theme reads the colour scheme of an Office theme, which Word, Excel and PowerPoint files all refer to: a file names a colour as "accent1" or as theme colour 4, and the theme part says what that is.
Package theme reads the colour scheme of an Office theme, which Word, Excel and PowerPoint files all refer to: a file names a colour as "accent1" or as theme colour 4, and the theme part says what that is.
unit
Package unit is what the readers of the three formats have in common when a document is read a part at a time: a Word document's one body, a workbook's sheets, a presentation's slides.
Package unit is what the readers of the three formats have in common when a document is read a part at a time: a Word document's one body, a workbook's sheets, a presentation's slides.
vba
Package vba reads the source code of a VBA project: the modules of macros a macro-enabled Office file carries in its vbaProject.bin, a compound file.
Package vba reads the source code of a VBA project: the modules of macros a macro-enabled Office file carries in its vbaProject.bin, a compound file.
warn
Package warn holds what the readers share in saying what a document lost: the library's fixed bounds and the limit.exceeded warnings that say what they left out, the gathering of warnings that would repeat (Names), the end of a reading at the text limit (ErrText), and the library's own code ooxml.table_flattened, documented where the public package declares it.
Package warn holds what the readers share in saying what a document lost: the library's fixed bounds and the limit.exceeded warnings that say what they left out, the gathering of warnings that would repeat (Names), the end of a reading at the text limit (ErrText), and the library's own code ooxml.table_flattened, documented where the public package declares it.
wml
Package wml reads WordprocessingML, the format of Word documents, into the blocks of the shared document model.
Package wml reads WordprocessingML, the format of Word documents, into the blocks of the shared document model.
wordml
Package wordml translates a WordprocessingML 2003 document (Word 2003's "XML Document", root w:wordDocument) into the parts of the .docx it corresponds to, so that the Word reader reads it as it reads any other.
Package wordml translates a WordprocessingML 2003 document (Word 2003's "XML Document", root w:wordDocument) into the parts of the .docx it corresponds to, so that the Word reader reads it as it reads any other.
xlsb
Package xlsb reads the parts of an Excel binary workbook (.xlsb, [MS-XLSB]): the same package as an .xlsx file, whose workbook, sheets, shared strings, styles, comments and tables are records in place of XML.
Package xlsb reads the parts of an Excel binary workbook (.xlsb, [MS-XLSB]): the same package as an .xlsx file, whose workbook, sheets, shared strings, styles, comments and tables are records in place of XML.
xmlindex
Package xmlindex finds where the elements of an XML file are, to a depth the caller chooses, without reading what is in the elements it does not go into: those are skipped over, by where their markup begins and ends.
Package xmlindex finds where the elements of an XML file are, to a depth the caller chooses, without reading what is in the elements it does not go into: those are skipped over, by where their markup begins and ends.
xmlroot
Package xmlroot says which of the Office formats saved as one XML file an input is, by its root element: Flat OPC (a Word, Excel or PowerPoint package written as XML), WordprocessingML 2003 or SpreadsheetML 2003.
Package xmlroot says which of the Office formats saved as one XML file an input is, by its root element: Flat OPC (a Word, Excel or PowerPoint package written as XML), WordprocessingML 2003 or SpreadsheetML 2003.
xmlscan
Package xmlscan is a pull tokenizer for XML, built for reading Office Open XML parts quickly and safely.
Package xmlscan is a pull tokenizer for XML, built for reading Office Open XML parts quickly and safely.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL