当前位置: 首页>>代码示例>>C#>>正文


C# Row.GetCell方法代码示例

本文整理汇总了C#中Row.GetCell方法的典型用法代码示例。如果您正苦于以下问题:C# Row.GetCell方法的具体用法?C# Row.GetCell怎么用?C# Row.GetCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Row的用法示例。


在下文中一共展示了Row.GetCell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CompareCellData

 public static void CompareCellData(Row row, List<Cell> expected)
 {
     for (int i = 0; i < expected.Count; i++)
     {
         Assert.AreEqual(expected[i].Value, row.GetCell(i).StringCellValue);
     }
 }
开发者ID:naeemsarfraz,项目名称:GiveCRM,代码行数:7,代码来源:Helper.cs

示例2: SetCell

        public static void SetCell(Row row, int cellNum, string cellValue)
        {
            var cell = row.GetCell(cellNum);
            if (cell == null)
                cell = row.CreateCell(cellNum);

            cell.SetCellValue(cellValue);
        }
开发者ID:luuksommers,项目名称:resourceextractor,代码行数:8,代码来源:NpoiHelper.cs

示例3: ReadBoolCell

        public static bool? ReadBoolCell(Row row, int index)
        {
            var val = row.GetCell(index);

            if (val != null)
            {
                return val.ToString() == "yes" ? true : false;
            }

            return null;
        }
开发者ID:ucdavis,项目名称:Agribusiness,代码行数:11,代码来源:ExcelHelpers.cs

示例4: ReadIntCell

        public static int? ReadIntCell(Row row, int index)
        {
            var val = row.GetCell(index);

            int num;
            if (val != null && int.TryParse(val.ToString(), out num))
            {
                return num;
            }

            return null;
        }
开发者ID:ucdavis,项目名称:Agribusiness,代码行数:12,代码来源:ExcelHelpers.cs

示例5: ReadDateCell

        public static DateTime? ReadDateCell(Row row, int index)
        {
            var val = row.GetCell(index);

            DateTime date;
            if (val != null && DateTime.TryParse(val.ToString(), out date))
            {
                return date;
            }

            return null;
        }
开发者ID:ucdavis,项目名称:Agribusiness,代码行数:12,代码来源:ExcelHelpers.cs

示例6: FillNodeValue

 /// <summary>
 /// 填充节点统计数据行
 /// </summary>
 /// <param name="log">节点记录</param>
 /// <param name="xh">行序号</param>
 /// <param name="row">excel行</param>
 private static void FillNodeValue(TaskNodeLogsSummary log, int xh, Row row)
 {
     row.GetCell(0).SetCellValue(xh); //序号列
     row.GetCell(1).SetCellValue(log.TaskName); // 节点名称列
     row.GetCell(2).SetCellValue(log.CostDay); // 进度时限列
       //  row.GetCell(2).CellStyle.Alignment = HorizontalAlignment.CENTER;
     row.GetCell(3).SetCellValue(log.ActiveCount); // 当前项目个数
     row.GetCell(4).SetCellValue(log.StartedCount); // 收到项目个数
     row.GetCell(5).SetCellValue(log.DoneCount); // 完成项目个数
     row.GetCell(6).SetCellValue(log.MonthAverage); // 本月平均时限
     row.GetCell(7).SetCellValue(log.LastYearAverage); // 上年同期
     row.GetCell(8).SetCellValue(log.YearOnYear); // 同比增减天数
     row.GetCell(9).SetCellValue(log.PreMonthAverage); // 上月平均时限
     row.GetCell(10).SetCellValue(log.MonthOnMonth); // 环比增减天数
     row.GetCell(11).SetCellValue(log.DelayDoneCount); // 延期完成项目个数
     row.GetCell(12).SetCellValue(log.DelayMax); // 最长超周期项目天数
        // row.GetCell(12).CellStyle.Alignment = HorizontalAlignment.CENTER;
 }
开发者ID:bearing09,项目名称:JiaDingpm,代码行数:24,代码来源:ReportsController.cs

