Esempio n. 1
0
        /// <summary>
        /// Initializes a new XlsDocument from the provided stream, reading in as much information
        /// from the file as possible and representing it appropriately with MyXls objects
        /// (Workbook, Worksheets, Cells, etc.).
        /// </summary>
        /// <param name="stream">The stream to read into this XlsDocument.</param>
        public XlsDocument(System.IO.Stream stream)
        {
            if (stream == null)
                throw new ArgumentException("Can't be null", "stream");

            _ole2Doc = new Ole2Document();
            _ole2Doc.Load(stream);

            //TODO: SummaryInformationSection and DocumentSummaryInformationSections should be read by MyOle2
            _workbook = new Workbook(this, _ole2Doc.Streams[_ole2Doc.Streams.GetIndex(org.in2bits.MyOle2.Directory.Biff8Workbook)].Bytes, null);
        }
Esempio n. 2
0
        internal XFs(XlsDocument doc, Workbook workbook)
        {
            _doc = doc;
            _workbook = workbook;

            _xfs = new List<XF>();

            AddDefaultStyleXFs();
            AddDefaultUserXF();
            //AddDefaultFormattedStyleXFs();  //what was I thinking about here?
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the XlsDocument class.
        /// </summary>
        public XlsDocument()
        {
            _forceStandardOle2Stream = false;
            _isLittleEndian = true;

            _ole2Doc = new MyOle2.Ole2Document();
            SetOleDefaults();

            _summaryInformation = new SummaryInformationSection();
            _documentSummaryInformation = new DocumentSummaryInformationSection();

            _workbook = new Workbook(this);
        }
Esempio n. 4
0
        internal XlsDocument(string fileName, Workbook.BytesReadCallback workbookBytesReadCallback)
        {
            if (string.IsNullOrEmpty(fileName))
                throw new ArgumentException("Can't be null or Empty", "fileName");

            if (!File.Exists(fileName))
            #if SILVERLIGHT
                throw new FileNotFoundException(string.Format("Excel File not found: {0}", fileName));
            #else
                throw new FileNotFoundException("Excel File not found", fileName);
            #endif

            _ole2Doc = new Ole2Document();
            using (FileStream fileStream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                _ole2Doc.Load(fileStream);
            }

            //TODO: SummaryInformationSection and DocumentSummaryInformationSections should be read by MyOle2
            _workbook = new Workbook(this, _ole2Doc.Streams[_ole2Doc.Streams.GetIndex(org.in2bits.MyOle2.Directory.Biff8Workbook)].Bytes, workbookBytesReadCallback);
        }
Esempio n. 5
0
        internal Palette(Workbook workbook)
        {
            _workbook = workbook;

            InitDefaultPalette();
        }