Exemple #1
0
		internal Style(Workbook wb, XfRecord xf) : base(wb)
		{	
			if(xf.FontIdx > 0 && xf.FontIdx < wb.Fonts.Count)
    	        _font = wb.Fonts[xf.FontIdx - 1];
		    _format = wb.Formats[xf.FormatIdx];
			_typeAndProtection = xf.TypeAndProtection;
			if(_typeAndProtection.IsCell)
				_parentStyle = wb.Styles[xf.ParentIdx];
			_horizontalAlignment = xf.HorizontalAlignment;
			_wrapped = xf.Wrapped;
			_verticalAlignment = xf.VerticalAlignment;
			_rotation = xf.Rotation;
			_indentLevel = xf.IndentLevel;
			_shrinkContent = xf.ShrinkContent;
			_parentStyleAttributes = xf.ParentStyle;
			_leftLineStyle = xf.LeftLineStyle;
			_rightLineStyle = xf.RightLineStyle;
			_topLineStyle = xf.TopLineStyle;
			_bottomLineStyle = xf.BottomLineStyle;
			_leftLineColor = wb.Palette.GetColor(xf.LeftLineColor);
			_rightLineColor = wb.Palette.GetColor(xf.RightLineColor);
			_diagonalRightTopToLeftBottom = xf.DiagonalRightTopToLeftBottom;
			_diagonalLeftBottomToTopRight = xf.DiagonalLeftBottomToTopRight;
			_topLineColor = wb.Palette.GetColor(xf.TopLineColor);
			_bottomLineColor = wb.Palette.GetColor(xf.BottomLineColor);
			_diagonalLineColor = wb.Palette.GetColor(xf.DiagonalLineColor);
			_diagonalLineStyle = xf.DiagonalLineStyle;
			_fillPattern = xf.FillPattern;
			_patternColor = wb.Palette.GetColor(xf.PatternColor);
			_patternBackground = wb.Palette.GetColor(xf.PatternBackground);
		}
        private Biff GetCorrectRecord(GenericBiff record, Stream stream, SstRecord sst)
        {
            Biff ret = record;
            switch (record.Id)
            {
                case (ushort)RecordType.Bof:
                    BofRecord bof = new BofRecord(record);
                    if (bof.Version < 0x0600)
                        throw new Exception("Versions below Excel 97/2000 are currently not supported.");

                    ret = bof;
                    break;
                case (ushort)RecordType.Boundsheet:
                    ret = new BoundSheetRecord(record);
                    break;
                case (ushort)RecordType.Index:
                    ret = new IndexRecord(record);
                    break;
                case (ushort)RecordType.DbCell:
                    ret = new DbCellRecord(record);
                    break;
                case (ushort)RecordType.Row:
                    ret = new RowRecord(record);
                    break;
                case (ushort)RecordType.Continue:
                    ret = new ContinueRecord(record);
                    break;
                case (ushort)RecordType.Blank:
                    ret = new BlankRecord(record);
                    break;
                case (ushort)RecordType.BoolErr:
                    ret = new BoolErrRecord(record);
                    break;
                case (ushort)RecordType.Formula:
                    ret = new FormulaRecord(record, stream);
                    break;
                case (ushort)RecordType.Label:
                    ret = new LabelRecord(record);
                    break;
                case (ushort)RecordType.LabelSst:
                    ret = new LabelSstRecord(record, sst);
                    break;
                case (ushort)RecordType.MulBlank:
                    ret = new MulBlankRecord(record);
                    break;
                case (ushort)RecordType.MulRk:
                    ret = new MulRkRecord(record);
                    break;
                case (ushort)RecordType.String:
                    ret = new StringValueRecord(record);
                    break;
                case (ushort)RecordType.Xf:
                    ret = new XfRecord(record);
                    break;
                case (ushort)RecordType.Rk:
                    ret = new RkRecord(record);
                    break;
                case (ushort)RecordType.Number:
                    ret = new NumberRecord(record);
                    break;
                case (ushort)RecordType.Array:
                    ret = new ArrayRecord(record);
                    break;
                case (ushort)RecordType.ShrFmla:
                    ret = new SharedFormulaRecord(record);
                    break;
                case (ushort)RecordType.Table:
                    ret = new TableRecord(record);
                    break;
                case (ushort)RecordType.Sst:
                    ret = new SstRecord(record, stream);
                    break;
                case (ushort)RecordType.Eof:
                    ret = new EofRecord(record);
                    break;
                case (ushort)RecordType.Font:
                    ret = new FontRecord(record);
                    break;
                case (ushort)RecordType.Format:
                    ret = new Net.SourceForge.Koogra.Excel.Records.FormatRecord(record);
                    break;
                case (ushort)RecordType.Palette:
                    ret = new PaletteRecord(record);
                    break;
                case (ushort)RecordType.Hyperlink:
                    ret = new HyperLinkRecord(record);
                    break;
            }

            return ret;
        }