示例#1
0
        /// <summary>
        /// Open workbook from a file stream.
        /// </summary>
        /// <param name="file"></param>
        public void Open(Stream file)
        {
            CompoundDocument doc = CompoundDocument.Read(file);

            if (doc == null)
            {
                throw new Exception("Invalid Excel file");
            }
            byte[] bookdata = doc.GetStreamData("Workbook");
            this.Read(new MemoryStream(bookdata));
        }
示例#2
0
        /// <summary>
        /// Open workbook from a file path.
        /// </summary>
        /// <param name="file"></param>
        public static Workbook Open(FileStream stream)
        {
            CompoundDocument doc = CompoundDocument.Read(stream);

            if (doc == null)
            {
                throw new Exception("Invalid Excel file");
            }
            byte[] bookdata = doc.GetStreamData("Workbook");
            return(WorkbookDecoder.Decode(new MemoryStream(bookdata)));
        }
示例#3
0
        public static Workbook Open(string file)
        {
            CompoundDocument compoundDocument = CompoundDocument.Read(file);

            if (compoundDocument == null)
            {
                throw new Exception("Invalid Excel file");
            }
            byte[] streamData = compoundDocument.GetStreamData("Workbook");
            return(WorkbookDecoder.Decode(new MemoryStream(streamData)));
        }