public NPOIFSDocument(string name, int size, NPOIFSFileSystem filesystem, POIFSWriterListener Writer) { _filesystem = filesystem; if (size < POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new NPOIFSStream(filesystem.GetMiniStore()); _block_size = _filesystem.GetMiniStore().GetBlockStoreBlockSize(); } else { _stream = new NPOIFSStream(filesystem); _block_size = _filesystem.GetBlockStoreBlockSize(); } Stream innerOs = _stream.GetOutputStream(); DocumentOutputStream os = new DocumentOutputStream(innerOs, size); POIFSDocumentPath path = new POIFSDocumentPath(name.Split(new string[] { "\\\\" }, StringSplitOptions.RemoveEmptyEntries)); string docName = path.GetComponent(path.Length - 1); POIFSWriterEvent event1 = new POIFSWriterEvent(os, path, docName, size); Writer.ProcessPOIFSWriterEvent(event1); innerOs.Dispose(); // And build the property for it _property = new DocumentProperty(name, size); _property.StartBlock = (/*setter*/ _stream.GetStartBlock()); }
internal virtual void WriteBlocks(Stream stream) { if (this.Valid) { if (this.writer != null) { DocumentOutputStream stream2 = new DocumentOutputStream(stream, this.size); //OnBeforeWriting(new POIFSWriterEventArgs(stream2, this.path, this.name, this.size)); writer.ProcessPOIFSWriterEvent(new POIFSWriterEvent(stream2, path, name, size)); stream2.WriteFiller(this.CountBlocks * POIFSConstants.BIG_BLOCK_SIZE, DocumentBlock.FillByte); } else { for (int i = 0; i < this.bigBlocks.Length; i++) { this.bigBlocks[i].WriteBlocks(stream); } } } }