예제 #1
0
        public ExCell SetSpanCell(Int32 col)
        {
            while (Cells.Count <= col)
            {
                Cells.Add(new ExCell()
                {
                    Kind = CellKind.Null
                });
            }
            ExCell cell = Cells[col];

            cell.Kind = CellKind.Span;
            return(cell);
        }
예제 #2
0
        public (ExCell Cell, Int32 Index) AddCell()
        {
            for (var i = 0; i < Cells.Count; i++)
            {
                var cell = Cells[i];
                if (cell.Kind == CellKind.Null)
                {
                    cell.Kind = CellKind.Normal;
                    return(cell, i);
                }
            }
            var newCell = new ExCell();

            Cells.Add(newCell);
            return(newCell, Cells.Count - 1);
        }
예제 #3
0
        void SetCellValue(Cell cell, ExCell exCell, ExRow exRow)
        {
            if (exCell.StyleIndex != 0)
            {
                cell.StyleIndex = exCell.StyleIndex;
            }
            if (exCell.Kind != CellKind.Normal)
            {
                return;
            }
            switch (exCell.DataType)
            {
            case DataType.String:
                cell.DataType     = new EnumValue <CellValues>(CellValues.InlineString);
                cell.InlineString = new InlineString(new Text(exCell.Value));
                break;

            case DataType.Currency:
                cell.DataType  = new EnumValue <CellValues>(CellValues.Number);
                cell.CellValue = new CellValue(exCell.Value);
                break;

            case DataType.Number:
                cell.DataType  = new EnumValue <CellValues>(CellValues.Number);
                cell.CellValue = new CellValue(exCell.Value);
                break;

            case DataType.Date:
            case DataType.DateTime:
                // DataType not needed
                cell.CellValue = new CellValue(exCell.Value);
                break;

            default:
                cell.CellValue = new CellValue(exCell.Value);
                break;
            }
        }