示例#1
0
        public void SetUp()
        {
            POIFSFileSystem filesystem = new POIFSFileSystem(
                    POIDataSamples.GetDocumentInstance().OpenResourceAsStream("test.doc"));

            DocumentEntry documentProps =
              (DocumentEntry)filesystem.Root.GetEntry("WordDocument");
            _mainStream = new byte[documentProps.Size];
            filesystem.CreateDocumentInputStream("WordDocument").Read(_mainStream);

            // use the fib to determine the name of the table stream.
            _fib = new FileInformationBlock(_mainStream);

            String name = "0Table";
            if (_fib.IsFWhichTblStm())
            {
                name = "1Table";
            }

            // read in the table stream.
            DocumentEntry tableProps =
              (DocumentEntry)filesystem.Root.GetEntry(name);
            _tableStream = new byte[tableProps.Size];
            filesystem.CreateDocumentInputStream(name).Read(_tableStream);

            _fib.FillVariableFields(_mainStream, _tableStream);
        }