示例7: GetCell

 public Cell GetCell(Row row, int columnindex)
 {
     return row.GetCell(columnindex);
 }
开发者ID:popotans,项目名称:hjnlib,代码行数:4,代码来源:NpoiLib.cs

示例8: ReadRowData

 public string ReadRowData(Row row, int colum)
 {
     return row.GetCell(colum).ToString();
 }
开发者ID:popotans,项目名称:hjnlib,代码行数:4,代码来源:NpoiLib.cs

示例9: CheckValidDataRow

        public bool CheckValidDataRow(Row row, int startColIndex, int endColIndex)
        {
            for (int i = startColIndex; i < endColIndex; i++)
            {
                Cell cell = row.GetCell(i);
                if (cell != null && cell.CellType != NPOI.SS.UserModel.CellType.BLANK)
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:13,代码来源:ImportMgr.cs

示例10: ThrowCommonError

 private void ThrowCommonError(Row row, int colIndex)
 {
     this.ThrowCommonError(row.RowNum, colIndex, row.GetCell(colIndex));
 }
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:4,代码来源:ImportMgr.cs

示例11: GetPlanColumnIndexToRead

        private int GetPlanColumnIndexToRead(Row row, string shiftName, DateTime date)
        {
            int colIndex = -1;
            int startColIndex = 5; //从第5列开始

            int dayOfWeek = (int)date.DayOfWeek;
            if (dayOfWeek == 0)
                dayOfWeek = 7;

            startColIndex = startColIndex + (dayOfWeek - 1) * 6;
            for (int i = startColIndex; i < row.LastCellNum; i = i + 2)
            {
                Cell cell = row.GetCell(i);
                string cellValue = cell.StringCellValue;
                if (cellValue == shiftName)
                {
                    colIndex = i;
                    break;
                }
            }

            return colIndex;
        }
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:23,代码来源:ImportMgr.cs

示例12: CreateTable

        private DataTable CreateTable(Row headerRow, int cellCount)
        {
            DataTable table = new DataTable();
            for (int i = headerRow.FirstCellNum; i < cellCount; i++)
            {
                Cell cell = headerRow.GetCell(i);

                string columnName = GetColumnName(cell, i);
                AddColumn(cell, table, columnName);
            }
            return table;
        }
开发者ID:iEmiya,项目名称:pyExcel,代码行数:12,代码来源:NPOI+Provider.cs

示例13: getContractFromRow

        /// <summary>
        /// 从一行中获取一个协议内容
        /// </summary>
        /// <param name="row"></param>
        /// <returns></returns>
        private static Contract getContractFromRow(Row row)
        {
            Contract con = new Contract();

            con.proCate = row.GetCell(0).ToString();
            con.proName = row.GetCell(1).ToString();
            con.proId = row.GetCell(2).ToString();
            con.unicomLinkMan = row.GetCell(3).ToString();
            con.linkPhone = row.GetCell(4).ToString();
            con.groupCusManager = row.GetCell(5).ToString();
            con.proSignUnitName = row.GetCell(6).ToString();
            con.unitAdd = row.GetCell(7).ToString();
            con.proSign = row.GetCell(8).ToString();
            con.signUnitLinkMan = row.GetCell(9).ToString();
            con.signUnitLinkPhone = row.GetCell(10).ToString();
            con.payPhone = row.GetCell(11).ToString(); ;
            con.payStand = row.GetCell(12).ToString();
            con.proSignDate = row.GetCell(13).ToString();
            con.proSignExeDate = row.GetCell(14).ToString();
            con.proDeadLine = row.GetCell(15).ToString();
            con.proExpireData = row.GetCell(16).ToString();
            con.proDesc = row.GetCell(17).ToString();
            con.remark = row.GetCell(18).ToString();
            con.dltdh = row.GetCell(19).ToString();
            con.fileName = row.GetCell(20).ToString();
            return con;
        }
开发者ID:holenzh,项目名称:CSharpProjAtYC,代码行数:32,代码来源:ExcelUtil.cs

示例14: ExcelRowToPlanEntity

        private PlanEntity ExcelRowToPlanEntity(string aSheetName, int aRowNumber, Row aExcelRow, Dictionary<string, int> aMatchedColumnDictionary,
                            ref string aLastComponentName)
        {
            do
            {
                PlanEntity planEntity = new PlanEntity();
                int getValue = 0;
                {
                    Cell cell = Cell.EmptyCell;
                    if (!aMatchedColumnDictionary.TryGetValue("序号", out getValue)
                        || -1 == getValue
                        || Cell.EmptyCell == (cell = aExcelRow.GetCell(getValue)))
                    {
                        string lError = aSheetName + " " + Convert.ToString(aRowNumber + 1) + "行 无效序号" ;
                        importErrorList.Add(lError);
                        break;
                    }
                    planEntity.SequenceId = Convert.ToInt32(cell.StringValue);
                }

                int taskDescriptionColumn = -1;
                {
                    Cell cell = Cell.EmptyCell;
                    if (aMatchedColumnDictionary.TryGetValue("任务描述", out taskDescriptionColumn)
                        && -1 != taskDescriptionColumn
                        && Cell.EmptyCell != (cell = aExcelRow.GetCell(taskDescriptionColumn)))
                    {
                        planEntity.TaskDescription = cell.StringValue;
                    }
                }

                {
                    Cell cell1 = Cell.EmptyCell;
                    Cell cell2 = Cell.EmptyCell;
                    if ((!aMatchedColumnDictionary.TryGetValue("部件", out getValue)
                         || -1 == getValue
                         || (Cell.EmptyCell == (cell1 = aExcelRow.GetCell(getValue))
                             & Cell.EmptyCell == (cell2 = aExcelRow.GetCell(getValue + 1))))
                        && string.Empty == aLastComponentName)
                    {
                        string lError = aSheetName + " " + Convert.ToString(aRowNumber + 1) + "行 无效部件";
                        importErrorList.Add(lError);
                        break;
                    }

                    if (Cell.EmptyCell != cell1)
                    {
                        planEntity.ComponentName = cell1.StringValue;
                    }

                    if (getValue + 1 != taskDescriptionColumn && Cell.EmptyCell != cell2)
                    {
                        planEntity.ComponentName += cell2.StringValue;
                    }

                    if (null == planEntity.ComponentName)
                    {
                        planEntity.ComponentName = string.Empty;
                    }

                    if (string.Empty == planEntity.ComponentName)
                    {
                        planEntity.ComponentName = aLastComponentName;
                    }
                    else
                    {
                        aLastComponentName = planEntity.ComponentName;
                    }
                }

                {
                    Cell cell = Cell.EmptyCell;
                    if (!aMatchedColumnDictionary.TryGetValue("权重(分值)", out getValue)
                        || -1 == getValue
                        || Cell.EmptyCell == (cell = aExcelRow.GetCell(getValue)))
                    {
                        string lError = aSheetName + " " + Convert.ToString(aRowNumber + 1) + "行 无效权重";
                        importErrorList.Add(lError);
                        break;
                    }
                    planEntity.Weight = Convert.ToDecimal(cell.StringValue);
                }

                {
                    Cell cell = Cell.EmptyCell;
                    if (aMatchedColumnDictionary.TryGetValue("实际得分", out getValue)
                        && -1 != getValue
                        && Cell.EmptyCell != (cell = aExcelRow.GetCell(getValue))
                        && String.Empty != cell.StringValue)
                    {
                        try
                        {
                            planEntity.Score = Convert.ToDecimal(cell.StringValue);
                        }
                        catch(FormatException e )
                        {
                            //ignore exception
                        }
                    }
                }
//.........这里部分代码省略.........
开发者ID:YHTechnology,项目名称:ProjectManager,代码行数:101,代码来源:PlanEditViewModel.cs

示例15: ReadCell

        public static string ReadCell(Row row, int index)
        {
            var val = row.GetCell(index);

            return val != null ? val.ToString() : null;
        }
开发者ID:ucdavis,项目名称:Agribusiness,代码行数:6,代码来源:ExcelHelpers.cs


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