Ejemplo n.º 1
0
        /**
         * A factory method which takes input an excel file and reads input the contents.
         *
         * @exception IOException
         * @exception BiffException
         * @param file the excel 97 spreadsheet to parse
         * @param ws the settings for the workbook
         * @return a workbook instance
         */
        public static Workbook getWorkbook(FileInfo file, WorkbookSettings ws)
        {
            Stream fis = new FileStream(file.FullName, FileMode.Open);

            // Always close down the input stream, regardless of whether or not the
            // file can be parsed.  Thanks to Steve Hahn for this
            CSharpJExcel.Jxl.Read.Biff.File dataFile = null;

            try
            {
                dataFile = new CSharpJExcel.Jxl.Read.Biff.File(fis, ws);
            }
            catch (IOException e)
            {
                throw e;
            }
            catch (BiffException e)
            {
                throw e;
            }
            finally
            {
                fis.Close();
            }

            Workbook workbook = new WorkbookParser(dataFile, ws);

            workbook.parse();

            return(workbook);
        }
Ejemplo n.º 2
0
        public WriteAccess(FileInfo file, TextWriter os)
        {
            WorkbookSettings ws = new WorkbookSettings();
            Stream fis = new FileStream(file.FullName,FileMode.Open,FileAccess.Read);
            CSharpJExcel.Jxl.Read.Biff.File f = new CSharpJExcel.Jxl.Read.Biff.File(fis, ws);
            reader = new BiffRecordReader(f);

            display(ws,os);
            fis.Close();
        }
Ejemplo n.º 3
0
        /**
         * A factory method which takes input an excel file and reads input the contents.
         *
         * @param inStream an open stream which inStream the the excel 97 spreadsheet to parse
         * @param ws the settings for the workbook
         * @return a workbook instance
         * @exception IOException
         * @exception BiffException
         */
        public static Workbook getWorkbook(Stream inStream, WorkbookSettings ws)
        {
            CSharpJExcel.Jxl.Read.Biff.File dataFile = new CSharpJExcel.Jxl.Read.Biff.File(inStream, ws);

            Workbook workbook = new WorkbookParser(dataFile, ws);

            workbook.parse();

            return(workbook);
        }
Ejemplo n.º 4
0
        public WriteAccess(FileInfo file, TextWriter os)
        {
            WorkbookSettings ws  = new WorkbookSettings();
            Stream           fis = new FileStream(file.FullName, FileMode.Open, FileAccess.Read);

            CSharpJExcel.Jxl.Read.Biff.File f = new CSharpJExcel.Jxl.Read.Biff.File(fis, ws);
            reader = new BiffRecordReader(f);

            display(ws, os);
            fis.Close();
        }
Ejemplo n.º 5
0
        /**
         * Constructor
         *
         * @param file the file
         * @param os the output stream
         * @exception IOException
         * @exception BiffException
         */
        public BiffDump(FileInfo file, TextWriter os)
        {
            FileStream fis = new FileStream(file.FullName,FileMode.Open);
            CSharpJExcel.Jxl.Read.Biff.File f = new CSharpJExcel.Jxl.Read.Biff.File(fis, new WorkbookSettings());
            reader = new BiffRecordReader(f);

            buildNameHash();
            dump(os);

            os.Flush();
            //			os.close();
            fis.Close();
        }
Ejemplo n.º 6
0
        /**
         * Constructor
         *
         * @param file the file
         * @param os the output stream
         * @exception IOException
         * @exception BiffException
         */
        public BiffDump(FileInfo file, TextWriter os)
        {
            FileStream fis = new FileStream(file.FullName, FileMode.Open);

            CSharpJExcel.Jxl.Read.Biff.File f = new CSharpJExcel.Jxl.Read.Biff.File(fis, new WorkbookSettings());
            reader = new BiffRecordReader(f);

            buildNameHash();
            dump(os);

            os.Flush();
//			os.close();
            fis.Close();
        }
Ejemplo n.º 7
0
        /**
         * A factory method which takes input an excel file and reads input the contents.
         *
         * @param inStream an open stream which inStream the the excel 97 spreadsheet to parse
         * @param ws the settings for the workbook
         * @return a workbook instance
         * @exception IOException
         * @exception BiffException
         */
        public static Workbook getWorkbook(Stream inStream, WorkbookSettings ws)
        {
            CSharpJExcel.Jxl.Read.Biff.File dataFile = new CSharpJExcel.Jxl.Read.Biff.File(inStream,ws);

            Workbook workbook = new WorkbookParser(dataFile,ws);
            workbook.parse();

            return workbook;
        }
Ejemplo n.º 8
0
        /**
         * A factory method which takes input an excel file and reads input the contents.
         *
         * @exception IOException
         * @exception BiffException
         * @param file the excel 97 spreadsheet to parse
         * @param ws the settings for the workbook
         * @return a workbook instance
         */
        public static Workbook getWorkbook(FileInfo file,WorkbookSettings ws)
        {
            Stream fis = new FileStream(file.FullName,FileMode.Open);

            // Always close down the input stream, regardless of whether or not the
            // file can be parsed.  Thanks to Steve Hahn for this
            CSharpJExcel.Jxl.Read.Biff.File dataFile = null;

            try
                {
                dataFile = new CSharpJExcel.Jxl.Read.Biff.File(fis, ws);
                }
            catch (IOException e)
                {
                throw e;
                }
            catch (BiffException e)
                {
                throw e;
                }
            finally
                {
                fis.Close();
                }

            Workbook workbook = new WorkbookParser(dataFile,ws);
            workbook.parse();

            return workbook;
        }