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


C# ExcelAddress类代码示例

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


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

示例1: ExcelConditionalFormattingRule

    /****************************************************************************************/

    #region Constructors
    /// <summary>
    /// Initialize the <see cref="ExcelConditionalFormattingRule"/>
    /// </summary>
    /// <param name="type"></param>
    /// <param name="address"></param>
    /// <param name="priority">Used also as the cfRule unique key</param>
    /// <param name="worksheet"></param>
    /// <param name="itemElementNode"></param>
    /// <param name="namespaceManager"></param>
    internal ExcelConditionalFormattingRule(
      eExcelConditionalFormattingRuleType type,
      ExcelAddress address,
      int priority,
      ExcelWorksheet worksheet,
      XmlNode itemElementNode,
      XmlNamespaceManager namespaceManager)
      : base(
        namespaceManager,
        itemElementNode)
    {
      Require.Argument(address).IsNotNull("address");

  	  // While MSDN states that 1 is the "highest priority," it also defines this
	  // field as W3C XML Schema int, which would allow values less than 1. Excel
	  // itself will, on occasion, use a value of 0, so this check will allow a 0.
      Require.Argument(priority).IsInRange(0, int.MaxValue, "priority");

      Require.Argument(worksheet).IsNotNull("worksheet");

      _type = type;
      _worksheet = worksheet;
      SchemaNodeOrder = _worksheet.SchemaNodeOrder;

      if (itemElementNode == null)
      {
        // Create/Get the <cfRule> inside <conditionalFormatting>
        itemElementNode = CreateComplexNode(
          _worksheet.WorksheetXml.DocumentElement,
          string.Format(
            "{0}[{1}='{2}']/{1}='{2}'/{3}[{4}='{5}']/{4}='{5}'",
          //{0}
            ExcelConditionalFormattingConstants.Paths.ConditionalFormatting,
          // {1}
            ExcelConditionalFormattingConstants.Paths.SqrefAttribute,
          // {2}
            address.AddressSpaceSeparated,          //CF node don't what to have comma between multi addresses, use space instead.
          // {3}
            ExcelConditionalFormattingConstants.Paths.CfRule,
          //{4}
            ExcelConditionalFormattingConstants.Paths.PriorityAttribute,
          //{5}
            priority));
      }

      // Point to <cfRule>
      TopNode = itemElementNode;

      Address = address;
      Priority = priority;
      Type = type;
      if (DxfId >= 0)
      {
          worksheet.Workbook.Styles.Dxfs[DxfId].AllowChange = true;  //This Id is referenced by CF, so we can use it when we save.
          _style = worksheet.Workbook.Styles.Dxfs[DxfId].Clone();    //Clone, so it can be altered without effecting other dxf styles
      }
    }
开发者ID:Eagle-Chan,项目名称:KIS,代码行数:69,代码来源:ExcelConditionalFormattingRule.cs

