Skip to content

Documentation Request - Document impossibility to pass in a write-only, non-seekable stream when generating a document #2113

Description

@Fube

Describe the API or scenario
The ability (or lack thereof) to generate into a write-only, non-seekable stream.

Attempts
I have looked everywhere I can think of for an official stance on this, but I cannot find a definitive & direct answer to this question.
There was an issue opened about a similar issue back in 2017 (see: #266).
There was an issue about "Cannot retrieve part of a writeonly container" being thrown when someone tries to pass in a Package they opened with a write-only stream (see: #1809).

Neither of these give a definitive answer.
The latter was answered with

The git commit for this is from 9 years ago, so I don't know how it works in 2.18.0, but it shouldn't.
Since what you're seeing is the expected behavior, I will close this as by design.

but the design decision is one made in System.IO.Packaging, not the Open-XML-SDK.

Related scenarios
Someone asked the question and answered themselves 7 years ago: https://stackoverflow.com/questions/52066522/is-it-possible-to-write-a-new-spreadsheetdocument-to-a-write-only-stream

Additional context
I'm pretty sure it is impossible to write to write-only, non-seekable stream, but I cannot find an official answer by the authors/maintainers.
I think it'd be good to document this as a decision officially like "It is not supported. We do not plan on supporting this." so that consumers don't have to go looking through past GitHub issues or old SO questions.

Just a small caution on https://learn.microsoft.com/en-us/office/open-xml/general/how-to-create-a-package would suffice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions