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

C# IRow类代码示例

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

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



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

示例1: ReadRow

        private Dictionary<string, object> ReadRow(IRow row, KeyValuePair<int, string>[] titles)
        {
            var data = new Dictionary<string, object>();
            foreach (var title in titles)
            {
                var cell = row.GetCell(title.Key);
                if (cell == null)
                {
                    data.Add(title.Value, string.Empty);
                    continue;
                }

                switch (cell.CellType)
                {
                    case CellType.Numeric:
                        data.Add(title.Value, cell.NumericCellValue);
                        break;
                    case CellType.String:
                        data.Add(title.Value, cell.StringCellValue);
                        break;
                    case CellType.Blank:
                        data.Add(title.Value, string.Empty);
                        break;
                    default:
                        throw new Exception(string.Format("Invalid excel cell type: {0} ({1}.{2}.{3})", cell.CellType, cell.Row.Sheet.SheetName, cell.RowIndex, cell.ColumnIndex));
                }
            }
            return data;
        }
开发者ID:GHScan,项目名称:DailyProjects,代码行数:29,代码来源:ExcelOperation.cs


示例2: GetCell

 private DataCell GetCell(IRow row, int index)
 {
     DataCell retCell = new DataCell();
     ICell cell = row.Cells[index]; 
     switch (cell.CellType)
     {
         case CellType.String :
             retCell.Type = DataCellType.String;
             retCell.Value = cell.StringCellValue;
             break;
         case CellType.Numeric :
             retCell.Type = DataCellType.Numeric;
             retCell.Value = cell.NumericCellValue;
             break;
         case CellType.Formula :
             retCell.Type = DataCellType.Formula;
             retCell.Value = cell.CellFormula;
             break;
         case CellType.Boolean :
             retCell.Type = DataCellType.Boolean;
             retCell.Value = cell.BooleanCellValue;
             break;
         case CellType.Blank :
             retCell.Type = DataCellType.Blank;
             retCell.Value = cell.StringCellValue;
             break;
     }
     retCell.ColumnIndex = cell.ColumnIndex; 
     return retCell;
 }
开发者ID:sandalkuilang,项目名称:common,代码行数:30,代码来源:OpenXmlSheet.cs


示例3: Process

        private static void Process(IRow row, HSSFFormulaEvaluator eval)
        {
            IEnumerator it = row.GetEnumerator();
            while (it.MoveNext())
            {
                ICell cell = (ICell)it.Current;
                if (cell.CellType != NPOI.SS.UserModel.CellType.FORMULA)
                {
                    continue;
                }
                FormulaRecordAggregate record = (FormulaRecordAggregate)((HSSFCell)cell).CellValueRecord;
                FormulaRecord r = record.FormulaRecord;
                Ptg[] ptgs = r.ParsedExpression;

                String cellRef = new CellReference(row.RowNum, cell.ColumnIndex, false, false).FormatAsString();
#if !HIDE_UNREACHABLE_CODE
                if (false && cellRef.Equals("BP24"))
                { 
                    Console.Write(cellRef);
                    Console.WriteLine(" - has " + ptgs.Length + " ptgs:");
                    for (int i = 0; i < ptgs.Length; i++)
                    {
                        String c = ptgs[i].GetType().ToString();
                        Console.WriteLine("\t" + c.Substring(c.LastIndexOf('.') + 1));
                    }
                    Console.WriteLine("-> " + cell.CellFormula);
                }
#endif

                NPOI.SS.UserModel.CellValue evalResult = eval.Evaluate(cell);
                Assert.IsNotNull(evalResult);
            }
        }
开发者ID:hanwangkun,项目名称:npoi,代码行数:33,代码来源:TestBug42464.cs


示例4: WriteRow

        /// <summary/>
        private static void                     WriteRow(IRow row, JsonTextWriter writer)
        {
            // Row
            //  => { c1:v1, c2:v2, ...}

            // Header
            writer.WriteStartObject();

            // Fields
            var columns = row.Schema;
            for(int i=0; i<columns.Count; i++)
            {
                // Note: We simply delegate to Json.Net for all data conversions
                //  For data conversions beyond what Json.Net supports, do an explicit projection:
                //      ie: SELECT datetime.ToString(...) AS datetime, ...
                object value = row.Get<object>(i);

                // Note: We don't bloat the JSON with sparse (null) properties
                if(value != null)
                { 
                    writer.WritePropertyName(columns[i].Name, escape:true);
                    writer.WriteValue(value);
                }
            }

            // Footer
            writer.WriteEndObject();
        }
