Example #1
0
        /// <summary> Constructs this object from the raw data.  Used when reading in a
        /// format record
        ///
        /// </summary>
        /// <param name="t">the raw data
        /// </param>
        /// <param name="ws">the workbook settings
        /// </param>
        /// <param name="dummy">dummy overload
        /// </param>
        public FontRecord(Record t, WorkbookSettings ws, Biff7 dummy) : base(t)
        {
            sbyte[] data = getRecord().Data;

            pointHeight    = IntegerHelper.getInt(data[0], data[1]) / EXCEL_UNITS_PER_POINT;
            colourIndex    = IntegerHelper.getInt(data[4], data[5]);
            boldWeight     = IntegerHelper.getInt(data[6], data[7]);
            scriptStyle    = IntegerHelper.getInt(data[8], data[9]);
            underlineStyle = data[10];
            fontFamily     = data[11];
            initialized    = false;

            if ((data[2] & 0x02) != 0)
            {
                italic = true;
            }

            if ((data[2] & 0x08) != 0)
            {
                struckout = true;
            }

            int numChars = data[14];

            name = StringHelper.getString(data, numChars, 15, ws);
        }
        /**
         * Constructs this object from the raw data
         *
         * @param t the raw data
         * @param fr the formatting records
         * @param si the sheet
         * @param ws the workbook settings
         * @param dummy dummy overload to indicate a biff 7 workbook
         */
        public RStringRecord(Record t,FormattingRecords fr,SheetImpl si,WorkbookSettings ws,Biff7 dummy)
            : base(t,fr,si)
        {
            byte[] data = getRecord().getData();
            length = IntegerHelper.getInt(data[6],data[7]);

            description = StringHelper.getString(data,length,8,ws);
        }
Example #3
0
 /// <summary> Constructs this object from the raw data
 ///
 /// </summary>
 /// <param name="t">the raw data
 /// </param>
 /// <param name="biff7">a dummy value to tell the record to interpret the
 /// data as biff7
 /// </param>
 public BoundsheetRecord(Record t, Biff7 biff7) : base(t)
 {
     sbyte[] data = getRecord().Data;
     offset         = IntegerHelper.getInt(data[0], data[1], data[2], data[3]);
     typeFlag       = data[5];
     visibilityFlag = data[4];
     length         = data[6];
     sbyte[] bytes = new sbyte[length];
     Array.Copy(data, 7, bytes, 0, length);
     name = new string(NExcelUtils.Byte.ToCharArray(NExcelUtils.Byte.ToByteArray(bytes)));
 }
Example #4
0
        /**
         * Constructs this object from the raw data
         *
         * @param t the raw data
         * @param biff7 a dummy value to tell the record to interpret the
         *              data as biff7
         */
        public BoundsheetRecord(Record t, Biff7 biff7)
            : base(t)
        {
            byte[] data = getRecord().getData();
            offset         = IntegerHelper.getInt(data[0], data[1], data[2], data[3]);
            typeFlag       = data[5];
            visibilityFlag = data[4];
            length         = data[6];
// TODO: CML -- is this a standard ASCII string?
//			name = new string(bytes);
            name = StringHelper.getUTF8String(data, length, 7);
        }
Example #5
0
        /// <summary> Constructs this object from the raw data
        ///
        /// </summary>
        /// <param name="t">the record data
        /// </param>
        /// <param name="ws">the workbook settings
        /// </param>
        /// <param name="dummy">dummy record to indicate a biff7 document
        /// </param>
        internal HeaderRecord(Record t, WorkbookSettings ws, Biff7 dummy) : base(t)
        {
            sbyte[] data = getRecord().Data;

            if (data.Length == 0)
            {
                return;
            }

            int chars = data[0];

            header = StringHelper.getString(data, chars, 1, ws);
        }
 /**
  * Constructs the dimensions from the raw data
  *
  * @param t the raw data
  * @param biff7 an indicator to initialise this record for biff 7 format
  */
 public HorizontalPageBreaksRecord(Record t,Biff7 biff7)
     : base(t)
 {
     byte[] data = t.getData();
     int numbreaks = IntegerHelper.getInt(data[0],data[1]);
     int pos = 2;
     rowBreaks = new int[numbreaks];
     for (int i = 0; i < numbreaks; i++)
         {
         rowBreaks[i] = IntegerHelper.getInt(data[pos],data[pos + 1]);
         pos += 2;
         }
 }
        /**
         * Constructs the dimensions from the raw data
         *
         * @param t the raw data
         * @param biff7 an indicator to initialise this record for biff 7 format
         */
        public VerticalPageBreaksRecord(Record t, Biff7 biff7)
            : base(t)
        {
            byte[] data      = t.getData();
            int    numbreaks = IntegerHelper.getInt(data[0], data[1]);
            int    pos       = 2;

            columnBreaks = new int[numbreaks];
            for (int i = 0; i < numbreaks; i++)
            {
                columnBreaks[i] = IntegerHelper.getInt(data[pos], data[pos + 1]);
                pos            += 2;
            }
        }
