Пример #1
0
        public static object GetRowValue(this IExcelContext ctx, int row, RowValueKind valueKind)
        {
            var row_ = ((ExcelContext)ctx).WS.Row(row);

            switch (valueKind)
            {
            case RowValueKind.Collapsed: return(row_.Collapsed);

            case RowValueKind.CustomHeight: return(row_.CustomHeight);

            case RowValueKind.Height: return(row_.Height);

            case RowValueKind.Hidden: return(row_.Hidden);

            case RowValueKind.Merged: return(row_.Merged);

            case RowValueKind.OutlineLevel: return(row_.OutlineLevel);

            case RowValueKind.PageBreak: return(row_.PageBreak);

            case RowValueKind.Phonetic: return(row_.Phonetic);

            case RowValueKind.StyleName: return(row_.StyleName);

            default: throw new ArgumentOutOfRangeException(nameof(valueKind));
            }
        }
Пример #2
0
        public static void RowValue(this IExcelContext ctx, int row, object value, RowValueKind valueKind)
        {
            var row_ = ((ExcelContext)ctx).WS.Row(row);

            switch (valueKind)
            {
            case RowValueKind.Collapsed: row_.Collapsed = value.CastValue <bool>(); break;

            case RowValueKind.CustomHeight: row_.CustomHeight = value.CastValue <bool>(); break;

            case RowValueKind.Height: row_.Height = value.CastValue <double>(); break;

            case RowValueKind.Hidden: row_.Hidden = value.CastValue <bool>(); break;

            case RowValueKind.Merged: row_.Merged = value.CastValue <bool>(); break;

            case RowValueKind.OutlineLevel: row_.OutlineLevel = value.CastValue <int>(); break;

            case RowValueKind.PageBreak: row_.PageBreak = value.CastValue <bool>(); break;

            case RowValueKind.Phonetic: row_.Phonetic = value.CastValue <bool>(); break;

            case RowValueKind.StyleName: row_.StyleName = value.CastValue <string>(); break;

            default: throw new ArgumentOutOfRangeException(nameof(valueKind));
            }
        }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RowValue"/> struct.
 /// </summary>
 /// <param name="row">The row.</param>
 /// <param name="value">The value.</param>
 /// <param name="valueKind">Kind of the value.</param>
 public RowValue(int row, object value, RowValueKind valueKind)
 {
     When      = When.Normal;
     Row       = row;
     ValueKind = valueKind;
     ValueType = value?.GetType();
     Value     = value?.SerializeValue(ValueType);
 }
Пример #4
0
 public RowValue(int row, object value, RowValueKind valueKind)
 {
     When      = When.Normal;
     Row       = row;
     Value     = value?.ToString();
     ValueKind = valueKind;
     ValueType = value?.GetType();
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RowValue"/> struct.
 /// </summary>
 /// <param name="row">The row.</param>
 /// <param name="value">The value.</param>
 /// <param name="valueKind">Kind of the value.</param>
 public RowValue(string row, object value, RowValueKind valueKind) : this(ExcelService.RowToInt(row), value, valueKind)
 {
 }
Пример #6
0
 public static object GetRowValue(this IExcelContext ctx, string row, RowValueKind valueKind) => GetRowValue(ctx, ExcelService.RowToInt(row), valueKind);
Пример #7
0
 public static void RowValue(this IExcelContext ctx, string row, object value, RowValueKind valueKind) => RowValue(ctx, ExcelService.RowToInt(row), value, valueKind);