Class ExtendedAttributeDefinition

Class ExtendedAttributeDefinition

Namespace: Aspose.Tasks
Assembly: Aspose.Tasks.dll (25.2.0)

表示与项目相关的扩展属性定义。

[ClassInterface(ClassInterfaceType.AutoDual)]
public class ExtendedAttributeDefinition

继承

objectExtendedAttributeDefinition

继承成员

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

属性

别名

获取或设置自定义字段的别名。

public string Alias { get; set; }

属性值

string

AppendNewValues

获取或设置一个值,指示是否将添加到项目的新值自动添加到列表中。

public bool AppendNewValues { get; set; }

属性值

bool

备注

目前支持MSP 2003/2007 Xml和MSP 2003 mpp格式。

AutoRollDown

获取或设置一个值,指示是否启用自动下滚到分配。

public bool AutoRollDown { get; set; }

属性值

bool

CalculationType

获取或设置自定义属性值的计算类型。

public CalculationType CalculationType { get; set; }

属性值

CalculationType

CfType

获取自定义字段的类型。

public CustomFieldType CfType { get; }

属性值

CustomFieldType

Default

获取或设置列表中的默认值。

public string Default { get; set; }

属性值

string

备注

目前支持MSP 2003/2007 Xml和MSP 2003 mpp格式。

DefaultGuid

获取或设置默认查找表条目的Guid。

public string DefaultGuid { get; set; }

属性值

string

ElementType

获取或设置扩展属性与任务、资源或分配的关联。

public ElementType ElementType { get; set; }

属性值

ElementType

FieldId

获取或设置对应于自定义字段的项目ID。 使用Aspose.Tasks.ExtendedAttributeTask类中的常量的字符串表示来指定Aspose.Tasks.ExtendedAttributeDefinition.FieldId属性。

public string FieldId { get; set; }

属性值

string

示例

customFieldDefinition.FieldId = Aspose.Tasks.ExtendedAttributeTask.Number10.ToString("D");

备注

设置Aspose.Tasks.ExtendedAttributeDefinition.FieldId属性的首选方法是使用专用工厂方法之一,如Aspose.Tasks.ExtendedAttributeDefinition.CreateTaskDefinition(Aspose.Tasks.ExtendedAttributeTask,System.String)或Aspose.Tasks.ExtendedAttributeDefinition.CreateLookupTaskDefinition(Aspose.Tasks.CustomFieldType,Aspose.Tasks.ExtendedAttributeTask,System.String)。

FieldName

获取自定义字段的名称。

public string FieldName { get; }

属性值

string

备注

不应直接设置,而应使用名为Create*Definition()的强类型静态工厂方法创建ExtendedAttributeDefinition。

Formula

获取或设置Microsoft Project用于填充自定义任务字段的公式。

public string Formula { get; set; }

属性值

string

GraphicalIndicator

获取或设置与扩展属性相关的图形指示器信息。 适用于MPP格式。

public GraphicalIndicatorsInfo GraphicalIndicator { get; set; }

属性值

GraphicalIndicatorsInfo

Guid

获取或设置自定义字段的Guid。

public string Guid { get; set; }

属性值

string

备注

目前仅支持Xml格式。

LookupUid

获取与自定义字段关联的查找表的Guid。

public string LookupUid { get; }

属性值

string

备注

要创建带有查找的自定义字段,请使用以下工厂方法之一:Aspose.Tasks.ExtendedAttributeDefinition.CreateLookupTaskDefinition(Aspose.Tasks.CustomFieldType,Aspose.Tasks.ExtendedAttributeTask,System.String)或Aspose.Tasks.ExtendedAttributeDefinition.CreateLookupResourceDefinition(Aspose.Tasks.CustomFieldType,Aspose.Tasks.ExtendedAttributeResource,System.String)。

MaxMultiValues

获取或设置可以在下拉列表中设置的最大值数量。

public int MaxMultiValues { get; set; }

属性值

int

备注

目前仅支持Xml格式。

ParentProject

获取Aspose.Tasks.ExtendedAttributeDefinition实例的父项目。

public Project ParentProject { get; }

属性值

Project

PhoneticsAlias

获取或设置自定义字段别名的拼音发音。

public string PhoneticsAlias { get; set; }

属性值

string

备注

目前仅支持Xml格式。

RestrictValues

获取或设置一个值,指示自定义字段值是否仅限于Aspose.Tasks.ExtendedAttributeDefinition.ValueList中的值。

