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


C# Range.get_Offset方法代码示例

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


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

示例1: ImportVertices


//.........这里部分代码省略.........
            String [] asVertexAttributes,
            ListObject oVertexTable,
            Range oVertexNameColumnData,
            Range oVisibilityColumnData
            )
        {
            Debug.Assert(oSourceGraph != null);
            Debug.Assert(oVertexTable != null);
            Debug.Assert(oVertexNameColumnData != null);
            Debug.Assert(oVisibilityColumnData != null);
            AssertValid();

            // Create a dictionary that maps vertex names to row numbers in the
            // vertex worksheet.

            Dictionary<String, Int32> oVertexDictionary =
            new Dictionary<String, Int32>();

            Object [,] aoVertexNameValues =
            ExcelUtil.GetRangeValues(oVertexNameColumnData);

            Int32 iRows = oVertexNameColumnData.Rows.Count;

            if (iRows == 1 && aoVertexNameValues[1, 1] == null)
            {
            // Range.get_Value() (and therefore ExcelUtil.GetRangeValues())
            // returns a single null cell when the table is empty.  Work around
            // this.

            iRows = 0;
            }

            for (Int32 iRowOneBased = 1; iRowOneBased <= iRows; iRowOneBased++)
            {
            String sVertexName;

            if ( ExcelUtil.TryGetNonEmptyStringFromCell(aoVertexNameValues,
                iRowOneBased, 1, out sVertexName) )
            {
                oVertexDictionary[sVertexName] = iRowOneBased;
            }
            }

            aoVertexNameValues = null;

            // Create a list of vertices not already included in the vertex table.
            // This can occur when the graph has isolated vertices.

            List<String> oIsolatedVertexNames = new List<String>();

            foreach (IVertex oVertex in oSourceGraph.Vertices)
            {
            String sVertexName = oVertex.Name;

            if ( !oVertexDictionary.ContainsKey(sVertexName) )
            {
                oIsolatedVertexNames.Add(sVertexName);
            }
            }

            Int32 iIsolatedVertices = oIsolatedVertexNames.Count;

            if (iIsolatedVertices > 0)
            {
            // Append the isolated vertices to the table.  The vertex
            // visibilities should be set to Show to force them to be shown
            // even though they are not included in edges.

            String [,] asAddedVertexNameValues =
                new String [iIsolatedVertices, 1];

            String [,] asAddedVisibilityValues =
                new String [iIsolatedVertices, 1];

            String sShow = ( new VertexVisibilityConverter() ).GraphToWorkbook(
                VertexWorksheetReader.Visibility.Show);

            for (Int32 i = 0; i < iIsolatedVertices; i++)
            {
                String sIsolatedVertexName = oIsolatedVertexNames[i];
                asAddedVertexNameValues[i, 0] = sIsolatedVertexName;
                asAddedVisibilityValues[i, 0] = sShow;
                oVertexDictionary[sIsolatedVertexName] = iRows + i + 1;
            }

            ExcelUtil.SetRangeValues(
                oVertexNameColumnData.get_Offset(iRows, 0),
                asAddedVertexNameValues);

            ExcelUtil.SetRangeValues(
                oVisibilityColumnData.get_Offset(iRows, 0),
                asAddedVisibilityValues);
            }

            if (asVertexAttributes != null)
            {
            ImportVertexAttributes(oSourceGraph, asVertexAttributes,
                oVertexDictionary, oVertexTable);
            }
        }
开发者ID:haisreekanth,项目名称:NetMap,代码行数:101,代码来源:GraphImporter.cs

示例2: GetParallelSubrange

        //*************************************************************************
        //  Method: GetParallelSubrange()
        //
        /// <summary>
        /// Given a subrange in one column, returns a subrange in a second column
        /// with the same start and end rows.
        /// </summary>
        ///
        /// <param name="column1Subrange">
        /// The subrange in one column.
        /// </param>
        ///
        /// <param name="column2NumberOneBased">
        /// The one-based column number of the second column.
        /// </param>
        ///
        /// <returns>
        /// The range in <paramref name="column2NumberOneBased" /> that has the
        /// same start and end rows as <paramref name="column1Subrange" />.
        /// </returns>
        //*************************************************************************
        public static Range GetParallelSubrange(
            Range column1Subrange,
            Int32 column2NumberOneBased
            )
        {
            Debug.Assert(column1Subrange != null);
            Debug.Assert(column2NumberOneBased >= 1);

            Int32 iColumn1NumberOneBased = column1Subrange.Column;

            Range oColumn2Subrange = column1Subrange.get_Offset(
            Missing.Value, column2NumberOneBased - iColumn1NumberOneBased);

            return (oColumn2Subrange);
        }
开发者ID:haisreekanth,项目名称:NetMap,代码行数:36,代码来源:ExcelRangeSplitter.cs

示例3:

        OffsetRange
        (
            ref Range range,
            Int32 rowOffset,
            Int32 columnOffset
        )
        {
            Debug.Assert(range != null);

            range = range.get_Offset(rowOffset, columnOffset);
        }
开发者ID:cpatmoore,项目名称:bio,代码行数:11,代码来源:ExcelUtil.cs

示例4: RemoveSourceColumnHeader

        //*************************************************************************
        //  Method: RemoveSourceColumnHeader()
        //
        /// <summary>
        /// Removes the header from one of the source columns.
        /// </summary>
        ///
        /// <param name="oSourceColumn">
        /// The source column to remove the header from.
        /// </param>
        //*************************************************************************
        protected void RemoveSourceColumnHeader(
            ref Range oSourceColumn
            )
        {
            AssertValid();

            Int32 iRows = oSourceColumn.Rows.Count;

            if (iRows == 1)
            {
            OnInvalidSourceWorkbook(
                "There are no edges to import.",
                oSourceColumn.Worksheet, 1, 1
                );
            }

            // Trim the last row of the range, then shift the range down one row.

            oSourceColumn = oSourceColumn.get_Resize(iRows - 1, 1);
            oSourceColumn = oSourceColumn.get_Offset(1, 0);
        }
开发者ID:haisreekanth,项目名称:NetMap,代码行数:32,代码来源:EdgeWorkbookImporter.cs


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