/**
  * Constructor
  *
  * @param esf the external sheet record to copy
  */
 public ExternalSheetRecord(CSharpJExcel.Jxl.Read.Biff.ExternalSheetRecord esf)
     : base(Type.EXTERNSHEET)
 {
     xtis = new ArrayList(esf.getNumRecords());
     XTI xti = null;
     for (int i = 0; i < esf.getNumRecords(); i++)
         {
         xti = new XTI(esf.getSupbookIndex(i),
                       esf.getFirstTabIndex(i),
                       esf.getLastTabIndex(i));
         xtis.Add(xti);
         }
 }
Пример #2
0
        /// <summary> Constructs this object from the raw data
        ///
        /// </summary>
        /// <param name="t">the raw data
        /// </param>
        /// <param name="ws">the workbook settings
        /// </param>
        internal ExternalSheetRecord(Record t, WorkbookSettings ws) : base(t)
        {
            sbyte[] data = getRecord().Data;

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

            if (data.Length < numxtis * 6 + 2)
            {
                xtiArray = new XTI[0];
                logger.warn("Could not process external sheets.  Formulas may be compromised.");
                return;
            }

            xtiArray = new XTI[numxtis];

            int pos = 2;

            for (int i = 0; i < numxtis; i++)
            {
                int s = IntegerHelper.getInt(data[pos], data[pos + 1]);
                int f = IntegerHelper.getInt(data[pos + 2], data[pos + 3]);
                int l = IntegerHelper.getInt(data[pos + 4], data[pos + 5]);
                xtiArray[i] = new XTI(s, f, l);
                pos        += 6;
            }
        }
Пример #3
0
        private static Stack <AbstractPtg> UpdateSheetReferences(Stack <AbstractPtg> ptgStack, List <BoundSheet8> sheetRecords, ExternSheet externSheetRecord)
        {
            List <AbstractPtg> modifiedStack = new List <AbstractPtg>();

            foreach (var ptg in ptgStack)
            {
                if (ptg is PtgRef3d)
                {
                    PtgRef3d ref3d       = (ptg as PtgRef3d);
                    int      index       = ref3d.ixti;
                    XTI      relevantXti = externSheetRecord.rgXTI[index];
                    //Make sure this isn't a sheet or workbook level reference
                    if (relevantXti.itabFirst >= 0)
                    {
                        BoundSheet8 relevantSheet = sheetRecords[relevantXti.itabFirst];
                        string      sheetName     = relevantSheet.stName.Value;
                        modifiedStack.Add(new PtgRef3d(ref3d.rw, ref3d.col, ref3d.ixti, ref3d.rwRelative, ref3d.colRelative, sheetName));
                    }
                    else
                    {
                        modifiedStack.Add(ptg);
                    }
                }
                else
                {
                    modifiedStack.Add(ptg);
                }
            }
            modifiedStack.Reverse();
            return(new Stack <AbstractPtg>(modifiedStack));
        }
        /**
         * Constructs this object from the raw data
         *
         * @param t the raw data
         * @param ws the workbook settings
         */
        public ExternalSheetRecord(Record t, WorkbookSettings ws)
            : base(t)
        {
            byte[] data = getRecord().getData();

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

            if (data.Length < numxtis * 6 + 2)
                {
                xtiArray = new XTI[0];
                //logger.warn("Could not process external sheets.  Formulas may be compromised.");
                return;
                }

            xtiArray = new XTI[numxtis];

            int pos = 2;
            for (int i = 0; i < numxtis; i++)
                {
                int s = IntegerHelper.getInt(data[pos],data[pos + 1]);
                int f = IntegerHelper.getInt(data[pos + 2],data[pos + 3]);
                int l = IntegerHelper.getInt(data[pos + 4],data[pos + 5]);
                xtiArray[i] = new XTI(s,f,l);
                pos += 6;
                }
        }
Пример #5
0
        /**
         * Constructor
         *
         * @param esf the external sheet record to copy
         */
        public ExternalSheetRecord(CSharpJExcel.Jxl.Read.Biff.ExternalSheetRecord esf)
            : base(Type.EXTERNSHEET)
        {
            xtis = new ArrayList(esf.getNumRecords());
            XTI xti = null;

            for (int i = 0; i < esf.getNumRecords(); i++)
            {
                xti = new XTI(esf.getSupbookIndex(i),
                              esf.getFirstTabIndex(i),
                              esf.getLastTabIndex(i));
                xtis.Add(xti);
            }
        }
Пример #6
0
        /**
         * Gets the extern sheet index for the specified parameters, creating
         * a new xti record if necessary
         * @param supbookind the internal supbook reference
         * @param sheetind the sheet index
         */
        public int getIndex(int supbookind, int sheetind)
        {
            int pos = 0;

            foreach (XTI xti in xtis)
            {
                if (xti.supbookIndex == supbookind && xti.firstTab == sheetind)
                {
                    return(pos);
                }
                else
                {
                    pos++;
                }
            }

            XTI newXti = new XTI(supbookind, sheetind, sheetind);

            xtis.Add(newXti);
            pos = xtis.Count - 1;

            return(pos);
        }
        /**
         * Gets the extern sheet index for the specified parameters, creating
         * a new xti record if necessary
         * @param supbookind the internal supbook reference
         * @param sheetind the sheet index
         */
        public int getIndex(int supbookind, int sheetind)
        {
            int pos = 0;
            foreach (XTI xti in xtis)
                {
                if (xti.supbookIndex == supbookind && xti.firstTab == sheetind)
                    return pos;
                else
                    pos++;
                }

            XTI newXti = new XTI(supbookind, sheetind, sheetind);
            xtis.Add(newXti);
            pos = xtis.Count - 1;

            return pos;
        }