public bool RestrictValues { get; set; }

属性值

bool

RollupType

获取或设置汇总的计算方式。

public RollupType RollupType { get; set; }

属性值

RollupType

备注

写入目前仅支持Xml格式。

SecondaryGuid

获取或设置扩展属性的次要guid。

public string SecondaryGuid { get; set; }

属性值

string

备注

这是MS Project 2010的新属性。

SecondaryPid

获取或设置自定义字段的次要PID。

public string SecondaryPid { get; set; }

属性值

string

SummaryRowsCalculationType

获取或设置摘要行的自定义属性值的计算类型。

public SummaryRowsCalculationType SummaryRowsCalculationType { get; set; }

属性值

SummaryRowsCalculationType

UserDef

获取或设置一个值,指示自定义字段是否为用户定义。

public bool UserDef { get; set; }

属性值

bool

备注

目前仅支持Xml格式。

ValueList

获取List<Value> ValueList。

public List<value> ValueList { get; }

属性值

List<Value&gt;

备注

当扩展属性的值作为架构中元素的属性指定时,可以通过值或对包含在此列表中的值的引用进行指定。 应用程序可以假定按此处指定的顺序对列表进行排序。 目前支持MSP 2003/2007 Xml和MSP 2003 mpp格式。 请勿直接更改此列表。请使用ExtendedAttributeDefinition.AddLookupValue/RemoveLookupValue方法。

ValuelistSortOrder

获取或设置值列表的排序方式。值为:0=降序,1=升序。

public int ValuelistSortOrder { get; set; }

属性值

int

备注

目前支持MSP 2003/2007 Xml和MSP 2003 mpp格式。

方法

AddLookupValue(Value)

向内部查找列表添加一个值。这是操作Aspose.Tasks.ExtendedAttributeDefinition.ValueList的首选方法。

public void AddLookupValue(Value value)

参数

value Value

要添加到查找中的值。

示例

使用此代码将新值添加到查找列表: taskTextAttr.AddLookupValue(new Value { Id = 1, Val = "Text value 1", Description = "Text value description 1" });

备注

此方法仅适用于Aspose.Tasks.ExtendedAttributeDefinition实例 其Aspose.Tasks.ExtendedAttributeDefinition.CalculationType等于Aspose.Tasks.CalculationType.Lookup。

CreateExtendedAttribute()

创建一个新的扩展属性,其字段ID等于此对象的字段ID值。

public ExtendedAttribute CreateExtendedAttribute()

返回

ExtendedAttribute

返回创建的Aspose.Tasks.ExtendedAttribute类的实例,其fieldID等于此对象的fieldID值。

CreateExtendedAttribute(string)

创建一个新的扩展属性,其字段ID等于此对象的字段ID值和指定的文本值。

public ExtendedAttribute CreateExtendedAttribute(string textValue)

参数

textValue string

指定的文本值。

返回

ExtendedAttribute

返回创建的Aspose.Tasks.ExtendedAttribute类的实例,其fieldID等于此对象的fieldID值。

异常

InvalidOperationException

如果当前Aspose.Tasks.ExtendedAttributeDefinition.CfType不是’Text'

CreateExtendedAttribute(decimal)

创建一个新的扩展属性,其字段ID等于此对象的字段ID值和指定的数值。

public ExtendedAttribute CreateExtendedAttribute(decimal numericValue)

参数

numericValue decimal

指定的数值。

返回

ExtendedAttribute

返回创建的Aspose.Tasks.ExtendedAttribute类的实例,其fieldID等于此对象的fieldID值。

异常

InvalidOperationException

如果当前Aspose.Tasks.ExtendedAttributeDefinition.CfType不是’Number’或’Cost'

CreateExtendedAttribute(DateTime)

创建一个新的扩展属性,其字段ID等于此对象的字段ID值和指定的日期值。

public ExtendedAttribute CreateExtendedAttribute(DateTime dateTimeValue)

参数

dateTimeValue DateTime

指定的日期时间值。

返回

ExtendedAttribute

返回创建的Aspose.Tasks.ExtendedAttribute类的实例,其fieldID等于此对象的fieldID值。

异常

InvalidOperationException

如果当前Aspose.Tasks.ExtendedAttributeDefinition.CfType不是’Date’、‘Start’或’Finish’

CreateExtendedAttribute(Duration)

创建一个新的扩展属性,其字段ID等于此对象的字段ID值和指定的持续时间值。