Example #8
0
        /// <summary> Constructs the dimensions from the raw data
        ///
        /// </summary>
        /// <param name="t">the raw data
        /// </param>
        /// <param name="biff7">an indicator to initialise this record for biff 7 format
        /// </param>
        public HorizontalPageBreaksRecord(Record t, Biff7 biff7) : base(t)
        {
            sbyte[] data      = t.Data;
            int     numbreaks = IntegerHelper.getInt(data[0], data[1]);
            int     pos       = 2;

            rowBreaks = new int[numbreaks];

            for (int i = 0; i < numbreaks; i++)
            {
                pos         += 2;
                rowBreaks[i] = IntegerHelper.getInt(data[pos], data[pos + 1]);
            }
        }
Example #9
0
        /**
         * Constructs the dimensions from the raw data.  Dummy overload for
         * biff7 workbooks
         *
         * @param t the raw data
         * @param dummy the overload
         */
        public Window2Record(Record t, Biff7 biff7)
            : base(t)
        {
            byte[] data = t.getData();

            int options = IntegerHelper.getInt(data[0], data[1]);

            selected             = ((options & 0x200) != 0);
            showGridLines        = ((options & 0x02) != 0);
            frozenPanes          = ((options & 0x08) != 0);
            displayZeroValues    = ((options & 0x10) != 0);
            frozenNotSplit       = ((options & 0x100) != 0);
            pageBreakPreviewMode = ((options & 0x800) != 0);
        }
Example #10
0
        /**
         * Constructs this object from the raw data
         *
         * @param t the record data
         * @param ws the workbook settings
         * @param dummy dummy record to indicate a biff7 document
         */
        public FooterRecord(Record t, WorkbookSettings ws, Biff7 dummy)
            : base(t)
        {
            byte[] data = getRecord().getData();

            if (data.Length == 0)
            {
                return;
            }

            int chars = data[0];

            footer = StringHelper.getString(data, chars, 1, ws);
        }
Example #11
0
 /**
  * Constructs this object from the raw data in biff 7 format.
  * Does nothing here
  *
  * @param t the raw data
  * @param settings the workbook settings
  * @param dummy dummy override to identify biff7 funcionality
  */
 public ExternalSheetRecord(Record t, WorkbookSettings settings, Biff7 dummy)
     : base(t)
 {
     //logger.warn("External sheet record for Biff 7 not supported");
 }
 /**
  * Constructs the dimensions from the raw data
  *
  * @param t the raw data
  * @param biff7 an indicator to initialise this record for biff 7 format
  */
 public DimensionRecord(Record t,Biff7 biff7)
     : base(t)
 {
     byte[] data = t.getData();
     read10ByteData(data);
 }
Example #13
0
 static RStringRecord()
 {
     biff7 = new Biff7();
 }
Example #14
0
        /// <summary> Constructs this object from the raw data
        ///
        /// </summary>
        /// <param name="t">the raw data
        /// </param>
        /// <param name="fr">the formatting records
        /// </param>
        /// <param name="si">the sheet
        /// </param>
        /// <param name="ws">the workbook settings
        /// </param>
        /// <param name="dummy">dummy overload to indicate a biff 7 workbook
        /// </param>
        public RStringRecord(Record t, FormattingRecords fr, SheetImpl si, WorkbookSettings ws, Biff7 dummy) : base(t, fr, si)
        {
            sbyte[] data = getRecord().Data;
            length = IntegerHelper.getInt(data[6], data[7]);

            _Value = StringHelper.getString(data, length, 8, ws);
        }
