Ejemplo n.º 1
0
 public void SetCellTypeRow(int rowIndex, ExcelTableCellType type)
 {
     for (int column = 1; column <= NumberOfColumns; column++)
     {
         ExcelTableCell cell = GetCell(rowIndex, column);
         if (cell != null)
         {
             cell.Type = type;
         }
     }
 }
Ejemplo n.º 2
0
    public object GetValue(int row, int column)
    {
        ExcelTableCell cell = GetCell(row, column);

        if (cell != null)
        {
            return(cell.Value);
        }
        else
        {
            return(SetValue(row, column, "").Value);
        }
    }
Ejemplo n.º 3
0
 public void SetCellTypeColumn(int columnIndex, ExcelTableCellType type, List <string> values = null)
 {
     for (int row = 1; row <= NumberOfRows; row++)
     {
         ExcelTableCell cell = GetCell(row, columnIndex);
         if (cell != null)
         {
             cell.Type = type;
             if (values != null)
             {
                 cell.ValueSelected = values;
             }
         }
     }
 }
Ejemplo n.º 4
0
    public static void DrawCell(ExcelTable table, int row, int column)
    {
        ExcelTableCell cell = table.GetCell(row, column);

        if (cell != null)
        {
            switch (cell.Type)
            {
            case ExcelTableCellType.TextField:
            {
                string s = EditorGUILayout.TextField(cell.Value.ToString(), GUILayout.MaxWidth(cell.width));
                cell.Value = s;
                break;
            }

            case ExcelTableCellType.Label:
            {
                EditorGUILayout.LabelField(cell.Value.ToString(), GUILayout.MaxWidth(cell.width));
                break;
            }

            case ExcelTableCellType.Popup:
            {
                int selectIndex = cell.ValueSelected.IndexOf(cell.Value);
                if (selectIndex < 0)
                {
                    selectIndex = 0;
                }
                selectIndex = EditorGUILayout.Popup(selectIndex, cell.ValueSelected.ToArray(), GUILayout.MaxWidth(cell.width));
                cell.Value  = cell.ValueSelected[selectIndex];
                break;
            }

            default:
            {
                break;
            }
            }
        }
        else
        {
            string s = EditorGUILayout.TextField(table.GetValue(row, column).ToString());
            table.SetValue(row, column, s);
        }
    }
Ejemplo n.º 5
0
    public ExcelTableCell SetValue(int row, int column, string value)
    {
        CorrectSize(row, column);
        if (!cells.ContainsKey(row))
        {
            cells [row] = new Dictionary <int, ExcelTableCell> ();
        }
        if (cells [row].ContainsKey(column))
        {
            cells [row] [column].Value = value;

            return(cells [row] [column]);
        }
        else
        {
            ExcelTableCell cell = new ExcelTableCell(row, column, value);
            cells [row] [column] = cell;
            return(cell);
        }
    }
Ejemplo n.º 6
0
    public ExcelTableCell SetValue(int row, int column, string value)
    {
        CorrectSize(row, column);
        if (!cells.ContainsKey(row))
        {
            cells[row] = new Dictionary<int, ExcelTableCell>();
        }
        if (cells[row].ContainsKey(column))
        {
            cells[row][column].Value = value;

            return cells[row][column];
        }
        else
        {
            ExcelTableCell cell = new ExcelTableCell(row, column, value);
            cells[row][column] = cell;
            return cell;
        }
    }