示例2: ExcelConditionalFormattingThreeColorScale

        /// <summary>
        /// 
        /// </summary>
        /// <param name="address"></param>
        /// <param name="priority"></param>
        /// <param name="worksheet"></param>
        /// <param name="itemElementNode"></param>
        /// <param name="namespaceManager"></param>
        internal ExcelConditionalFormattingThreeColorScale(
            ExcelAddress address,
            int priority,
            ExcelWorksheet worksheet,
            XmlNode itemElementNode,
            XmlNamespaceManager namespaceManager)
            : base(eExcelConditionalFormattingRuleType.ThreeColorScale,
        address,
        priority,
        worksheet,
        itemElementNode,
        (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
        {
            if (itemElementNode == null)
            {
                // Create the <colorScale> node inside the <cfRule> node
                var colorScaleNode = CreateComplexNode(
                  Node,
                  ExcelConditionalFormattingConstants.Paths.ColorScale);

                // LowValue default
                LowValue = new ExcelConditionalFormattingColorScaleValue(
                  eExcelConditionalFormattingValueObjectPosition.Low,
                  eExcelConditionalFormattingValueObjectType.Min,
                  ColorTranslator.FromHtml(ExcelConditionalFormattingConstants.Colors.CfvoLowValue),
                  eExcelConditionalFormattingRuleType.ThreeColorScale,
                  address,
                  priority,
                  worksheet,
                  NameSpaceManager);

                // MiddleValue default
                MiddleValue = new ExcelConditionalFormattingColorScaleValue(
                  eExcelConditionalFormattingValueObjectPosition.Middle,
                  eExcelConditionalFormattingValueObjectType.Percent,
                  ColorTranslator.FromHtml(ExcelConditionalFormattingConstants.Colors.CfvoMiddleValue),
                  50,
                  string.Empty,
                  eExcelConditionalFormattingRuleType.ThreeColorScale,
                  address,
                  priority,
                  worksheet,
                  NameSpaceManager);

                // HighValue default
                HighValue = new ExcelConditionalFormattingColorScaleValue(
                  eExcelConditionalFormattingValueObjectPosition.High,
                  eExcelConditionalFormattingValueObjectType.Max,
                  ColorTranslator.FromHtml(ExcelConditionalFormattingConstants.Colors.CfvoHighValue),
                  eExcelConditionalFormattingRuleType.ThreeColorScale,
                  address,
                  priority,
                  worksheet,
                  NameSpaceManager);
            }
        }
开发者ID:princeoffoods,项目名称:EPPlus,代码行数:64,代码来源:ExcelConditionalFormattingThreeColorScale.cs

示例3: RangeConditionalFormatting

    public RangeConditionalFormatting(
      ExcelWorksheet worksheet,
      ExcelAddress address)
    {
      Require.Argument(worksheet).IsNotNull("worksheet");
      Require.Argument(address).IsNotNull("address");

      _worksheet = worksheet;
      _address = address;
    }
开发者ID:Eagle-Chan,项目名称:KIS,代码行数:10,代码来源:RangeConditionalFormatting.cs

示例4: ExcelConditionalFormattingUniqueValues

 /// <summary>
 /// 
 /// </summary>
 /// <param name="priority"></param>
 /// <param name="address"></param>
 /// <param name="worksheet"></param>
 /// <param name="itemElementNode"></param>
 internal ExcelConditionalFormattingUniqueValues(
     ExcelAddress address,
     int priority,
     ExcelWorksheet worksheet,
     XmlNode itemElementNode)
     : this(address,
 priority,
 worksheet,
 itemElementNode,
 null)
 {
 }
开发者ID:ylatuya,项目名称:EPPlus,代码行数:19,代码来源:ExcelConditionalFormattingUniqueValues.cs

示例5: ExcelConditionalFormattingRule

        /// <summary>
        /// Initialize the <see cref="ExcelConditionalFormattingRule"/>
        /// </summary>
        /// <param name="type"></param>
        /// <param name="address"></param>
        /// <param name="priority">Used also as the cfRule unique key</param>
        /// <param name="worksheet"></param>
        /// <param name="itemElementNode"></param>
        /// <param name="namespaceManager"></param>
        internal ExcelConditionalFormattingRule(
            eExcelConditionalFormattingRuleType type,
            ExcelAddress address,
            int priority,
            ExcelWorksheet worksheet,
            XmlNode itemElementNode,
            XmlNamespaceManager namespaceManager)
            : base(namespaceManager,
        itemElementNode)
        {
            Require.Argument(address).IsNotNull("address");
              Require.Argument(priority).IsInRange(1, int.MaxValue, "priority");
              Require.Argument(worksheet).IsNotNull("worksheet");

              _type = type;
              _worksheet = worksheet;
              SchemaNodeOrder = _worksheet.SchemaNodeOrder;

              if (itemElementNode == null)
              {
            // Create/Get the <cfRule> inside <conditionalFormatting>
            itemElementNode = CreateComplexNode(
              _worksheet.WorksheetXml.DocumentElement,
              string.Format(
            "{0}[{1}='{2}']/{1}='{2}'/{3}[{4}='{5}']/{4}='{5}'",
              //{0}
            ExcelConditionalFormattingConstants.Paths.ConditionalFormatting,
              // {1}
            ExcelConditionalFormattingConstants.Paths.SqrefAttribute,
              // {2}
            address.Address,
              // {3}
            ExcelConditionalFormattingConstants.Paths.CfRule,
              //{4}
            ExcelConditionalFormattingConstants.Paths.PriorityAttribute,
              //{5}
            priority));
              }

              // Point to <cfRule>
              TopNode = itemElementNode;

              Address = address;
              Priority = priority;
              Type = type;
              if (DxfId >= 0)
              {
              worksheet.Workbook.Styles.Dxfs[DxfId].AllowChange = true;  //This Id is referenced by CF, so we can use it when we save.
              _style = worksheet.Workbook.Styles.Dxfs[DxfId].Clone();    //Clone, so it can be altered without effecting other dxf styles
              }
        }
开发者ID:ylatuya,项目名称:EPPlus,代码行数:60,代码来源:ExcelConditionalFormattingRule.cs

示例6: LookupArguments

        public LookupArguments(IEnumerable<FunctionArgument> arguments, ArgumentParsers argumentParsers, ParsingContext context)
        {
            _argumentParsers = argumentParsers;
            SearchedValue = arguments.ElementAt(0).Value;
            var arg1 = arguments.ElementAt(1).Value;
            var dataArray = arg1 as IEnumerable<FunctionArgument>;
            if (dataArray != null)
            {
                DataArray = dataArray;
                ArgumentDataType = LookupArgumentDataType.DataArray;
            }
            else
            {
                //if (arg1 is ExcelDataProvider.INameInfo) arg1 = ((ExcelDataProvider.INameInfo) arg1).Value;
                var rangeInfo = arg1 as ExcelDataProvider.IRangeInfo;
                if (rangeInfo != null)
                {
                    RangeAddress = string.IsNullOrEmpty(rangeInfo.Address.WorkSheet) ? rangeInfo.Address.Address : "'" + rangeInfo.Address.WorkSheet + "'!" + rangeInfo.Address.Address;
                    RangeInfo = rangeInfo;
                    ArgumentDataType = LookupArgumentDataType.ExcelRange;
                }
                else
                {
                    RangeAddress = arg1.ToString();
                    ArgumentDataType = LookupArgumentDataType.ExcelRange;
                }
            }
            var indexVal = arguments.ElementAt(2);

            if (indexVal.DataType == DataType.ExcelAddress)
            {
                var address = new ExcelAddress(indexVal.Value.ToString());
                var indexObj = context.ExcelDataProvider.GetRangeValue(address.WorkSheet, address._fromRow, address._fromCol);
                LookupIndex = (int) _argumentParsers.GetParser(DataType.Integer).Parse(indexObj);
            }
            else
            {
                LookupIndex = (int)_argumentParsers.GetParser(DataType.Integer).Parse(arguments.ElementAt(2).Value);
            }

            if (arguments.Count() > 3)
            {
                RangeLookup = (bool)_argumentParsers.GetParser(DataType.Boolean).Parse(arguments.ElementAt(3).Value);
            }
            else
            {
                RangeLookup = true;
            }
        }
开发者ID:princeoffoods,项目名称:EPPlus,代码行数:49,代码来源:LookupArguments.cs

示例7: ExcelConditionalFormattingExpression

 /// <summary>
 /// 
 /// </summary>
 /// <param name="type"></param>
 /// <param name="priority"></param>
 /// <param name="address"></param>
 /// <param name="worksheet"></param>
 /// <param name="itemElementNode"></param>
 /// <param name="namespaceManager"></param>
 internal ExcelConditionalFormattingExpression(
     ExcelAddress address,
     int priority,
     ExcelWorksheet worksheet,
     XmlNode itemElementNode,
     XmlNamespaceManager namespaceManager)
     : base(eExcelConditionalFormattingRuleType.Expression,
 address,
 priority,
 worksheet,
 itemElementNode,
 (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
 {
     Formula = string.Empty;
 }
开发者ID:ylatuya,项目名称:EPPlus,代码行数:24,代码来源:ExcelConditionalFormattingExpression.cs

示例8: ExcelConditionalFormattingTimePeriodGroup

 /// <summary>
 /// 
 /// </summary>
 /// <param name="type"></param>
 /// <param name="priority"></param>
 /// <param name="address"></param>
 /// <param name="worksheet"></param>
 /// <param name="itemElementNode"></param>
 /// <param name="namespaceManager"></param>
 internal ExcelConditionalFormattingTimePeriodGroup(
     eExcelConditionalFormattingRuleType type,
     ExcelAddress address,
     int priority,
     ExcelWorksheet worksheet,
     XmlNode itemElementNode,
     XmlNamespaceManager namespaceManager)
     : base(type,
 address,
 priority,
 worksheet,
 itemElementNode,
 (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
 {
 }
开发者ID:ylatuya,项目名称:EPPlus,代码行数:24,代码来源:ExcelConditionalFormattingTimePeriodGroup.cs

示例9: ExcelConditionalFormattingAboveAverage

 /// <summary>
 /// 
 /// </summary>
 /// <param name="priority"></param>
 /// <param name="address"></param>
 /// <param name="worksheet"></param>
 /// <param name="itemElementNode"></param>
 /// <param name="namespaceManager"></param>
 internal ExcelConditionalFormattingAboveAverage(
     ExcelAddress address,
     int priority,
     ExcelWorksheet worksheet,
     XmlNode itemElementNode,
     XmlNamespaceManager namespaceManager)
     : base(eExcelConditionalFormattingRuleType.AboveAverage,
 address,
 priority,
 worksheet,
 itemElementNode,
 (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
 {
     AboveAverage = true;
       EqualAverage = false;
 }
开发者ID:ylatuya,项目名称:EPPlus,代码行数:24,代码来源:ExcelConditionalFormattingAboveAverage.cs

示例10: ExcelConditionalFormattingBelowStdDev

 /// <summary>
 /// 
 /// </summary>
 /// <param name="priority"></param>
 /// <param name="address"></param>
 /// <param name="worksheet"></param>
 /// <param name="itemElementNode"></param>
 /// <param name="namespaceManager"></param>
 internal ExcelConditionalFormattingBelowStdDev(
     ExcelAddress address,
     int priority,
     ExcelWorksheet worksheet,
     XmlNode itemElementNode,
     XmlNamespaceManager namespaceManager)
     : base(eExcelConditionalFormattingRuleType.BelowStdDev,
 address,
 priority,
 worksheet,
 itemElementNode,
 (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
 {
     AboveAverage = false;
       StdDev = 1;
 }
开发者ID:ylatuya,项目名称:EPPlus,代码行数:24,代码来源:ExcelConditionalFormattingBelowStdDev.cs

示例11: ExcelConditionalFormattingNotEqual

 /// <summary>
 /// 
 /// </summary>
 /// <param name="type"></param>
 /// <param name="priority"></param>
 /// <param name="address"></param>
 /// <param name="worksheet"></param>
 /// <param name="itemElementNode"></param>
 /// <param name="namespaceManager"></param>
 internal ExcelConditionalFormattingNotEqual(
     ExcelAddress address,
     int priority,
     ExcelWorksheet worksheet,
     XmlNode itemElementNode,
     XmlNamespaceManager namespaceManager)
     : base(eExcelConditionalFormattingRuleType.NotEqual,
 address,
 priority,
 worksheet,
 itemElementNode,
 (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
 {
     Operator = eExcelConditionalFormattingOperatorType.NotEqual;
       Formula = string.Empty;
 }
开发者ID:ylatuya,项目名称:EPPlus,代码行数:25,代码来源:ExcelConditionalFormattingNotEqual.cs

示例12: Execute

        public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
        {
            var functionArguments = arguments as FunctionArgument[] ?? arguments.ToArray();
            ValidateArguments(functionArguments, 3);
            var startRange = ArgToString(functionArguments, 0);
            var rowOffset = ArgToInt(functionArguments, 1);
            var colOffset = ArgToInt(functionArguments, 2);
            int width = 0, height = 0;
            if (functionArguments.Length > 3)
            {
                height = ArgToInt(functionArguments, 3);
                ThrowExcelErrorValueExceptionIf(() => height == 0, eErrorType.Ref);
            }
            if (functionArguments.Length > 4)
            {
                width = ArgToInt(functionArguments, 4);
                ThrowExcelErrorValueExceptionIf(() => width == 0, eErrorType.Ref);
            }

            var adr = new ExcelAddress(startRange);
            var ws = adr.WorkSheet;

            var fromRow = adr._fromRow + rowOffset;
            var fromCol = adr._fromCol + colOffset;
            var toRow = (height != 0 ? height : adr._toRow) + rowOffset;
            var toCol = (width != 0 ? width : adr._toCol) + colOffset;
            //var toRow = (height != 0 ? fromRow + height : adr._toRow + rowOffset);
            //var toCol = (width != 0 ? fromCol + width : adr._toCol + colOffset);

            var newRange = context.ExcelDataProvider.GetRange(ws, fromRow, fromCol, toRow, toCol);
            if (!newRange.IsMulti)
            {
                if (newRange.IsEmpty) return CompileResult.Empty;
                var val = newRange.GetValue(fromRow, fromCol);
                if (IsNumeric(val))
                {
                    return CreateResult(val, DataType.Decimal);
                }
                if (val is ExcelErrorValue)
                {
                    return CreateResult(val, DataType.ExcelError);
                }
                return CreateResult(val, DataType.String);
            }
            return CreateResult(newRange, DataType.Enumerable);
        }
开发者ID:Eagle-Chan,项目名称:KIS,代码行数:46,代码来源:Offset.cs

示例13: Execute

 public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context)
 {
     ValidateArguments(arguments, 1);
     var address = ArgToString(arguments, 0);
     var adr = new ExcelAddress(address);
     var ws = adr.WorkSheet;
     if (string.IsNullOrEmpty(ws))
     {
         ws = context.Scopes.Current.Address.Worksheet;
     }
     var result = context.ExcelDataProvider.GetRange(ws, adr._fromRow, adr._fromCol, address);
     if (result.IsEmpty)
     {
         return CompileResult.Empty;
     }
     return new CompileResult(result, DataType.Enumerable);
 }
开发者ID:Eagle-Chan,项目名称:KIS,代码行数:17,代码来源:Indirect.cs

示例14: ExcelConditionalFormattingNotContainsBlanks

 /// <summary>
 /// 
 /// </summary>
 /// <param name="type"></param>
 /// <param name="priority"></param>
 /// <param name="address"></param>
 /// <param name="worksheet"></param>
 /// <param name="itemElementNode"></param>
 /// <param name="namespaceManager"></param>
 internal ExcelConditionalFormattingNotContainsBlanks(
     ExcelAddress address,
     int priority,
     ExcelWorksheet worksheet,
     XmlNode itemElementNode,
     XmlNamespaceManager namespaceManager)
     : base(eExcelConditionalFormattingRuleType.NotContainsBlanks,
 address,
 priority,
 worksheet,
 itemElementNode,
 (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
 {
     Formula = string.Format(
     "LEN(TRIM({0}))>0",
     Address.Start.Address);
 }
开发者ID:ylatuya,项目名称:EPPlus,代码行数:26,代码来源:ExcelConditionalFormattingNotContainsBlanks.cs

示例15: ExcelConditionalFormattingBottom

 /// <summary>
 /// 
 /// </summary>
 /// <param name="type"></param>
 /// <param name="priority"></param>
 /// <param name="address"></param>
 /// <param name="worksheet"></param>
 /// <param name="itemElementNode"></param>
 /// <param name="namespaceManager"></param>
 internal ExcelConditionalFormattingBottom(
     ExcelAddress address,
     int priority,
     ExcelWorksheet worksheet,
     XmlNode itemElementNode,
     XmlNamespaceManager namespaceManager)
     : base(eExcelConditionalFormattingRuleType.Bottom,
 address,
 priority,
 worksheet,
 itemElementNode,
 (namespaceManager == null) ? worksheet.NameSpaceManager : namespaceManager)
 {
     Bottom = true;
       Percent = false;
       Rank = 10;  // Last 10 values
 }
开发者ID:ylatuya,项目名称:EPPlus,代码行数:26,代码来源:ExcelConditionalFormattingBottom.cs


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