public SharedResource(bool newbook)
        {
            FONT fONT = new FONT();

            fONT.Height       = 200;
            fONT.OptionFlags  = 0;
            fONT.ColorIndex   = 32767;
            fONT.Weight       = 400;
            fONT.Escapement   = 0;
            fONT.Underline    = 0;
            fONT.CharacterSet = 1;
            fONT.Name         = "Arial";
            checked
            {
                for (ushort num = 0; num < 21; num += 1)
                {
                    XF xF = new XF();
                    xF.Attributes                  = 252;
                    xF.CellProtection              = 65524;
                    xF.PatternColorIndex           = 64;
                    xF.PatternBackgroundColorIndex = 130;
                    xF.FontIndex   = 0;
                    xF.FormatIndex = num;
                    this.ExtendedFormats.Add(xF);
                }
                this.MaxNumberFormatIndex = 163;
                this.GetXFIndex(CellFormat.General);
                this.SharedStringTable = new SST();
            }
        }
Example #2
0
        public SharedResource(bool newbook)
        {
            FONT font = new FONT();

            font.Height       = 200;
            font.OptionFlags  = 0;
            font.ColorIndex   = 32767;
            font.Weight       = 400;
            font.Escapement   = 0;
            font.Underline    = 0;
            font.CharacterSet = 1;
            font.Name         = "Arial";
            //Fonts.Add(font);

            for (ushort i = 0; i < 21; i++) // required by MS Excel 2003
            {
                XF xf = new XF();
                xf.Attributes                  = 252;
                xf.CellProtection              = 65524;
                xf.PatternColorIndex           = 64;
                xf.PatternBackgroundColorIndex = 130;
                xf.FontIndex   = 0;
                xf.FormatIndex = i;
                ExtendedFormats.Add(xf);
            }

            MaxNumberFormatIndex = 163;
            GetXFIndex(CellFormat.General);

            SharedStringTable = new SST();
        }
        private static EXTSST CreateEXTSST(SST sst, int sstOffset)
        {
            EXTSST extSST = new EXTSST();
            extSST.NumStrings = 8;

            int counter = 0;
            int totalLength = sstOffset + 0x0C;
            int relativeLength = 0x0C;
            foreach (string text in sst.StringList)
            {
                int stringLength = Record.GetStringDataLength(text);
                if (relativeLength + stringLength > Record.MaxContentLength + 4)
                {
                    totalLength += 4;
                    relativeLength = 4;
                }
                if (counter == 0)
                {
                    StringOffset stringOffset = new StringOffset();
                    stringOffset.AbsolutePosition = (uint)totalLength;
                    stringOffset.RelativePosition = (ushort)relativeLength;
                    extSST.Offsets.Add(stringOffset);
                }
                counter++;
                if (counter == extSST.NumStrings)
                {
                    counter = 0;
                }
                totalLength += stringLength;
                relativeLength += stringLength;
            }

            return extSST;
        }
        public SharedResource(bool newbook)
        {
            FONT font = new FONT();
            font.Height = 200;
            font.OptionFlags = 0;
            font.ColorIndex = 32767;
            font.Weight = 400;
            font.Escapement = 0;
            font.Underline = 0;
            font.CharacterSet = 1;
            font.Name = "Arial";
            //Fonts.Add(font);

            for (ushort i = 0; i < 21; i++) // required by MS Excel 2003
            {
                XF xf = new XF();
                xf.Attributes = 252;
                xf.CellProtection = 65524;
                xf.PatternColorIndex = 64;
                xf.PatternBackgroundColorIndex = 130;
                xf.FontIndex = 0;
                xf.FormatIndex = i;
                ExtendedFormats.Add(xf);
            }

            MaxNumberFormatIndex = 163;
            GetXFIndex(CellFormat.General);

            SharedStringTable = new SST();
        }
        public SharedResource(bool newbook)
        {
            for (ushort i = 0; i < 21; i++) // required by MS Excel 2003
            {
                var xf = new XF
                {
                    Attributes = 252,
                    CellProtection = 65524,
                    PatternColorIndex = 64,
                    PatternBackgroundColorIndex = 65,
                    FontIndex = 0,
                    FormatIndex = i
                };
                ExtendedFormats.Add(xf);
            }

            _maxNumberFormatIndex = 163;
            GetXFIndex(new CellFormat());

            SharedStringTable = new SST();
        }
Example #6
0
        private static EXTSST CreateEXTSST(SST sst, int sstOffset)
        {
            EXTSST eXTSST = new EXTSST();

            eXTSST.NumStrings = 8;
            int num = 0;

            checked
            {
                int num2 = sstOffset + 12;
                int num3 = 12;
                foreach (string text in sst.StringList)
                {
                    int stringDataLength = Record.GetStringDataLength(text);
                    if (num3 + stringDataLength > 8228)
                    {
                        num2 += 4;
                        num3  = 4;
                    }
                    if (num == 0)
                    {
                        StringOffset stringOffset = new StringOffset();
                        stringOffset.AbsolutePosition = (uint)num2;
                        stringOffset.RelativePosition = (ushort)num3;
                        eXTSST.Offsets.Add(stringOffset);
                    }
                    num++;
                    if (num == (int)eXTSST.NumStrings)
                    {
                        num = 0;
                    }
                    num2 += stringDataLength;
                    num3 += stringDataLength;
                }
                return(eXTSST);
            }
        }
