/// <summary>
 /// Initializes a new instance of the <see cref="TextObjectBase"/> class with default settings.
 /// </summary>
 public TextObjectBase()
 {
     allowExpressions = true;
     brackets         = "[,]";
     padding          = new Padding(2, 0, 2, 0);
     hideValue        = "";
     nullValue        = "";
     text             = "";
     formats          = new FormatCollection();
     formats.Add(new GeneralFormat());
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextObjectBase"/> class with default settings.
 /// </summary>
 public TextObjectBase()
 {
     FAllowExpressions = true;
     FBrackets         = "[,]";
     FPadding          = new Padding(2, 0, 2, 0);
     FHideValue        = "";
     FNullValue        = "";
     FText             = "";
     FFormats          = new FormatCollection();
     FFormats.Add(new GeneralFormat());
 }
Beispiel #3
0
 public static void Add <T, TWriter>(this FormatCollection <IWriteFormat <TWriter> > formats, WriteDelegate <T, TWriter> writer)
 {
     formats.Add(new DelegateWriteFormat <T, TWriter>(writer));
 }
Beispiel #4
0
 public static void Add <T, TReader>(this FormatCollection <IReadFormat <TReader> > formats, ReadDelegate <T, TReader> reader)
 {
     formats.Add(new DelegateReadFormat <T, TReader>(reader));
 }
Beispiel #5
0
        private void Load(CompoundFile doc)
        {
            Stream stream;
            try
            {
                // see if workbook works
                stream = doc.OpenStream("Workbook");
            }
            catch (IOException)
            {
                // see if book works, if not then leak the exception
                stream = doc.OpenStream("Book");
            }

            SstRecord sst = null;
            /* long sstPos = 0; */

            // record position dictionary
            SortedList<long, Biff> records = new SortedList<long, Biff>();

            _styles = new StyleCollection(this);
            _formats = new FormatCollection(this);
            _fonts = new FontCollection(this);
            _palette = new Palette(this);
            _hyperLinks = new HyperLinkCollection(this);

            while (stream.Length - stream.Position >= GenericBiff.MinimumSize)
            {
                // capture the current stream position
                long pos = stream.Position;

                // decode the record if possible
                Biff record = GetCorrectRecord(new GenericBiff(stream), stream, sst);

                // capture 
                // shared string table 
                if (record is SstRecord)
                {
                    Debug.Assert(sst == null);
                    sst = (SstRecord)record;
                    /* sstPos = pos; */
                }
                // formatting records
                else if (record is FormatRecord)
                {
                    FormatRecord f = (FormatRecord)record;
                    _formats.Add(f.Index, new Format(this, f));
                }
                else if (record is FontRecord)
                    _fonts.Add(new Font(this, (FontRecord)record));
                else if (record is PaletteRecord)
                    _palette.Initialize((PaletteRecord)record);
                else if (record is XfRecord)
                    _styles.Add(new Style(this, (XfRecord)record));
                else if (record is HyperLinkRecord)
                    _hyperLinks.Add((HyperLinkRecord)record);

                Debug.Assert(!records.ContainsKey(pos));
                // store the position and corresponding record
                records[pos] = record;
            }

            // generate the worksheets
            _sheets = new WorksheetCollection();
            foreach (Biff record in records.Values)
            {
                if (record is BoundSheetRecord)
                    _sheets.Add(new Worksheet(this, (BoundSheetRecord)record, records));
            }
        }