Repository navigation
Releases
DocxKit 0.1.1
Fixes found by running DocxKit over Apache POI's test documents.
- Numbering with format overrides. A list that gives a level its own look (a
<w:lvl>inside<w:lvlOverride>) now counts on with the other lists made from the same definition, as Word does: 1, then B and C in the lettered list, then 4. Before, it counted on its own (A, B, then 2). Only<w:startOverride>starts a list again. - Safe off the main thread. A part nested more than 512 levels deep is refused with
DocxError.unreadablebefore it's parsed (Foundation's XML tree builds and frees itself by recursion), and tables more than 32 deep are read as their cells' paragraphs without recursion. A fuzzed file nesting tables 5,000 deep used to crash reading in aTask.
DocxKit 0.1.0
The first release of DocxKit: Word documents (.docx) read in Swift and laid out for AppKit's text system, with no outside libraries.
Reads the body, tables (grid spans and merged cells), footnotes and endnotes, comments and their threads, tracked insertions and deletions with authors and dates, fields, hyperlinks, section page size and margins, styles with inheritance, and list numbering (decimal, letters, Roman, ordinals, legal 1.2.3).
Lays out a document as an NSAttributedString for an NSTextView, with tracked changes shown as Word's All Markup, No Markup or Original. Each laid-out paragraph knows where its text came from in the document.
Keeps the file as it was. Reading changes nothing, and the zip can be rewritten with some parts replaced and every other part copied byte for byte.
.package(url: "https://github.com/mtbalen/DocxKit", from: "0.1.0")Requires macOS 14 and Swift 6.1 tools. MIT licensed.