开发者ID:FA182,项目名称:usql,代码行数:29,代码来源:JsonOutputter.cs


示例5: IsGood

 public bool IsGood(IRow row, ITable table)
 {
     var keystring = table.GetKeystring(row);
     var inf = _lookup[keystring];
     System.Threading.Thread.Sleep(inf.Duration);
     return inf.Result;
 }
开发者ID:VennoFang,项目名称:dblp2csv,代码行数:7,代码来源:SimulatedMetric.cs


示例6: GetValueByColumn

 public static object GetValueByColumn(this ITable table, string colName, IRow row)
 {
     var colId = table.Columns.Where(c => c.Name == colName).Select((c, i) => (int?)i).FirstOrDefault();
     if (colId == null)
         throw new ArgumentOutOfRangeException(String.Format("Column '{0}' not found.", colName));
     return GetValue(table, colId.Value, row);
 }
开发者ID:VennoFang,项目名称:dblp2csv,代码行数:7,代码来源:TableExtensions.cs


示例7: buildWorkbook

        private void buildWorkbook(IWorkbook wb)
        {
            ISheet sh = wb.CreateSheet();
            IRow row1 = sh.CreateRow(0);
            IRow row2 = sh.CreateRow(1);
            row3 = sh.CreateRow(2);

            row1.CreateCell(0, CellType.Numeric);
            row1.CreateCell(1, CellType.Numeric);

            row2.CreateCell(0, CellType.Numeric);
            row2.CreateCell(1, CellType.Numeric);

            row3.CreateCell(0);
            row3.CreateCell(1);

            CellReference a1 = new CellReference("A1");
            CellReference a2 = new CellReference("A2");
            CellReference b1 = new CellReference("B1");
            CellReference b2 = new CellReference("B2");

            sh.GetRow(a1.Row).GetCell(a1.Col).SetCellValue(35);
            sh.GetRow(a2.Row).GetCell(a2.Col).SetCellValue(0);
            sh.GetRow(b1.Row).GetCell(b1.Col).CellFormula = (/*setter*/"A1/A2");
            sh.GetRow(b2.Row).GetCell(b2.Col).CellFormula = (/*setter*/"NA()");

            Evaluator = wb.GetCreationHelper().CreateFormulaEvaluator();
        }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:28,代码来源:TestLogicalFunction.cs


