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


C# ISheet.GetRow方法代码示例

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


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

示例1: ReadSheet

		//シートの読み込み
		static StringGrid ReadSheet(ISheet sheet, string path)
		{
			int lastRowNum = sheet.LastRowNum;

			StringGrid grid = new StringGrid(path + ":" + sheet.SheetName, CsvType.Tsv);
			for (int rowIndex = sheet.FirstRowNum; rowIndex <= lastRowNum; ++rowIndex)
			{
				IRow row = sheet.GetRow(rowIndex);

				List<string> stringList = new List<string>();
				if (row != null)
				{
					foreach (var cell in row.Cells)
					{
						for (int i = stringList.Count; i < cell.ColumnIndex; ++i)
						{
							stringList.Add("");
						}
						stringList.Add(cell.ToString());
					}
				}
				grid.AddRow(stringList);
			}
			grid.ParseHeader();
			return grid;
		}
开发者ID:OsamaRazaAnsari,项目名称:2DDressUpGame,代码行数:27,代码来源:ExcelParser.cs

示例2: SheetImport

        private static void SheetImport(Tk5ListMetaData metaInfos, DataTable dataTable, ISheet sheet,
            ResultHolder resultHolder)
        {
            if (sheet != null)
            {
                // resultHolder.SheetName = metaInfos.Table.TableDesc;
                Dictionary<string, Tk5FieldInfoEx> dicOfInfo = new Dictionary<string, Tk5FieldInfoEx>();
                foreach (Tk5FieldInfoEx info in metaInfos.Table.TableList)
                {
                    dicOfInfo.Add(info.DisplayName, info);
                }

                IRow headerRow = sheet.GetRow(0);
                for (int i = (sheet.FirstRowNum + 1); i <= sheet.LastRowNum; i++)
                {
                    IRow row = sheet.GetRow(i);
                    DataRow dataRow = dataTable.NewRow();
                    for (int j = row.FirstCellNum; j < row.LastCellNum; j++)
                    {
                        string columnName = headerRow.GetCell(j).ToString();
                        string strValue = row.GetCell(j).ToString();
                        ImportResult imResult = TablePadding(dataRow, columnName, dicOfInfo, strValue, i);
                        if (imResult != null)
                        {
                            resultHolder.Add(imResult);
                        }
                    }
                    dataTable.Rows.Add(dataRow);
                }
            }
        }
开发者ID:ZLLselfRedeem,项目名称:zllinmitu,代码行数:31,代码来源:NPOIRead.cs

示例3: GetChambrePMZ

        private ChambrePA GetChambrePMZ(ISheet sheet)
        {
            var geofibrePMZ = sheet.GetRow(10).GetCell(11).ToString();
            var identifiantPMZ = sheet.GetRow(10).GetCell(13).ToString();

            return new ChambrePA(geofibrePMZ, identifiantPMZ);
        }
开发者ID:baptisteMillot,项目名称:Synoptique,代码行数:7,代码来源:GetPageDeGarde.cs

示例4: AddBorder

    /// <summary>
    /// 加边框
    /// </summary>
    /// <param Name="rowindex">1开始</param>
    /// <param Name="cellIndex">1开始</param>
    public void AddBorder( ISheet sheet, HSSFWorkbook workbook)
    {
        ICellStyle styel = workbook.CreateCellStyle();
        styel.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center; // ------------------
        IFont font1 = workbook.CreateFont();
        font1.FontHeightInPoints = 11;

        font1.Boldweight = 600;
        font1.FontName = "宋体";
        styel.SetFont(font1);
        for (int rowindex=1;rowindex<sheet.LastRowNum+1;rowindex++)
        {
            for (int cellIndex =0; cellIndex < dcs.Count;cellIndex++ )
            {
                sheet.GetRow(rowindex).RowStyle = styel;
                ICell cell = sheet.GetRow(rowindex ).GetCell(cellIndex );

                HSSFCellStyle Style = workbook.CreateCellStyle() as HSSFCellStyle;

                Style.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
                Style.VerticalAlignment = VerticalAlignment.Center;
                Style.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
                Style.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
                Style.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
                Style.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
                Style.DataFormat = 0;
                Style.SetFont(font1);
                cell.CellStyle = Style;
            }
         }
    }
