示例#1
0
        /// <summary>
        /// Processes a DocumentInputStream into essentially Record events.
        /// </summary>
        /// <param name="req">an Instance of HSSFRequest which has your registered listeners</param>
        /// <param name="in1">a DocumentInputStream obtained from POIFS's POIFSFileSystem object</param>
        /// <returns>numeric user-specified result code.</returns>
        protected short GenericProcessEvents(HSSFRequest req, RecordInputStream in1)
        {
            bool   going    = true;
            short  userCode = 0;
            Record r        = null;

            // Create a new RecordStream and use that
            HSSFRecordStream recordStream = new HSSFRecordStream(in1);

            // Process each record as they come in
            while (going)
            {
                r = recordStream.NextRecord();
                if (r != null)
                {
                    userCode = req.ProcessRecord(r);
                    if (userCode != 0)
                    {
                        break;
                    }
                }
                else
                {
                    going = false;
                }
            }

            // All done, return our last code
            return(userCode);
        }
示例#2
0
 /// <summary>
 /// Processes a DocumentInputStream into essentially Record events.
 /// If an
 /// <c>AbortableHSSFListener</c>
 ///  causes a halt to Processing during this call
 /// the method will return just as with
 /// <c>abortableProcessEvents</c>
 /// , but no
 /// user code or
 /// <c>HSSFUserException</c>
 ///  will be passed back.
 /// </summary>
 /// <param name="req">an Instance of HSSFRequest which has your registered listeners</param>
 /// <param name="in1">a DocumentInputStream obtained from POIFS's POIFSFileSystem object</param>
 public void ProcessEvents(HSSFRequest req, Stream in1)
 {
     try
     {
         GenericProcessEvents(req, new RecordInputStream(in1));
     }
     catch (HSSFUserException)
     { /*If an HSSFUserException user exception Is thrown, ignore it.*/ }
 }
示例#3
0
 /// <summary>
 /// Processes a DocumentInputStream into essentially Record events.
 /// </summary>
 /// <param name="req">an Instance of HSSFRequest which has your registered listeners</param>
 /// <param name="in1">a DocumentInputStream obtained from POIFS's POIFSFileSystem object</param>
 /// <returns>numeric user-specified result code.</returns>
 public short AbortableProcessEvents(HSSFRequest req, Stream in1)
 {
     return(GenericProcessEvents(req, new RecordInputStream(in1)));
 }
示例#4
0
        /// <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));
        }
示例#5
0
        /// <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);
        }