PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.19k forks source link

Add support for loading from in-memory strings #677

Open cubiclesoft opened 9 years ago

cubiclesoft commented 9 years ago

There are advantages to handling in-memory strings. Obviously this request is going to require a pretty significant refactoring of the code since files are assumed. Specifically, the current ZIP archive solutions only support files on disk, which is most likely the major roadblock. To that end:

https://github.com/cubiclesoft/ultimate-web-scraper/blob/master/support/deflate_stream.php

https://github.com/cubiclesoft/ultimate-web-scraper/blob/master/support/crc32_stream.php

Could be used as the basis of an in-memory-only zip file archiver/extractor. I've not had a chance to figure out what is involved, but both classes implement the most difficult components of the ZIP file format using in-memory data streams.

jlherren commented 8 years ago

Perhaps a solution involving php://memory or php://temp might be easier to implement. A user could open and write into an php://memory stream and then pass it on to PHPExcel. Note that opening php://memory will always create a new fresh temporary handle, this means that passing it to PHPExcel as a file name is not possible.