开发者ID:konglinghai123,项目名称:SAS,代码行数:36,代码来源:ExcelHelper.cs

示例5: GetChambrePA

        private ChambrePointAboutement GetChambrePA(ISheet sheet)
        {
            var geofibrePA = sheet.GetRow(11).GetCell(11).ToString();
            var chambrePA = sheet.GetRow(13).GetCell(10).ToString();

            return new ChambrePointAboutement(geofibrePA, chambrePA);
        }
开发者ID:baptisteMillot,项目名称:Synoptique,代码行数:7,代码来源:GetPageDeGarde.cs

示例6: SameCell

        /**
 * Highlight cells based on their values
 */
        static void SameCell(ISheet sheet)
        {
            sheet.CreateRow(0).CreateCell(0).SetCellValue(84);
            sheet.CreateRow(1).CreateCell(0).SetCellValue(74);
            sheet.CreateRow(2).CreateCell(0).SetCellValue(50);
            sheet.CreateRow(3).CreateCell(0).SetCellValue(51);
            sheet.CreateRow(4).CreateCell(0).SetCellValue(49);
            sheet.CreateRow(5).CreateCell(0).SetCellValue(41);

            ISheetConditionalFormatting sheetCF = sheet.SheetConditionalFormatting;

            // Condition 1: Cell Value Is   greater than  70   (Blue Fill)
            IConditionalFormattingRule rule1 = sheetCF.CreateConditionalFormattingRule(ComparisonOperator.GreaterThan, "70");
            IPatternFormatting fill1 = rule1.CreatePatternFormatting();
            fill1.FillBackgroundColor = (IndexedColors.Blue.Index);
            fill1.FillPattern = (short)FillPattern.SolidForeground;

            // Condition 2: Cell Value Is  less than      50   (Green Fill)
            IConditionalFormattingRule rule2 = sheetCF.CreateConditionalFormattingRule(ComparisonOperator.LessThan, "50");
            IPatternFormatting fill2 = rule2.CreatePatternFormatting();
            fill2.FillBackgroundColor = (IndexedColors.Green.Index);
            fill2.FillPattern= (short)FillPattern.SolidForeground;

            CellRangeAddress[] regions = {
                CellRangeAddress.ValueOf("A1:A6")
        };

            sheetCF.AddConditionalFormatting(regions, rule1, rule2);

            sheet.GetRow(0).CreateCell(2).SetCellValue("<== Condition 1: Cell Value is greater than 70 (Blue Fill)");
            sheet.GetRow(4).CreateCell(2).SetCellValue("<== Condition 2: Cell Value is less than 50 (Green Fill)");
        }
开发者ID:89sos98,项目名称:npoi,代码行数:35,代码来源:Program.cs

示例7: ReadExcel

        private IEnumerable<PositionnementEtudeSheet> ReadExcel(ISheet sheet)
        {
            var rowNumber = 4;
            while (sheet.GetRow(rowNumber).GetCell(0) != null && sheet.GetRow(rowNumber).GetCell(0).ToString() != string.Empty)
            {
                var rows = GetRows(sheet, rowNumber).ToList();

                rowNumber += rows.Count;

                yield return new PositionnementEtudeSheet(rows);
            }
        }
开发者ID:baptisteMillot,项目名称:Synoptique,代码行数:12,代码来源:GetPositionnementEtude.cs

