• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ICell类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ICell的典型用法代码示例。如果您正苦于以下问题:C# ICell类的具体用法?C# ICell怎么用?C# ICell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ICell类属于命名空间,在下文中一共展示了ICell类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateCell

 Cell CreateCell(ICell cell)
 {
     string value = null;
     switch (cell.CellType)
     {
         case CellType.STRING:
             value = cell.StringCellValue;
             break;
         case CellType.NUMERIC:
             value = cell.NumericCellValue.ToString();
             break;
         case CellType.FORMULA:
             switch (cell.CachedFormulaResultType)
             {
                 case CellType.STRING:
                     value = cell.StringCellValue;
                     break;
                 case CellType.NUMERIC:
                     //excel trigger is probably out-of-date
                     value = (cell.CellFormula == "TODAY()" ? DateTime.Today.ToOADate() : cell.NumericCellValue).ToString();
                     break;
             }
             break;
     }
     return new Cell(cell.RowIndex, cell.ColumnIndex, value);
 }
开发者ID:kellyselden,项目名称:Libraries,代码行数:26,代码来源:ExcelService.cs


示例2: SetCellValue

        private static void SetCellValue(HSSFWorkbook workbook, ICell workCell, Type type, dynamic row, Cell cell)
        {
            var value = type.GetProperty(cell.Field).GetValue(row);
            if (value == null)
            {
                return;
            }

            if (value is DateTime)
            {
                workCell.SetCellValue((DateTime)value);
            }
            else if (value is int)
            {
                workCell.SetCellValue((int)value);
            }
            else if (value is double)
            {
                workCell.SetCellValue((double)value);
            }
            else
            {
                workCell.SetCellValue(value.ToString());
            }

            if (!string.IsNullOrWhiteSpace(cell.Format))
            {
                var cellStyle = workbook.CreateCellStyle();
                var format = workbook.CreateDataFormat();
                cellStyle.DataFormat = format.GetFormat(cell.Format);
                workCell.CellStyle = cellStyle;
            }
        }
开发者ID:ErikXu,项目名称:CommonLibrary,代码行数:33,代码来源:ExcelUtil.cs


示例3: Equals

 /// <summary>
 ///     Compare cell objects
 /// </summary>
 /// <param name="other"> </param>
 /// <returns> </returns>
 public bool Equals(ICell other)
 {
     if (other == null) return false;
     if (other.Alive != Alive) return false;
     if (!other.Position.Equals(Position)) return false;
     return true;
 }
开发者ID:agamya,项目名称:GameOfLife,代码行数:12,代码来源:Cell.cs


示例4: GetCellValue

 /// <summary>
 /// 根据Excel列类型获取列的值
 /// </summary>
 /// <param name="cell">Excel列</param>
 /// <returns></returns>
 private static string GetCellValue(ICell cell)
 {
     if (cell == null)
         return string.Empty;
     switch (cell.CellType)
     {
         case CellType.BLANK:
             return string.Empty;
         case CellType.BOOLEAN:
             return cell.BooleanCellValue.ToString();
         case CellType.ERROR:
             return cell.ErrorCellValue.ToString();
         case CellType.NUMERIC:
         case CellType.Unknown:
         default:
             return cell.ToString();//This is a trick to get the correct value of the cell. NumericCellValue will return a numeric value no matter the cell value is a date or a number
         case CellType.STRING:
             return cell.StringCellValue;
         case CellType.FORMULA:
             try
             {
                 HSSFFormulaEvaluator e = new HSSFFormulaEvaluator(cell.Sheet.Workbook);
                 e.EvaluateInCell(cell);
                 return cell.ToString();
             }
             catch
             {
                 return cell.NumericCellValue.ToString();
             } 
     }
 }
开发者ID:cityjoy,项目名称:Portal.MVC,代码行数:36,代码来源:ExcelRender.cs


示例5: SetMemberValue

        private void SetMemberValue(string member, ICell cell, TextWriter log)
        {
            var info = GetType().GetProperty(member);
            if (info == null)
            {
                log.WriteLine("Property {0} is not defined in {1}", member, GetType().Name);
                return;
            }

            if(info.PropertyType != typeof(string))
                throw new NotImplementedException("This function was only designed to work for string properties.");

            string value = null;
            switch (cell.CellType)
            {
                case CellType.Numeric:
                    value = cell.NumericCellValue.ToString(CultureInfo.InvariantCulture);
                    break;
                case CellType.String:
                    value = cell.StringCellValue;
                    break;
                case CellType.Boolean:
                    value = cell.BooleanCellValue.ToString();
                    break;
                default:
                    log.WriteLine("There is no suitable value for {0} in cell {1}{2}, sheet {3}",
                        info.Name, CellReference.ConvertNumToColString(cell.ColumnIndex), cell.RowIndex + 1,
                        cell.Sheet.SheetName);
                    break;
            }
            info.SetValue(this, value);
        }