public ExtendedAttribute CreateExtendedAttribute(Duration durationValue)

参数

durationValue Duration

指定的持续时间值。

返回

ExtendedAttribute

返回创建的Aspose.Tasks.ExtendedAttribute类的实例,其fieldID等于此对象的fieldID值。

异常

InvalidOperationException

如果当前Aspose.Tasks.ExtendedAttributeDefinition.CfType不是’Duration'

CreateExtendedAttribute(bool)

创建一个新的扩展属性,其字段ID等于此对象的字段ID值和指定的标志值。

public ExtendedAttribute CreateExtendedAttribute(bool flagValue)

参数

flagValue bool

指定的标志值。

返回

ExtendedAttribute

返回创建的Aspose.Tasks.ExtendedAttribute类的实例,其fieldID等于此对象的fieldID值。

异常

InvalidOperationException

如果当前Aspose.Tasks.ExtendedAttributeDefinition.CfType不是’Flag'

CreateExtendedAttribute(Value)

创建与指定的Aspose.Tasks.Value项链接的新扩展属性。

public ExtendedAttribute CreateExtendedAttribute(Value lookupValue)

参数

lookupValue Value

指定的Aspose.Tasks.Value项。

返回

ExtendedAttribute

返回与指定的Aspose.Tasks.Value项链接的创建的Aspose.Tasks.ExtendedAttribute类的实例。

示例

使用此代码使用特定值创建新的Aspose.Tasks.ExtendedAttribute:

taskTextAttr.AddLookupValue(value1);
taskTextAttr.AddLookupValue(value2);
var extendedAttribute = taskTextAttr.CreateExtendedAttribute(value2);

备注

lookupValue应先使用Aspose.Tasks.ExtendedAttributeDefinition.AddLookupValue(Aspose.Tasks.Value)方法添加到Aspose.Tasks.ExtendedAttributeDefinition。

CreateLookupResourceDefinition(ExtendedAttributeResource, string)

创建带有查找的扩展属性定义的工厂方法。 它的Aspose.Tasks.ExtendedAttributeDefinition.CalculationType等于Aspose.Tasks.CalculationType.Lookup,并且仅可在资源中使用。 调用此方法时,您需要指定fieldIdalias。 字段类型由字段ID推断。

public static ExtendedAttributeDefinition CreateLookupResourceDefinition(ExtendedAttributeResource fieldId, string alias)

参数

fieldId ExtendedAttributeResource

指定的Aspose.Tasks.ExtendedAttributeResource字段ID。

alias string

指定的System.String别名。

返回

ExtendedAttributeDefinition

创建的Aspose.Tasks.ExtendedAttributeDefinition类的实例,具有指定的fieldIdalias

示例

使用此示例为资源创建带查找的自定义字段定义,然后用文本值填充:

var resourceTextAttr = ExtendedAttributeDefinition.CreateLookupResourceDefinition(ExtendedAttributeResource.Text27, "My custom field");
resourceTextAttr.AddLookupValue(new Value { Id = 1, Val = "Text value 1", Description = "Text value description 1" });
resourceTextAttr.AddLookupValue(new Value { Id = 2, Val = "Text value 2", Description = "Text value description 2" });
project.ExtendedAttributes.Add(resourceTextAttr);

CreateLookupResourceDefinition(CustomFieldType, ExtendedAttributeResource, string)

创建带有查找的扩展属性定义的工厂方法。 它的Aspose.Tasks.ExtendedAttributeDefinition.CalculationType等于Aspose.Tasks.CalculationType.Lookup,并且仅可在资源中使用。 调用此方法时,您需要指定customFieldTypefieldIdalias

public static ExtendedAttributeDefinition CreateLookupResourceDefinition(CustomFieldType customFieldType, ExtendedAttributeResource fieldId, string alias)

参数

customFieldType CustomFieldType

指定的Aspose.Tasks.CustomFieldType类型。

fieldId ExtendedAttributeResource

指定的Aspose.Tasks.ExtendedAttributeResource字段ID。

alias string

指定的System.String别名。

返回

ExtendedAttributeDefinition

创建的Aspose.Tasks.ExtendedAttributeDefinition类的实例,具有指定的customFieldTypefieldIdalias

示例

使用此示例为资源创建带查找的自定义字段定义,然后用文本值填充:

var resourceTextAttr = ExtendedAttributeDefinition.CreateLookupResourceDefinition(CustomFieldType.Text, ExtendedAttributeResource.Text27, "My custom field");
resourceTextAttr.AddLookupValue(new Value { Id = 1, Val = "Text value 1", Description = "Text value description 1" });
resourceTextAttr.AddLookupValue(new Value { Id = 2, Val = "Text value 2", Description = "Text value description 2" });
project.ExtendedAttributes.Add(resourceTextAttr);

CreateLookupTaskDefinition(ExtendedAttributeTask, string)

创建带有查找的扩展属性定义的工厂方法。 它的Aspose.Tasks.ExtendedAttributeDefinition.CalculationType等于Aspose.Tasks.CalculationType.Lookup,并且仅可在任务中使用。 调用此方法时,您需要指定fieldIdalias。 字段类型由字段ID推断。

public static ExtendedAttributeDefinition CreateLookupTaskDefinition(ExtendedAttributeTask fieldId, string alias)

参数

fieldId ExtendedAttributeTask

指定的Aspose.Tasks.ExtendedAttributeTask字段ID。

alias string

指定的System.String别名。

返回

ExtendedAttributeDefinition

创建的Aspose.Tasks.ExtendedAttributeDefinition类的实例,具有指定的fieldIdalias

示例

使用此示例为任务创建带查找的自定义字段定义,然后用文本值填充:

var taskTextAttr = ExtendedAttributeDefinition.CreateLookupTaskDefinition(ExtendedAttributeTask.Text27, "My custom field");
taskTextAttr.AddLookupValue(new Value { Id = 1, Val = "Text value 1", Description = "Text value description 1" });
taskTextAttr.AddLookupValue(new Value { Id = 2, Val = "Text value 2", Description = "Text value description 2" });
project.ExtendedAttributes.Add(taskTextAttr);

CreateLookupTaskDefinition(CustomFieldType, ExtendedAttributeTask, string)

创建带有查找的扩展属性定义的工厂方法。 它的Aspose.Tasks.ExtendedAttributeDefinition.CalculationType等于Aspose.Tasks.CalculationType.Lookup,并且仅可在任务中使用。 调用此方法时,您需要指定customFieldTypefieldIdalias

public static ExtendedAttributeDefinition CreateLookupTaskDefinition(CustomFieldType customFieldType, ExtendedAttributeTask fieldId, string alias)

参数

customFieldType CustomFieldType

指定的Aspose.Tasks.CustomFieldType类型。

fieldId ExtendedAttributeTask

指定的Aspose.Tasks.ExtendedAttributeTask字段ID。

alias string

指定的System.String别名。

返回

ExtendedAttributeDefinition

创建的Aspose.Tasks.ExtendedAttributeDefinition类的实例,具有指定的customFieldTypefieldIdalias

示例

使用此示例为任务创建带查找的自定义字段定义,然后用文本值填充:

var taskTextAttr = ExtendedAttributeDefinition.CreateLookupTaskDefinition(CustomFieldType.Text, ExtendedAttributeTask.Text27, "My custom field");
taskTextAttr.AddLookupValue(new Value { Id = 1, Val = "Text value 1", Description = "Text value description 1" });
taskTextAttr.AddLookupValue(new Value { Id = 2, Val = "Text value 2", Description = "Text value description 2" });
project.ExtendedAttributes.Add(taskTextAttr);

CreateResourceDefinition(CustomFieldType, ExtendedAttributeResource, string)

创建一个简单的扩展属性定义,Microsoft Project显示为“无”。 它的Aspose.Tasks.ExtendedAttributeDefinition.CalculationType等于Aspose.Tasks.CalculationType.None,并且仅可在资源中使用。 调用此方法时,您需要指定customFieldTypefieldIdalias

public static ExtendedAttributeDefinition CreateResourceDefinition(CustomFieldType customFieldType, ExtendedAttributeResource fieldId, string alias)

参数

customFieldType CustomFieldType

指定的Aspose.Tasks.CustomFieldType类型。

fieldId ExtendedAttributeResource

指定的Aspose.Tasks.ExtendedAttributeResource字段ID。

alias string

指定的System.String别名。

返回

ExtendedAttributeDefinition

创建的Aspose.Tasks.ExtendedAttributeDefinition类的实例,具有指定的customFieldTypefieldIdalias

示例

使用此示例创建自定义文本字段定义:

var resourceTextAttr = ExtendedAttributeDefinition.CreateResourceDefinition(CustomFieldType.Text, ExtendedAttributeResource.Text27, "My custom field");
project.ExtendedAttributes.Add(resourceTextAttr);

CreateResourceDefinition(ExtendedAttributeResource, string)

创建一个简单的扩展属性定义,Microsoft Project显示为“无”。 它的Aspose.Tasks.ExtendedAttributeDefinition.CalculationType等于Aspose.Tasks.CalculationType.None,并且仅可在资源中使用。 调用此方法时,您需要指定fieldIdalias。 字段类型由字段ID推断。

public static ExtendedAttributeDefinition CreateResourceDefinition(ExtendedAttributeResource fieldId, string alias)

参数

fieldId ExtendedAttributeResource

指定的Aspose.Tasks.ExtendedAttributeResource字段ID。

alias string

指定的System.String别名。

返回

ExtendedAttributeDefinition

创建的Aspose.Tasks.ExtendedAttributeDefinition类的实例,具有指定的fieldIdalias

示例

使用此示例创建自定义文本字段定义:

var resourceTextAttr = ExtendedAttributeDefinition.CreateResourceDefinition(ExtendedAttributeResource.Text27, "My custom field");
project.ExtendedAttributes.Add(resourceTextAttr);

CreateTaskDefinition(CustomFieldType, ExtendedAttributeTask, string)

创建一个简单的扩展属性定义,Microsoft Project显示为“无”。 它的Aspose.Tasks.ExtendedAttributeDefinition.CalculationType等于Aspose.Tasks.CalculationType.None,并且仅可在任务中使用。 调用此方法时,您需要指定customFieldTypefieldIdalias

public static ExtendedAttributeDefinition CreateTaskDefinition(CustomFieldType customFieldType, ExtendedAttributeTask fieldId, string alias)

参数

customFieldType CustomFieldType

指定的Aspose.Tasks.CustomFieldType类型。

fieldId ExtendedAttributeTask

指定的Aspose.Tasks.ExtendedAttributeTask字段ID。

alias string

指定的System.String别名。

返回

ExtendedAttributeDefinition

创建的Aspose.Tasks.ExtendedAttributeDefinition类的实例,具有指定的customFieldTypefieldIdalias

示例

使用此示例创建自定义文本字段定义:

var taskTextAttr = ExtendedAttributeDefinition.CreateTaskDefinition(CustomFieldType.Text, ExtendedAttributeTask.Text27, "My custom field");
project.ExtendedAttributes.Add(taskTextAttr);

CreateTaskDefinition(ExtendedAttributeTask, string)

创建一个简单的扩展属性定义,Microsoft Project显示为“无”。 它的Aspose.Tasks.ExtendedAttributeDefinition.CalculationType等于Aspose.Tasks.CalculationType.None,并且仅可在任务中使用。 调用此方法时,您需要指定fieldIdalias。 字段类型由字段ID推断。

public static ExtendedAttributeDefinition CreateTaskDefinition(ExtendedAttributeTask fieldId, string alias)

参数

fieldId ExtendedAttributeTask

指定的Aspose.Tasks.ExtendedAttributeTask字段ID。

alias string

指定的System.String别名。

返回

ExtendedAttributeDefinition

创建的Aspose.Tasks.ExtendedAttributeDefinition类的实例,具有指定的fieldIdalias

示例

使用此示例创建自定义文本字段定义:

var taskTextAttr = ExtendedAttributeDefinition.CreateTaskDefinition(ExtendedAttributeTask.Text27, "My custom field");
project.ExtendedAttributes.Add(taskTextAttr);

Equals(object)

返回一个标志,指示此实例是否等于指定对象。

public override bool Equals(object obj)

参数

obj object

要与此实例进行比较的指定对象。

返回

bool

一个标志,指示此实例是否等于指定对象。

GetHashCode()

返回Aspose.Tasks.ExtendedAttributeDefinition类实例的哈希码。

public override int GetHashCode()

返回

int

此对象的哈希码。

RemoveLookupValue(Value)

从内部查找列表中删除一个值。这是操作Aspose.Tasks.ExtendedAttributeDefinition.ValueList的首选方法。

public void RemoveLookupValue(Value value)

参数

value Value

要从查找中删除的值。

备注

此方法仅适用于Aspose.Tasks.ExtendedAttributeDefinition实例 其Aspose.Tasks.ExtendedAttributeDefinition.CalculationType等于Aspose.Tasks.CalculationType.Lookup。

 中文