示例8: GetCellNumic

        public static double GetCellNumic(ISheet sheet, char x, int y)
        {
            double _r = double.MinValue;

            ICell cell = sheet.GetRow(y - 1).GetCell(GetCellIntFromChar(x) - 1);
            if (cell != null)
                switch (cell.CellType)
                {
                    case CellType.String:
                        {
                            _r = double.Parse(cell.StringCellValue.Trim());

                        }
                        break;
                    case CellType.Numeric:
                        {
                            _r = cell.NumericCellValue;
                        }
                        break;
                    default:
                        {

                        }
                        break;
                }

            return _r;

        }
开发者ID:sloww,项目名称:tslinkcn.tools,代码行数:29,代码来源:PublicTools.cs

示例9: SheetImport

        private static void SheetImport(Tk5ListMetaData metaInfos, DataTable dataTable, ISheet sheet,
            ImportError importError)
        {
            if (sheet != null)
            {
                Dictionary<string, Tk5FieldInfoEx> dicOfInfo = new Dictionary<string, Tk5FieldInfoEx>();
                foreach (Tk5FieldInfoEx info in metaInfos.Table.TableList)
                {
                    dicOfInfo.Add(info.DisplayName, info);
                }

                IRow headerRow = sheet.GetRow(0);
                IRow row = null;
                string columnName = string.Empty;
                string strValue = string.Empty;
                ICell cell = null;
                for (int i = (sheet.FirstRowNum + 1); i <= sheet.LastRowNum; i++)
                {
                    row = sheet.GetRow(i);
                    DataRow dataRow = dataTable.NewRow();
                    bool rowError = false;
                    for (int j = headerRow.FirstCellNum; j < headerRow.LastCellNum; j++)
                    {
                        columnName = headerRow.GetCell(j).ToString();
                        cell = row.GetCell(j);
                        strValue = ((cell == null) ? null : cell.ToString());
                        var imResult = TablePadding(dataRow, columnName, dicOfInfo, strValue, i);
                        if (imResult != null)
                        {
                            importError.Add(imResult);
                            rowError = true;
                        }
                    }

                    if (!rowError)
                    {
                        dataRow["OriginalRowNum"] = i;
                        dataTable.Rows.Add(dataRow);
                    }
                }
            }
        }
开发者ID:ZLLselfRedeem,项目名称:zllinmitu,代码行数:42,代码来源:ExcelImporter.cs

示例10: LoadProjects

        private void LoadProjects(ISheet sheet, int rowStartIndex, List<Project> projects)
        {
            int maxColCount = 40;
            int rowheight = 20;

            for (int col = 1; col < maxColCount; col = col + 2)
            {

                ICell repCell = sheet.GetRow(rowStartIndex + 1).GetCell(col);
                ICell nameCell = sheet.GetRow(rowStartIndex + 2).GetCell(col);
                ICell idCell = sheet.GetRow(rowStartIndex).GetCell(col);

                if (GetCellValue(repCell) == null || GetCellValue(nameCell) == null || GetCellValue(idCell) == null)
                {
                    continue;
                }

                Project project = new Project();
                project.Assignment = GetCellValue(idCell);
                project.Name = GetCellValue(nameCell);
                project.Rep = Regex.Replace(GetCellValue(repCell), @"\s+", "").ToLower();

                for (int row = rowStartIndex + 3; row < rowheight + rowStartIndex; row++)
                {
                    IRow rowObj = sheet.GetRow(row);
                    if (rowObj == null)
                    {
                        continue;
                    }
                    ICell cell = rowObj.GetCell(col);
                    string value = GetCellValue(cell);
                    if (value != null)
                    {
                        project.Members.Add(Regex.Replace(value, @"\s+", "").ToLower());
                    }

                }
                projects.Add(project);

            }
        }
开发者ID:hashinisenaratne,项目名称:seranet.api,代码行数:41,代码来源:ResourcePlanReader.cs

示例11: AutoSizeColumns

        /// <summary>
        /// 自动设置Excel列宽
        /// </summary>
        /// <param name="sheet">Excel表</param>
        private static void AutoSizeColumns(ISheet sheet)
        {
            if (sheet.PhysicalNumberOfRows > 0)
            {
                IRow headerRow = sheet.GetRow(0);

                for (int i = 0, l = headerRow.LastCellNum; i < l; i++)
                {
                    sheet.AutoSizeColumn(i);
                }
            }
        }