开发者ID:McLeanBH,项目名称:XbimExchange,代码行数:32,代码来源:Metadata.cs


示例6: RuInterferenceVictim

 public RuInterferenceVictim(ICell cell)
 {
     CellId = cell.CellId;
     SectorId = cell.SectorId;
     MeasuredTimes = 0;
     InterferenceTimes = 0;
 }
开发者ID:ouyh18,项目名称:LteTools,代码行数:7,代码来源:RuInterferenceVictim.cs


示例7: ProcessTest

 public IEnumerable<ICell> ProcessTest(
     [PexAssumeUnderTest]global::PathfindingAlgorithms.Algorithms.Astar.Astar target,
     ICell[,] cells,
     Coordinates from,
     Coordinates to
     )
 {
     PexAssume.IsNotNull(cells);
     PexAssume.IsTrue(cells.GetLength(0)* cells.GetLength(1) > 0);
     PexAssume.IsTrue(from.Inside(new Coordinates(cells.GetLength(0) - 1, cells.GetLength(1) - 1)));
     PexAssume.IsTrue(to.Inside(new Coordinates(cells.GetLength(0) - 1, cells.GetLength(1) - 1)));
     PexAssume.IsTrue(cells.GetLowerBound(0) == 0);
     PexAssume.IsTrue(cells.GetLowerBound(1) == 0);
     bool f = true;
     for (int x = cells.GetLowerBound(0); x <= cells.GetUpperBound(0); x++)
     {
         for (int y = cells.GetLowerBound(1); y <= cells.GetUpperBound(1); y++)
         {
             PexAssume.IsNotNull(cells[x, y]);
             PexAssume.IsNotNull(cells[x, y].Coordinates);
             f &= cells[x, y].Coordinates.Equals(new Coordinates(x, y));
         }
     }
     PexAssume.IsTrue(f);
     IEnumerable<ICell> result = target.Process(cells, from, to);
     return result;
     // TODO: добавление проверочных утверждений в метод AstarTest.ProcessTest(Astar, ICell[,], Coordinates, Coordinates)
 }
开发者ID:iu7-12-dbg,项目名称:t08-lab01,代码行数:28,代码来源:AstarTest.cs