Example #15
0
 static HeaderRecord()
 {
     logger = Logger.getLogger(typeof(HeaderRecord));
     biff7  = new Biff7();
 }
 /**
  * Constructs this object from the raw data
  *
  * @param t the raw data
  * @param biff7 a dummy value to tell the record to interpret the
  *              data as biff7
  */
 public BoundsheetRecord(Record t,Biff7 biff7)
     : base(t)
 {
     byte[] data = getRecord().getData();
     offset = IntegerHelper.getInt(data[0],data[1],data[2],data[3]);
     typeFlag = data[5];
     visibilityFlag = data[4];
     length = data[6];
     // TODO: CML -- is this a standard ASCII string?
     //			name = new string(bytes);
     name = StringHelper.getUTF8String(data, length, 7);
 }
Example #17
0
        /// <summary> Constructs this object from the raw data
        ///
        /// </summary>
        /// <param name="t">the raw data
        /// </param>
        /// <param name="ws">the workbook settings
        /// </param>
        /// <param name="ind">the index in the name table
        /// </param>
        /// <param name="dummy">dummy parameter to indicate a biff7 workbook
        /// </param>
        internal NameRecord(Record t, WorkbookSettings ws, int ind, Biff7 dummy) : base(t)
        {
            index = ind;
            try
            {
                ranges = new ArrayList();
                sbyte[] data   = getRecord().Data;
                int     length = data[3];
                name = StringHelper.getString(data, length, 14, ws);

                int pos = length + 14;

                if (pos >= data.Length)
                {
                    // There appears to be nothing after the name, so return
                    return;
                }

                if (data[pos] == cellReference)
                {
                    int sheet  = IntegerHelper.getInt(data[pos + 11], data[pos + 12]);
                    int row    = IntegerHelper.getInt(data[pos + 15], data[pos + 16]);
                    int column = data[pos + 17];

                    NameRange r = new NameRange(this, sheet, column, row, column, row);
                    ranges.Add(r);
                }
                else if (data[pos] == areaReference)
                {
                    int sheet1 = 0;
                    int sheet2 = 0;
                    int r1     = 0;
                    //        int columnMask = 0;
                    int       c1    = 0;
                    int       r2    = 0;
                    int       c2    = 0;
                    NameRange range = null;

                    while (pos < data.Length)
                    {
                        sheet1 = IntegerHelper.getInt(data[pos + 11], data[pos + 12]);
                        sheet2 = IntegerHelper.getInt(data[pos + 13], data[pos + 14]);
                        r1     = IntegerHelper.getInt(data[pos + 15], data[pos + 16]);
                        r2     = IntegerHelper.getInt(data[pos + 17], data[pos + 18]);

                        c1 = data[pos + 19];
                        c2 = data[pos + 20];

                        range = new NameRange(this, sheet1, c1, r1, c2, r2);
                        ranges.Add(range);

                        pos += 21;
                    }
                }
                else if (data[pos] == subExpression)
                {
                    int sheet1 = 0;
                    int sheet2 = 0;
                    int r1     = 0;
                    //        int columnMask = 0;
                    int       c1    = 0;
                    int       r2    = 0;
                    int       c2    = 0;
                    NameRange range = null;

                    // Consume unnecessary parsed tokens
                    if (pos < data.Length && data[pos] != cellReference && data[pos] != areaReference)
                    {
                        if (data[pos] == subExpression)
                        {
                            pos += 3;
                        }
                        else if (data[pos] == union)
                        {
                            pos += 1;
                        }
                    }

                    while (pos < data.Length)
                    {
                        sheet1 = IntegerHelper.getInt(data[pos + 11], data[pos + 12]);
                        sheet2 = IntegerHelper.getInt(data[pos + 13], data[pos + 14]);
                        r1     = IntegerHelper.getInt(data[pos + 15], data[pos + 16]);
                        r2     = IntegerHelper.getInt(data[pos + 17], data[pos + 18]);

                        c1 = data[pos + 19];
                        c2 = data[pos + 20];

                        range = new NameRange(this, sheet1, c1, r1, c2, r2);
                        ranges.Add(range);

                        pos += 21;

                        // Consume unnecessary parsed tokens
                        if (pos < data.Length && data[pos] != cellReference && data[pos] != areaReference)
                        {
                            if (data[pos] == subExpression)
                            {
                                pos += 3;
                            }
                            else if (data[pos] == union)
                            {
                                pos += 1;
                            }
                        }
                    }
                }
            }
            catch (System.Exception t1)
            {
                // Generate a warning
                // Names are really a nice to have, and we don't want to halt the
                // reading process for functionality that probably won't be used
                logger.warn("Cannot read name.");
                name = "ERROR";
            }
        }
