Ejemplo n.º 1
0
        public static HeaderBlock WriteOutAndReadHeader(NPOIFSFileSystem fs)
        {
            MemoryStream baos = new MemoryStream();
            fs.WriteFileSystem(baos);

            HeaderBlock header = new HeaderBlock(new MemoryStream(baos.ToArray()));
            return header;
        }
Ejemplo n.º 2
0
 public static NPOIFSFileSystem WriteOutAndReadBack(NPOIFSFileSystem original)
 {
     MemoryStream baos = new MemoryStream();
     original.WriteFileSystem(baos);
     original.Close();
     return new NPOIFSFileSystem(new ByteArrayInputStream(baos.ToArray()));
 }
Ejemplo n.º 3
0
        public void NPOIFSReadCopyWritePOIFSRead()
        {
            FileStream testFile = POIDataSamples.GetSpreadSheetInstance().GetFile("Simple.xls");
            NPOIFSFileSystem src = new NPOIFSFileSystem(testFile);
            byte[] wbDataExp = IOUtils.ToByteArray(src.CreateDocumentInputStream("Workbook"));

            NPOIFSFileSystem nfs = new NPOIFSFileSystem();
            EntryUtils.CopyNodes(src.Root, nfs.Root);
            src.Close();

            MemoryStream bos = new MemoryStream();
            nfs.WriteFileSystem(bos);
            nfs.Close();

            POIFSFileSystem pfs = new POIFSFileSystem(new MemoryStream(bos.ToArray()));
            byte[] wbDataAct = IOUtils.ToByteArray(pfs.CreateDocumentInputStream("Workbook"));

            Assert.That(wbDataExp, new EqualConstraint(wbDataAct));
        }