Example #7
0
        private static EXTSST CreateEXTSST(SST sst, int sstOffset)
        {
            EXTSST extSST = new EXTSST();

            extSST.NumStrings = 8;

            int counter        = 0;
            int totalLength    = sstOffset + 0x0C;
            int relativeLength = 0x0C;

            foreach (string text in sst.StringList)
            {
                int stringLength = Record.GetStringDataLength(text);
                if (relativeLength + stringLength > Record.MaxContentLength + 4)
                {
                    totalLength   += 4;
                    relativeLength = 4;
                }
                if (counter == 0)
                {
                    StringOffset stringOffset = new StringOffset();
                    stringOffset.AbsolutePosition = (uint)totalLength;
                    stringOffset.RelativePosition = (ushort)relativeLength;
                    extSST.Offsets.Add(stringOffset);
                }
                counter++;
                if (counter == extSST.NumStrings)
                {
                    counter = 0;
                }
                totalLength    += stringLength;
                relativeLength += stringLength;
            }

            return(extSST);
        }
Example #8
0
        public static Record Read(Stream stream)
        {
            Record record = Record.ReadBase(stream);
            ushort type   = record.Type;
            Record result;

            if (type <= 146)
            {
                if (type <= 49)
                {
                    if (type <= 13)
                    {
                        if (type == 6)
                        {
                            result = new FORMULA(record);
                            return(result);
                        }
                        switch (type)
                        {
                        case 10:
                            result = new EOF(record);
                            return(result);

                        case 12:
                            result = new CALCCOUNT(record);
                            return(result);

                        case 13:
                            result = new CALCMODE(record);
                            return(result);
                        }
                    }
                    else
                    {
                        if (type == 34)
                        {
                            result = new DATEMODE(record);
                            return(result);
                        }
                        if (type == 41)
                        {
                            result = new BOTTOMMARGIN(record);
                            return(result);
                        }
                        if (type == 49)
                        {
                            result = new FONT(record);
                            return(result);
                        }
                    }
                }
                else
                {
                    if (type <= 93)
                    {
                        switch (type)
                        {
                        case 60:
                            result = new CONTINUE(record);
                            return(result);

                        case 61:
                            result = new WINDOW1(record);
                            return(result);

                        case 62:
                        case 63:
                        case 65:
                            break;

                        case 64:
                            result = new BACKUP(record);
                            return(result);

                        case 66:
                            result = new CODEPAGE(record);
                            return(result);

                        default:
                            if (type == 85)
                            {
                                result = new DEFCOLWIDTH(record);
                                return(result);
                            }
                            if (type == 93)
                            {
                                result = new OBJ(record);
                                return(result);
                            }
                            break;
                        }
                    }
                    else
                    {
                        if (type == 125)
                        {
                            result = new COLINFO(record);
                            return(result);
                        }
                        if (type == 133)
                        {
                            result = new BOUNDSHEET(record);
                            return(result);
                        }
                        if (type == 146)
                        {
                            result = new PALETTE(record);
                            return(result);
                        }
                    }
                }
            }
            else
            {
                if (type <= 237)
                {
                    if (type <= 190)
                    {
                        if (type == 153)
                        {
                            result = new STANDARDWIDTH(record);
                            return(result);
                        }
                        switch (type)
                        {
                        case 189:
                            result = new MULRK(record);
                            return(result);

                        case 190:
                            result = new MULBLANK(record);
                            return(result);
                        }
                    }
                    else
                    {
                        switch (type)
                        {
                        case 214:
                            result = new RSTRING(record);
                            return(result);

                        case 215:
                            result = new DBCELL(record);
                            return(result);

                        case 216:
                        case 217:
                            break;

                        case 218:
                            result = new BOOKBOOL(record);
                            return(result);

                        default:
                            if (type == 224)
                            {
                                result = new XF(record);
                                return(result);
                            }
                            switch (type)
                            {
                            case 233:
                                result = new BITMAP(record);
                                return(result);

                            case 235:
                                result = new MSODRAWINGGROUP(record);
                                return(result);

                            case 236:
                                result = new MSODRAWING(record);
                                return(result);

                            case 237:
                                result = new MSODRAWINGSELECTION(record);
                                return(result);
                            }
                            break;
                        }
                    }
                }
                else
                {
                    if (type <= 545)
                    {
                        switch (type)
                        {
                        case 252:
                            result = new SST(record);
                            return(result);

                        case 253:
                            result = new LABELSST(record);
                            return(result);

                        case 254:
                            break;

                        case 255:
                            result = new EXTSST(record);
                            return(result);

                        default:
                            switch (type)
                            {
                            case 512:
                                result = new DIMENSIONS(record);
                                return(result);

                            case 513:
                                result = new BLANK(record);
                                return(result);

                            case 514:
                            case 516:
                            case 518:
                                break;

                            case 515:
                                result = new NUMBER(record);
                                return(result);

                            case 517:
                                result = new BOOLERR(record);
                                return(result);

                            case 519:
                                result = new STRING(record);
                                return(result);

                            case 520:
                                result = new ROW(record);
                                return(result);

                            default:
                                if (type == 545)
                                {
                                    result = new ARRAY(record);
                                    return(result);
                                }
                                break;
                            }
                            break;
                        }
                    }
                    else
                    {
                        if (type == 638)
                        {
                            result = new RK(record);
                            return(result);
                        }
                        if (type == 1054)
                        {
                            result = new FORMAT(record);
                            return(result);
                        }
                        if (type == 2057)
                        {
                            result = new BOF(record);
                            return(result);
                        }
                    }
                }
            }
            result = record;
            return(result);
        }