Example #18
0
 static HorizontalPageBreaksRecord()
 {
     biff7 = new Biff7();
 }
 /**
  * Constructs this object from the raw data in biff 7 format.
  * Does nothing here
  *
  * @param t the raw data
  * @param settings the workbook settings
  * @param dummy dummy override to identify biff7 funcionality
  */
 public ExternalSheetRecord(Record t, WorkbookSettings settings, Biff7 dummy)
     : base(t)
 {
     //logger.warn("External sheet record for Biff 7 not supported");
 }
Example #20
0
 /// <summary> Constructs the dimensions from the raw data
 ///
 /// </summary>
 /// <param name="t">the raw data
 /// </param>
 /// <param name="biff7">an indicator to initialise this record for biff 7 format
 /// </param>
 public DimensionRecord(Record t, Biff7 biff7) : base(t)
 {
     sbyte[] data = t.Data;
     read10ByteData(data);
 }
Example #21
0
 static DimensionRecord()
 {
     biff7 = new Biff7();
 }
        /**
         * Constructs the dimensions from the raw data.  Dummy overload for
         * biff7 workbooks
         *
         * @param t the raw data
         * @param dummy the overload
         */
        public Window2Record(Record t,Biff7 biff7)
            : base(t)
        {
            byte[] data = t.getData();

            int options = IntegerHelper.getInt(data[0],data[1]);

            selected = ((options & 0x200) != 0);
            showGridLines = ((options & 0x02) != 0);
            frozenPanes = ((options & 0x08) != 0);
            displayZeroValues = ((options & 0x10) != 0);
            frozenNotSplit = ((options & 0x100) != 0);
            pageBreakPreviewMode = ((options & 0x800) != 0);
        }
Example #23
0
 static FooterRecord()
 {
     biff7 = new Biff7();
 }
Example #24
0
 /// <summary> Constructs this object from the raw data in biff 7 format.
 /// Does nothing here
 ///
 /// </summary>
 /// <param name="t">the raw data
 /// </param>
 /// <param name="settings">the workbook settings
 /// </param>
 /// <param name="dummy">dummy override to identify biff7 funcionality
 /// </param>
 internal ExternalSheetRecord(Record t, WorkbookSettings settings, Biff7 dummy) : base(t)
 {
 }
Example #25
0
 static NameRecord()
 {
     logger = Logger.getLogger(typeof(NameRecord));
     biff7  = new Biff7();
 }
Example #26
0
 static ExternalSheetRecord()
 {
     logger = Logger.getLogger(typeof(ExternalSheetRecord));
     biff7  = new Biff7();
 }
Example #27
0
 static LabelRecord()
 {
     biff7 = new Biff7();
 }
Example #28
0
 static BoundsheetRecord()
 {
     biff7 = new Biff7();
 }
