Skip to content

v0.10.0

Choose a tag to compare

@dkulyk dkulyk released this 06 Sep 22:16
· 20 commits to main since this release
b5eaba9

Added

  • OpenXmlPackage::removeParts() and removePartsAndRelationships() remove a
    list of parts with one relationship scan instead of one scan per part. Names
    and inbound references are checked before removal; cascading results preserve
    input order and report each equivalent part name once. removeParts() is
    blocked only by a reference from a part the batch keeps, so it accepts what the
    loop of single removals it replaces accepts, whatever the order of the names.
    PackageInterface is unchanged.

Changed

  • Breaking. addPartFromPath(), writePartFromPath() and
    setContentsFromPath() no longer copy the file into package-owned storage. The
    file is read when the part is read or the package is saved, so the caller owns
    it until then and must not move, replace, or delete it. The file's identity and
    timestamps are recorded when the part is added and checked on every read, so a
    file changed behind the package's back raises ConcurrentModificationException
    instead of being silently packaged. Pass a stream to keep the old snapshot
    behaviour. getPartReadablePath() returns that file for such a part rather than
    materializing a copy of it; every other staged part is still materialized, since
    only a file the caller owns outlives the staging. Adding a 64 MiB file and saving
    drops from about 87 ms to 66 ms, forty 2 MiB images from about 120 ms to 80 ms,
    and getPartReadablePath() on a 64 MiB part from 18 ms to nothing, because the
    bytes are no longer read to stage them and written again to save them.
  • Opening a stream for file-backed staged part contents now uses an independent
    read-only handle to the existing temporary file instead of copying the payload.
    Open readers retain their snapshot across part replacement, removal, moves,
    saves, and package release; the file is cleaned up after its last owner releases it.