Example #1
0
        /**
         * Creates an instance of this class from an embedded OLE Object. The OLE Object is expected
         * to include a stream "{01}Ole10Native" which Contains the actual
         * data relevant for this class.
         *
         * @param poifs POI Filesystem object
         * @return Returns an instance of this class
         * @throws IOException on IO error
         * @throws Ole10NativeException on invalid or unexcepted data format
         */
        public static Ole10Native CreateFromEmbeddedOleObject(POIFSFileSystem poifs)
        {
            bool plain = false;

            try
            {
                poifs.Root.GetEntry("\x0001Ole10ItemName");             
                plain = true;
            }
            catch (FileNotFoundException)
            {
                plain = false;
            }

            DocumentInputStream dis = poifs.CreateDocumentInputStream(OLE10_NATIVE);
            using (MemoryStream bos = new MemoryStream())
            {
                IOUtils.Copy(dis, bos);
                byte[] data = bos.ToArray();

                return new Ole10Native(data, 0, plain);
            }
        }
Example #2
0
        /**
         * Creates an instance of this class from an embedded OLE Object. The OLE Object is expected
         * to include a stream "{01}Ole10Native" which Contains the actual
         * data relevant for this class.
         *
         * @param poifs POI Filesystem object
         * @return Returns an instance of this class
         * @throws IOException on IO error
         * @throws Ole10NativeException on invalid or unexcepted data format
         */
        public static Ole10Native CreateFromEmbeddedOleObject(POIFSFileSystem poifs)
        {
            bool plain = false;

            try
            {
                poifs.Root.GetEntry("\x0001Ole10ItemName");
                plain = true;
            }
            catch (FileNotFoundException)
            {
                plain = false;
            }

            DocumentInputStream dis = poifs.CreateDocumentInputStream(OLE10_NATIVE);

            using (MemoryStream bos = new MemoryStream())
            {
                IOUtils.Copy(dis, bos);
                byte[] data = bos.ToArray();

                return(new Ole10Native(data, 0, plain));
            }
        }
 /// <summary>
 /// Processes a file into essentially record events.
 /// </summary>
 /// <param name="req">an Instance of HSSFRequest which has your registered listeners</param>
 /// <param name="fs">a POIFS filesystem containing your workbook</param>
 /// <returns>numeric user-specified result code.</returns>
 public short AbortableProcessWorkbookEvents(HSSFRequest req, POIFSFileSystem fs)
 {
     Stream in1 = fs.CreateDocumentInputStream("Workbook");
     return AbortableProcessEvents(req, in1);
 }
        /// <summary>
        /// Processes a file into essentially record events.
        /// </summary>
        /// <param name="req">an Instance of HSSFRequest which has your registered listeners</param>
        /// <param name="fs">a POIFS filesystem containing your workbook</param>
        public void ProcessWorkbookEvents(HSSFRequest req, POIFSFileSystem fs)
        {
            Stream in1 = fs.CreateDocumentInputStream("Workbook");

            ProcessEvents(req, in1);
        }