Example #1
0
        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());
        }
Example #2
0
        /// <summary>
        /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        public override String ToString()
        {
            StringBuilder buffer = new StringBuilder(40 * (path.Length + 1));

            for (int j = 0; j < path.Length; j++)
            {
                buffer.Append(path.GetComponent(j)).Append("/");
            }
            buffer.Append(name);
            return(buffer.ToString());
        }