Example #29
0
        /**
         * Constructs this object from the raw data
         *
         * @param t the raw data
         * @param fr the formatting records
         * @param si the sheet
         * @param ws the workbook settings
         * @param dummy dummy overload to indicate a biff 7 workbook
         */
        public LabelRecord(Record t, FormattingRecords fr, SheetImpl si, WorkbookSettings ws, Biff7 dummy)
            : base(t, fr, si)
        {
            byte[] data = getRecord().getData();
            length = IntegerHelper.getInt(data[6], data[7]);

            description = StringHelper.getString(data, length, 8, ws);
        }
        /**
         * Constructs this object from the raw data.  Used when reading in a
         * format record
         *
         * @param t the raw data
         * @param ws the workbook settings
         * @param dummy dummy overload
         */
        public FontRecord(Record t,WorkbookSettings ws,Biff7 dummy)
            : base(t)
        {
            byte[] data = getRecord().getData();

            pointHeight = IntegerHelper.getInt(data[0],data[1]) / EXCEL_UNITS_PER_POINT;
            colourIndex = IntegerHelper.getInt(data[4],data[5]);
            boldWeight = IntegerHelper.getInt(data[6],data[7]);
            scriptStyle = IntegerHelper.getInt(data[8],data[9]);
            underlineStyle = data[10];
            fontFamily = data[11];
            initialized = false;

            if ((data[2] & 0x02) != 0)
                italic = true;

            if ((data[2] & 0x08) != 0)
                struckout = true;

            int numChars = data[14];
            name = StringHelper.getString(data,numChars,15,ws);
        }
        /**
         * Constructs this object from the raw data
         *
         * @param t the raw data
         * @param ws the workbook settings
         * @param ind the index in the name table
         * @param dummy dummy parameter to indicate a biff7 workbook
         */
        public NameRecord(Record t,WorkbookSettings ws,int ind,Biff7 dummy)
            : base(t)
        {
            index = ind;
            isbiff8 = false;

            try
                {
                ranges = new ArrayList();
                byte[] data = getRecord().getData();
                int length = data[3];
                sheetRef = IntegerHelper.getInt(data[8],data[9]);
                name = StringHelper.getString(data,length,14,ws);

                int pos = length + 14;

                if (pos >= data.Length)
                    {
                    // There appears to be nothing after the name, so return
                    return;
                    }

                if (data[pos] == cellReference)
                    {
                    int sheet = IntegerHelper.getInt(data[pos + 11],data[pos + 12]);
                    int row = IntegerHelper.getInt(data[pos + 15],data[pos + 16]);
                    int column = data[pos + 17];

                    NameRange r = new NameRange(sheet,column,row,column,row);
                    ranges.Add(r);
                    }
                else if (data[pos] == areaReference)
                    {
                    int sheet1 = 0;
                    int r1 = 0;
                    int c1 = 0;
                    int r2 = 0;
                    int c2 = 0;
                    NameRange range = null;

                    while (pos < data.Length)
                        {
                        sheet1 = IntegerHelper.getInt(data[pos + 11],data[pos + 12]);
                        r1 = IntegerHelper.getInt(data[pos + 15],data[pos + 16]);
                        r2 = IntegerHelper.getInt(data[pos + 17],data[pos + 18]);

                        c1 = data[pos + 19];
                        c2 = data[pos + 20];

                        range = new NameRange(sheet1,c1,r1,c2,r2);
                        ranges.Add(range);

                        pos += 21;
                        }
                    }
                else if (data[pos] == subExpression)
                    {
                    int sheet1 = 0;
            //					int sheet2 = 0;
                    int r1 = 0;
                    int c1 = 0;
                    int r2 = 0;
                    int c2 = 0;
                    NameRange range = null;

                    // Consume unnecessary parsed tokens
                    if (pos < data.Length &&
                        data[pos] != cellReference &&
                        data[pos] != areaReference)
                        {
                        if (data[pos] == subExpression)
                            pos += 3;
                        else if (data[pos] == union)
                            pos += 1;
                        }

                    while (pos < data.Length)
                        {
                        sheet1 = IntegerHelper.getInt(data[pos + 11],data[pos + 12]);
                        r1 = IntegerHelper.getInt(data[pos + 15],data[pos + 16]);
                        r2 = IntegerHelper.getInt(data[pos + 17],data[pos + 18]);

                        c1 = data[pos + 19];
                        c2 = data[pos + 20];

                        range = new NameRange(sheet1,c1,r1,c2,r2);
                        ranges.Add(range);

                        pos += 21;

                        // Consume unnecessary parsed tokens
                        if (pos < data.Length &&
                            data[pos] != cellReference &&
                            data[pos] != areaReference)
                            {
                            if (data[pos] == subExpression)
                                pos += 3;
                            else if (data[pos] == union)
                                pos += 1;
                            }
                        }
                    }
                }
            catch (Exception t1)
                {
                // Generate a warning
                // Names are really a nice to have, and we don't want to halt the
                // reading process for functionality that probably won't be used
                //logger.warn("Cannot read name.");
                name = "ERROR";
                }
        }
        /**
         * Constructs this object from the raw data
         *
         * @param t the record data
         * @param ws the workbook settings
         * @param dummy dummy record to indicate a biff7 document
         */
        public FooterRecord(Record t,WorkbookSettings ws,Biff7 dummy)
            : base(t)
        {
            byte[] data = getRecord().getData();

            if (data.Length == 0)
                {
                return;
                }

            int chars = data[0];
            footer = StringHelper.getString(data,chars,1,ws);
        }