dotnet / dotnet/Open-XML-SDK

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

Open Beginner friendly
#2,113 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.6k
Forks
605
PR merge metrics
No merged PRs in 30d

Description

**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: https://github.com/dotnet/Open-XML-SDK/issues/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: https://github.com/dotnet/Open-XML-SDK/issues/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.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Microsoft Learn page linked in the issue, “How to create a package,” and the related issues and System.IO.Packaging context cited there. Update the relevant documentation with the official support decision for write-only, non-seekable streams, so users can find a direct answer without searching old issues or Stack Overflow.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.