Hi,
I’m adding values to the values list of an extended attribute definition as outlined in Aspose documentation sample. The lookup values are added, however, when I view the custom field via MS Project the “Lookup” radio button is not selected. Should adding values to the value list auto select this option? Or is there additional logic that needs to be added? See code below:
public void ExportAsPdf(Project asposeProject, MemoryStream stream, DateLabel middleLabel, DateLabel bottomLabel)
{
GanttChartView view = new GanttChartView();
asposeProject.Views.Add(view);
Project _project = new Project("C:\\WBSTemplate.mpp");// Create a new project task
ExtendedAttributeDefinition taskTextAttr = new ExtendedAttributeDefinition();
taskTextAttr.Alias = "New text3 attribute";
taskTextAttr.FieldName = "Text3";
taskTextAttr.ElementType = ElementType.Task;
taskTextAttr.CfType = CustomFieldType.Text;
taskTextAttr.FieldId = Convert.ToInt32(ExtendedAttributeTask.Text3).ToString();
taskTextAttr.LookupUid = Guid.NewGuid().ToString();
_project.ExtendedAttributes.Add(taskTextAttr);
Value textVal = new Value();
textVal.Id = 1;
textVal.Description = "Text value descr";
textVal.Val = "Text value1";
taskTextAttr.ValueList.Add(textVal);
// add a task to see the result in MSP
Task task = _project.RootTask.Children.Add("Task");
foreach (ExtendedAttributeDefinition ea in _project.ExtendedAttributes)
{
task.ExtendedAttributes.Add(_project.ExtendedAttributes.GetById(Convert.ToInt32(ea.FieldId)).CreateExtendedAttribute());
}
MPPSaveOptions mppSaveOptions = new MPPSaveOptions();
mppSaveOptions.WriteViewData = true;
// The result of opening of saved project in MSP2010 is in attached screenshot
_project.Save("C:\\WBS\\LIVE\\1116_16\\Project1.mpp", mppSaveOptions);
I’ve downloaded a trial version of 9.2.1 of which I have a temporary license for evaluation. I’m using VS 2010 and MS Project 2010.
Thanks, Calvin