开发者ID:cityjoy,项目名称:Portal.MVC,代码行数:16,代码来源:ExcelRender.cs

示例12: CheckSchedule

 public bool CheckSchedule(ISheet sheet, string anchorKey)
 {
     for (int i = 0; i <= sheet.LastRowNum; i++)
     {
         var cell = sheet.GetRow(i).Cells.Where(x => x.CellType == CellType.String && x.StringCellValue.ToLower().Contains(anchorKey.ToLower())).LastOrDefault();
         if (cell != null)
         {
             return true;
         }
     }
     return false;
 }
开发者ID:thinhnguyenquoc,项目名称:TVHS,代码行数:12,代码来源:Helper.cs

示例13: CreateWorksheet

 Worksheet CreateWorksheet(ISheet sheet)
 {
     var rows = new List<IRow>();
     int maxColumns = 0;
     for (int i = 0; i < sheet.PhysicalNumberOfRows; i++)
     {
         IRow row = sheet.GetRow(i);
         maxColumns = Math.Max(maxColumns, row.LastCellNum);
         rows.Add(row);
     }
     return new Worksheet(sheet.SheetName, maxColumns, rows.Select(row => CreateRow(row, maxColumns)));
 }
开发者ID:kellyselden,项目名称:Libraries,代码行数:12,代码来源:ExcelService.cs

示例14: AddContents

        private static void AddContents(ISheet sheet, ICollection<List<string>> rowsAndCells)
        {
            var lastRow = sheet.LastRowNum;
            for (int i = 1; i <= lastRow; i++)
            {
                var row = new List<string>();

                row.AddRange(
                    sheet.GetRow(i)
                        .Cells.Select(
                            x => x.CellType == CellType.Numeric ? x.NumericCellValue.ToString(CultureInfo.InvariantCulture) : x.StringCellValue));
                rowsAndCells.Add(row);
            }
        }
开发者ID:dev4s,项目名称:2015-import-library,代码行数:14,代码来源:XlsAndXlsxFileLogic.cs

示例15: ParseGoodSale

        private IEnumerable<SaleParsed> ParseGoodSale(ISheet sheet, GoodType good, DateTime dateTime, int customerColumn, int startRow)
        {
            var sales = new List<SaleParsed>();

            for (int r = startRow; ; r++)
            {
                var row = sheet.GetRow(r);
                if (row == null)
                    break;

                var customerCell = row.GetCell(customerColumn);
                if (customerCell == null || string.IsNullOrWhiteSpace(customerCell.StringCellValue))
                    break;

                var customer = customerCell.StringCellValue.Trim();

                int qty = 0, ret = 0;
                var qtyCell = sheet.GetRow(r).GetCell(good.ColumnInDocument - 1);
                if (qtyCell != null && qtyCell.CellType == CellType.Numeric
                    && qtyCell.NumericCellValue > 0)
                {
                    qty = (int)qtyCell.NumericCellValue;
                }

                if (good.HasReturn)
                {
                    var retCell = sheet.GetRow(r).GetCell(good.ReturnColumn.Value - 1);
                    if (retCell != null && retCell.CellType == CellType.Numeric
                        && retCell.NumericCellValue > 0)
                    {
                        ret = (int)retCell.NumericCellValue;
                    }
                }

                if (qty > 0 && qty > ret)
                {
                    var sale = new SaleParsed();
                    sale.GoodType = good;
                    sale.DateTime = dateTime;
                    sale.Customer = customer;
                    sale.Producer = producer;
                    sale.Quantity = qty;
                    sale.Return = ret;
                    sales.Add(sale);
                }
            }

            return sales;
        }
开发者ID:rbilyi,项目名称:InvoiceGenerator,代码行数:49,代码来源:ExcellImporter.cs


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