示例8: GetCellNumic

        public static double GetCellNumic(IRow row, int y)
        {
            double _r = double.MinValue;

            ICell cell = row.Cells[y - 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:
                        {
                            _r = 0;
                        }
                        break;
                }

            return _r;

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


示例9: CreateCell

        internal static ICell CreateCell(IWorkbook workbook, IRow row, int column, decimal? content, bool isCentered)
        {
            ICellStyle style = workbook.CreateCellStyle();
            ICell cell = row.CreateCell(column);
            if (content == null)
            {
                cell.SetCellValue("");
            }
            else
            {
                cell.SetCellValue(Convert.ToDouble(content.Value));
            }
            if (isCentered)
            {
                style.Alignment = HorizontalAlignment.Center;

            }
            style.BorderBottom = BorderStyle.Thin;
            style.BorderTop = BorderStyle.Thin;
            style.BorderLeft = BorderStyle.Thin;
            style.BorderRight = BorderStyle.Thin;

            cell.CellStyle = style;
            return cell;
        }
开发者ID:chamilka,项目名称:drreport,代码行数:25,代码来源:CellManager.cs


示例10: Output

 // Output
 //
 // Outputs the names of the rowset columns in a column separated row and optionally adds their types in a second row.
 //
 public override void Output(IRow row, IUnstructuredWriter output)
 {
     if (_first_row_written) { return; }
     using (StreamWriter streamWriter = new StreamWriter(output.BaseStream, this._encoding))
     {
         streamWriter.NewLine = this._row_delim;
         ISchema schema = row.Schema;
         for (int i = 0; i < schema.Count(); i++)
         {
             var col = schema[i];
             if (i > 0)
             {
                 streamWriter.Write(this._col_delim);
             }
             var val = _quoting ? AddQuotes(col.Name) : col.Name;
             streamWriter.Write(val);
         }
         streamWriter.WriteLine();
         if (_with_types)
         {
             for (int i = 0; i < schema.Count(); i++)
             {
                 var col = schema[i];
                 if (i > 0)
                 {
                     streamWriter.Write(this._col_delim);
                 }
                 var val = _quoting ? AddQuotes(col.Type.FullName) : col.Type.FullName;
                 streamWriter.Write(val);
             }
             streamWriter.WriteLine();
         }
     }
     _first_row_written = true;
 }
开发者ID:FA182,项目名称:usql,代码行数:39,代码来源:HdrOutputterSamples.usql.cs


示例11: QAException

        public QAException(IRow exception)
        {
            if (exception == null)
                throw new ArgumentNullException("exception", "Cannot pass null row to QAException");

            this._objectID = exception.OID;

            int idx;
            idx = exception.Fields.FindField("ATTACHMENT");
            this._attachment = exception.get_Value(idx).ToString();
            idx = exception.Fields.FindField("DATA_EXCEPTION_POINT_ID");
            this._exceptionID = Convert.ToInt32(exception.get_Value(idx));
            idx = exception.Fields.FindField("DATA_EXCEPTION_STATUS");
            this._status = exception.get_Value(idx).ToString();
            idx = exception.Fields.FindField("EXCEPTION_DESCRIPTION");
            this._description = exception.get_Value(idx).ToString();
            idx = exception.Fields.FindField("LATITUDE");
            this._latitude = Convert.ToDouble(exception.get_Value(idx));
            idx = exception.Fields.FindField("LONGITUDE");
            this._longitude = Convert.ToDouble(exception.get_Value(idx));
            idx = exception.Fields.FindField("OPERATIONAL_DATASET_NAME");
            this._operationDSName = exception.get_Value(idx).ToString();
            idx = exception.Fields.FindField("QA_TEST_NAME");
            this._testName = exception.get_Value(idx).ToString();
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:25,代码来源:QAException.cs


示例12: Apply

        /// <summary>Apply is called at least once per instance</summary>
        /// <param name="input">A SQLIP row</param>
        /// <param name="output">A SQLIP updatable row.</param>
        /// <returns>IEnumerable of IRow, one IRow per SQLIP row.</returns>
        /// <remarks>Because applier constructor arguments cannot depend on
        /// column references, the name of the column to parse is given as a string. Then
        /// the actual column value is obtained by calling IRow.Get. The rest of the code
        /// is the same as XmlDomExtractor.</remarks>
        public override IEnumerable<IRow> Apply(IRow input, IUpdatableRow output)
        {
            // Make sure that all requested columns are of type string
            IColumn column = output.Schema.FirstOrDefault(col => col.Type != typeof(string));
            if (column != null)
            {
                throw new ArgumentException(string.Format("Column '{0}' must be of type 'string', not '{1}'", column.Name, column.Type.Name));
            }
            
            XmlDocument xmlDocument = new XmlDocument();
            xmlDocument.LoadXml(input.Get<string>(this.xmlColumnName));
            foreach (XmlNode xmlNode in xmlDocument.DocumentElement.SelectNodes(this.rowPath))
            {
                // IUpdatableRow implements a builder pattern to save memory allocations, 
                // so call output.Set in a loop
                foreach(IColumn col in output.Schema)
                {
                    var explicitColumnMapping = this.columnPaths.FirstOrDefault(columnPath => columnPath.Value == col.Name);
                    XmlNode xml = xmlNode.SelectSingleNode(explicitColumnMapping.Key ?? col.Name);
                    output.Set(explicitColumnMapping.Value ?? col.Name, xml == null ? null : xml.InnerXml);
                }

                // then call output.AsReadOnly to build an immutable IRow.
                yield return output.AsReadOnly();
            }
        }
开发者ID:hughwasos,项目名称:usql,代码行数:34,代码来源:XmlApplier.cs


示例13: GetDefaultValueForField

        public static object GetDefaultValueForField(IRow row, IField fld)
        {
            object defaultValue = DBNull.Value;
            if (!fld.IsNullable)
                defaultValue = string.Empty;

            if (row != null && fld != null)
            {
                IClass cls = row.Table;
                if (HasSubtype(cls))
                {
                    ISubtypes subTypes = (ISubtypes)cls;
                    string subTypeFieldName = GetSubTypeFieldName(cls);
                    if (string.IsNullOrEmpty(subTypeFieldName) == false)
                    {
                        object o = GetFieldValue(row, subTypeFieldName);
                        int subTypeCode = ToInteger(o, -1);
                        if (subTypeCode != -1)
                            defaultValue = subTypes.get_DefaultValue(subTypeCode, fld.Name);
                    }
                }

                if (defaultValue == DBNull.Value && fld.Type == esriFieldType.esriFieldTypeDate)
                    defaultValue = fld.DefaultValue;
            }
            return defaultValue;
        }
开发者ID:Ramakrishnapv,项目名称:FuturaNetwork,代码行数:27,代码来源:Database.cs


示例14: DunaGridRowSelector

 public DunaGridRowSelector(IRow row)
     : base()
 {
     this.Row = row;
     InitializeComponent();
     this.HoverAreaPadding = new Padding(0, 3, 0, 3);
     DoubleBuffered = true;
 }
开发者ID:pyramida,项目名称:DunaGrid,代码行数:8,代码来源:DunaGridRowSelector.cs


示例15: InsertCell

 private static int InsertCell(IRow row, int cellIndex, string value, ICellStyle cellStyle)
 {
     var cell = row.CreateCell(cellIndex);
     cell.SetCellValue(value);
     cell.CellStyle = cellStyle;
     cellIndex++;
     return cellIndex;
 }
开发者ID:zhh007,项目名称:CKGen,代码行数:8,代码来源:ExcelHelper.cs


示例16: CompletedRowsReturnsCorrectly

 public void CompletedRowsReturnsCorrectly(IRow row)
 {
     foreach (var position in row.Positions)
         _grid = _grid.Fill(position, Mark.Cross);
     var completedRows = _grid.CompletedRows();
     Assert.That(completedRows, Is.Not.Null);
     Assert.That(completedRows, Contains.Item(row));
 }
开发者ID:alexmiranda,项目名称:tictactoe,代码行数:8,代码来源:Grid3X3Tests.cs


示例17: TransformSpecialCase

        internal static string TransformSpecialCase(IRow theRow, short redLightDiviser, short numberOfLightsOn)
        {
            var lightsOn = new String('\0', numberOfLightsOn);
            lightsOn = String.Join("", lightsOn.Select((light, index) => 
                    CheckIfIsTimeToUseRed(index, redLightDiviser) 
                        ? BerlinClockConstants.RedLight : BerlinClockConstants.YellowLight));

            return AppendLightsOffAndLineBreak(theRow.NumberOfLights, lightsOn, theRow.HasLineBreak);
        }
开发者ID:gomeswes,项目名称:DotNetBerlinClock,代码行数:9,代码来源:LightsTransformer.cs


示例18: CreateSingleFrom

 public SpotifyNotification CreateSingleFrom(IRow row)
 {
     return new SpotifyNotification()
     {
         SongTitle = row.Cells[2].StringCellValue,
         Artist = row.Cells[3].StringCellValue,
         Row = row,
         Genres = new List<String>()
     };
 }
开发者ID:SmyQ,项目名称:SpotifyNotificationParserForExcel,代码行数:10,代码来源:SpotifyNotificationFactory.cs


示例19: CreateCells

 public void CreateCells(int cellsCount, ref IRow row, IList<string> cellsValues = null)
 {
     //var isEmptyCells = cellsValues == null || !cellsValues.Any() || cellsValues.Count != cellsCount;
     //if (isEmptyCells)
     //    for (var j = 0; j < cellsCount; j++)
     //        row.CreateCell(j).SetCellValue(string.Empty);
     //else
         for (var j = 0; j < cellsCount; j++)
             row.CreateCell(j).SetCellValue("cell " + j);
 }
开发者ID:adamsabri,项目名称:Security,代码行数:10,代码来源:BaseWriter.cs


示例20: Output

 public override void Output(IRow input, IUnstructuredWriter output)
 {
     var obj = input.Get<object>(0);
     byte[] imageArray = (byte[])obj;
     using (MemoryStream ms = new MemoryStream(imageArray))
     {
         var image = Image.FromStream(ms);
         image.Save(output.BaseStream, ImageFormat.Jpeg);
     }
 }
开发者ID:Azure,项目名称:usql,代码行数:10,代码来源:ImageOutputter.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IRpcController类代码示例发布时间:2022-05-24
下一篇:
C# IRouter类代码示例发布时间: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