示例8: SwapLookup

        private void SwapLookup(ICell cell)
        {
#pragma warning disable 0420
            //Ok to ignore CS0420 "a reference to a volatile field will not be treated as volatile" for interlocked calls http://msdn.microsoft.com/en-us/library/4bw5ewxy(VS.80).aspx
            Interlocked.Exchange(ref _lookup_DoNotCallMeDirectly, cell);
#pragma warning restore 0420
        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:7,代码来源:RepointableActorRef.cs


示例9: Evaluate

        public virtual bool Evaluate(ICell cell, ICellContext context)
        {
            bool evaluated = false;
            Parallel.ForEach<IRule>(Rules, r => { evaluated |= r.Evaluate(cell, context); });

            return evaluated;
        }
开发者ID:cthibault,项目名称:Life,代码行数:7,代码来源:RulesManager.cs


示例10: CalculateInterfernece

        protected override double CalculateInterfernece(ICell[] position)
        {
            double totalInterference = 0;
            foreach (ICellRelation cellRelation in InterferenceMatrix)
            {
                ICell cell = position[cellRelation.CellIndex[0]];
                ICell interferingCell = position[cellRelation.CellIndex[1]];
                double interference = 0;
                for (int i = 0; i < interferingCell.Frequencies.Length; i++)
                {
                    for (int j = 0; j < cell.Frequencies.Length; j++)
                    {
                        int frequencyA = channels[interferingCell.Frequencies[i].Value];
                        int frequencyB = channels[cell.Frequencies[j].Value];
                        double trxInf = 0;
                        if (SameFrequency(frequencyA, frequencyB))
                        {
                            trxInf = ZeroIfOusideInterferneceThreshold(cellRelation.DA[0]);
                            interference += trxInf;
                        }
                        else if (base.FrequenciesDifferByOne(frequencyA, frequencyB))
                        {
                            trxInf = ZeroIfOusideInterferneceThreshold(cellRelation.DA[1]);
                            interference += trxInf;
                        }
                        cell.FrequencyHandler.SetSingleTrxInterference(j, trxInf);
                    }
                    //cell.Interference += interference;
                }
                cell.Interference += interference;
                totalInterference += interference;

            }
            return totalInterference;
        }
开发者ID:Burmudar,项目名称:PSOMastersDissertation,代码行数:35,代码来源:FAPIndexCostFunction.cs


示例11: Move

        public Direction Move(ICell cell)
        {
            /*
            Add current cell as visited
            Get possible directions
            Get all neighbouring cells that haven't been visited
            If found
                randomly choose one
                push it onto stack
                add to visited
                set as current position
                return cell
            If not that means dead end
                pop next cell from stack
                if no more cells that means we're at the start again and maze is not solvable
                else
                add to visited (should already be there but HashSet means it doesn't matter if it is added again)
                set as current position
                return cell
            */

            var random = new Random(DateTime.Now.Millisecond);
            visited.Add(cell);
            stack.Push(cell);
            var possibleDirections = GetPossibleDirections(cell);
            if (possibleDirections.Any()) return possibleDirections[random.Next(possibleDirections.Count)];

            if (stack.Count <= 0) return Direction.None; // We're back at the start and the maze is not solvable

            // Backtrack
            var previousCell = stack.Pop();
            visited.Add(previousCell);
            return GetDirection(cell, previousCell);
        }
开发者ID:LeedsSharp,项目名称:MazeSharp,代码行数:34,代码来源:DepthFirstSearch.cs


示例12: Mutate

        /// <summary>
        /// Perform a single point crossover.
        /// </summary>
        public static void Mutate(ICell cell)
        {
            if (cell == null) throw new ArgumentNullException("cell");

            // Iterate the tags and the resources within the tags
            for (int i = 0; i < cell.ActiveTagsInModel; i++)
            {
                // Potentially modify existing tag resources
                Tag activeTag = cell.GetTagByIndex(i);
                for (int j = 0; j < activeTag.Data.Count; j++)
                {
                    if (ShouldMutateThisPoint())
                    {
                        activeTag.Data[j] = Resource.Random(true);
                    }
                }

                // Potentially add a resource
                if (activeTag.Data.Count < Tag.MaxSize && ShouldMutateThisPoint())
                {
                    int insertionIndex = RandomProvider.Next(0, activeTag.Data.Count);
                    activeTag.Data.Insert(insertionIndex, Resource.Random(true));
                }

                // Potentially remove a resource
                if (activeTag.Data.Count > 2 && ShouldMutateThisPoint())
                {
                    activeTag.Data.RemoveRandom();
                }
            }
        }
开发者ID:andrewanderson,项目名称:Web-Critters,代码行数:34,代码来源:PointMutation.cs


示例13: Cell

        public Cell(ICell cell, Grid parent, Point p)
        {
            _cell = cell;
            var values = new List<int>();

            if (IsDefined)
            {
                var value = (int) (cell.Value);
                Result = value.ToString(CultureInfo.InvariantCulture);
                ResultColor = _cellColors[value - 1];
            }
            else
            {
                foreach (var value in _allNumericValues)
                {
                    if (cell.MayHaveValue(value))
                    {
                        values.Add((int) value);
                    }
                }

                Values =
                    Enumerable.Range(1, Width)
                              .ToList()
                              .Select(
                                  value =>
                                  Tuple.Create(value, new RelayCommand(() => parent.ValueChoosen(value, p)),
                                               values.Contains(value), _cellColors[value - 1]));
                Result = "?";
            }
        }
开发者ID:WinstonSmith77,项目名称:Sudoku,代码行数:31,代码来源:Cell.cs


示例14: Player

 /// <summary>
 /// Constructor with 2 parameters
 /// </summary>
 /// <param name="name">String that represents the name of the player</param>
 /// <param name="cell">Object of type ICell that represents the current position of the player</param>
 public Player(string name, ICell cell)
 {
     this.MovesCount = 0;
     this.Name = name;
     this.CurentCell = cell;
     this.StartPosition = cell.Position;
 }
开发者ID:HQC-Team-Labyrinth-2,项目名称:Labyrinth-2,代码行数:12,代码来源:Player.cs


示例15: SetCellValue

        /// <summary>
        /// Sets a cell value
        /// </summary>
        /// <param name="cell">The cell</param>
        /// <param name="value">The value to be assigned to the cell</param>
        public static void SetCellValue(ICell cell, object value)
        {
            if (value == null)
                cell.SetCellValue(null as string);

            else if (value is string ||
                     value is String)
                cell.SetCellValue(value as string);

            else if (value is bool ||
                     value is Boolean)
                cell.SetCellValue((bool) value);

            else if (value is DateTime) {
                //It works
                var wb = cell.Sheet.Workbook;
                var cellStyle = wb.CreateCellStyle();
                cellStyle.DataFormat = cell.Sheet.Workbook.GetCreationHelper().CreateDataFormat().GetFormat("dd/mm/yyyy" );
                cell.CellStyle = cellStyle;                
                cell.SetCellValue((DateTime) value);
            }

            else
                cell.SetCellValue(Convert.ToDouble(value));
        }
开发者ID:mgmccarthy,项目名称:FileHelpers,代码行数:30,代码来源:NPOIUtils.cs


示例16: SetValueAndFormat

 static void SetValueAndFormat(IWorkbook workbook, ICell cell, double value, short formatId)
 {
     cell.SetCellValue(value);
     ICellStyle cellStyle = workbook.CreateCellStyle();
     cellStyle.DataFormat = formatId;
     cell.CellStyle = cellStyle;
 }
开发者ID:ctddjyds,项目名称:npoi,代码行数:7,代码来源:Program.cs


示例17: LoadDataIntoCells

 public void LoadDataIntoCells(ICell[] cells)
 {
     while (TokenNode != null)
     {
         switch (TokenNode.Value.Tag)
         {
             case Tag.FORMAT_START:
                 {
                     FAPFileVerifier verifier = new FAPFileVerifier(TokenNode);
                     if (verifier.IsAssignmentFormat() == false)
                     {
                         throw new InvalidFAPFileException("The Format type of the given assignment file is not of an \"ASSIGNMENT\" type");
                     }
                 }
                 break;
             case Tag.GENERATION_INFORMATION_START:
                 {
                     FAPFileVerifier verifier = new FAPFileVerifier(TokenNode);
                     if (verifier.ValidScenarioID(ScenarioID) == false)
                     {
                         throw new InvalidScenarioIDException("The given assignment file scenario id doesn't match the problem file scenario id");
                     }
                 }
                 break;
             case Tag.CELLS_START: FillCells(cells);
                 break;
         }
         TokenNode = TokenNode.Next;
     }
 }
开发者ID:Burmudar,项目名称:FAPPSO,代码行数:30,代码来源:FAPTestLoader.cs


示例18: ThrowCommonError

 public static void ThrowCommonError(int rowIndex, int colIndex, ICell cell)
 {
     string errorValue = string.Empty;
     if (cell != null)
     {
         if (cell.CellType == NPOI.SS.UserModel.CellType.STRING)
         {
             errorValue = cell.StringCellValue;
         }
         else if (cell.CellType == NPOI.SS.UserModel.CellType.NUMERIC)
         {
             errorValue = cell.NumericCellValue.ToString("0.########");
         }
         else if (cell.CellType == NPOI.SS.UserModel.CellType.BOOLEAN)
         {
             errorValue = cell.NumericCellValue.ToString();
         }
         else if (cell.CellType == NPOI.SS.UserModel.CellType.BLANK)
         {
             errorValue = "Null";
         }
         else
         {
             errorValue = "Unknow value";
         }
     }
     throw new BusinessException("Import.Read.CommonError", (rowIndex + 1).ToString(), (colIndex + 1).ToString(), errorValue);
 }
开发者ID:zhsh1241,项目名称:Sconit5_Shenya,代码行数:28,代码来源:ImportHelper.cs


示例19: CheckForExit

        public bool CheckForExit(ICell[,] playField)
        {
            this.playField = playField;
            Queue<ICell> cellsOrder = new Queue<ICell>();
            ICell startCell = this.playField[this.playerPosition.Row, this.playerPosition.Column];
            cellsOrder.Enqueue(startCell);
            HashSet<ICell> visitedCells = new HashSet<ICell>();

            bool pathExists = false;
            while (cellsOrder.Count > 0)
            {
                ICell currentCell = cellsOrder.Dequeue();
                visitedCells.Add(currentCell);

                if (this.ExitFound(currentCell))
                {
                    pathExists = true;
                    break;
                }

                this.Move(currentCell, Direction.Down, cellsOrder, visitedCells);
                this.Move(currentCell, Direction.Up, cellsOrder, visitedCells);
                this.Move(currentCell, Direction.Left, cellsOrder, visitedCells);
                this.Move(currentCell, Direction.Right, cellsOrder, visitedCells);
            }

            return pathExists;
        }
开发者ID:HQC-Team-Labyrinth-2,项目名称:Labyrinth-2,代码行数:28,代码来源:StandardPlayFieldGeneratorTests.cs


示例20: TestNode

 private static Coordinates? TestNode(ICell[,] grid, int x, int y)
 {
     int xsize = grid.GetLength(0), ysize = grid.GetLength(1);
     if (x >= 0 && x < xsize && y >= 0 && y < ysize && grid[x, y].Weight >= 0 && grid[x, y].Weight < 1)
         return grid[x, y].Coordinates;
     return null;
 }
开发者ID:iu7-12-dbg,项目名称:t08-lab01,代码行数:7,代码来源:DownAdjacement.cs



注:本文中的ICell类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ICellStyle类代码示例发布时间:2022-05-24
下一篇:
C# ICategoryService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap