Esempio n. 1
0
 public Cell CreateCell(int row, int col, object value, int XFindex)
 {
     XF xf = SharedResource.ExtendedFormats[XFindex];
     CellFormat foramt = SharedResource.CellFormats[xf.FormatIndex];
     Cell cell = new Cell(value, foramt);
     cell.SharedResource = this.SharedResource;
     cell.Style = CreateStyleFromXF(xf);
     this[row, col] = cell;
     return cell;
 }
Esempio n. 2
0
        /*
         * Sunil Shenoi, 8-25-2008
         * 
         * Assuming cell has a valid string vlaue, find the font record for a given characterIndex
         * into the stringValue of the cell
         */
        public static FONT getFontForCharacter(Cell cell, UInt16 charIndex)
        {
            FONT f = null;

            int index = cell.Style.RichTextFormat.CharIndexes.BinarySearch(charIndex);
            List<UInt16> fontIndexList = cell.Style.RichTextFormat.FontIndexes;
            
            if (index >= 0)
            {
                // found the object, return the font record
                f = getFontRecord(cell.SharedResource, fontIndexList[index]);
                //Console.WriteLine("for charIndex={0}, fontIndex={1})", charIndex, fontIndexList[index]);
                //Console.WriteLine("Object: {0} found at [{1}]", o, index);
            }
            else
            {
                // would have been inserted before the returned value, so insert just before it
                if (~index == 0)
                {
                    //f = getFontRecord(sheet,fontIndexList[0]);
                    //Console.WriteLine("for charIndex={0}, fontIndex=CELL", charIndex);
                }
                else
                {
                    f = getFontRecord(cell.SharedResource, fontIndexList[(~index) - 1]);
                    //Console.WriteLine("for charIndex={0}, fontIndex={1})", charIndex, fontIndexList[(~index) - 1]);
                }
                //Console.WriteLine("Object: {0} not found. "
                //   + "Next larger object found at [{1}].", o, ~index);
            }

            return f;
        }
Esempio n. 3
0
 public void SetCell(int colIndex, Cell cell)
 {
     FirstColIndex = Math.Min(FirstColIndex, colIndex);
     LastColIndex = Math.Max(LastColIndex, colIndex);
     Cells[colIndex] = cell;
 }