-so (write data to stdout) switch
Causes 7-Zip to write output data to stdout (standard output stream).
If the -so switch is used with the command that creates archive, it works only with some archive formats: xz, gzip, bzip2 and tar.
7z x archive.gz -so > Doc.txt
decompresses archive.gz archive to output stream and then redirects that stream to Doc.txt file.
7z a dummy -tgzip -so Doc.txt > archive.gz
compresses the Doc.txt file to the 7-Zip standard output stream and writes that stream to archive.gz file.