We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Add a ExtendedAttribute and make it visible in MSProject


I should export data of a Gantt to MSProject, but I need to add a “Description” field.

I followed the guide to add a ExtendedAttribute and partly working, because is actually written in XML output, but when I opened the XML file in
MSProject the custom field is not visible.
However if I manually add the field “Description (Text1)” I see the field values that I set in the source code.

There is a way to make the field visible when the XML file is open in MSProject?

This is the code I used

<span style=“font-size: 10pt; font-family: “Courier New”; color: blue;” lang=“EN-GB”>Dim<span style=“font-size: 10pt; font-family: “Courier New”;” lang=“EN-GB”> attr As ExtendedAttribute<o:p></o:p>

Dim eas As ArrayList

Dim ead As ExtendedAttributeDefinition

Dim eads As ArrayList

eads = prj.ExtendedAttributes

If eads Is Nothing Then

eads = New ArrayList()

prj.ExtendedAttributes = eads

End If

ead = New ExtendedAttributeDefinition()

ead.FieldId = CType(ExtendedAttributeTask.Text1, Integer).ToString

ead.Alias = "Description"


For Each row As DataRow In dtTasks.Rows

tsk = New Task(row("IDNRR"))

tsk.Uid = row("Uid")

tsk.Start = row("Start")

tsk.DurationFormat = TimeUnitType.Day

tsk.Duration = row("Duration")

eas = tsk.ExtendedAttribute

If eas Is Nothing Then

eas = New ArrayList()

tsk.ExtendedAttribute = eas

End If

attr = New ExtendedAttribute()

attr.FieldId = ead.FieldId

attr.Value = row("Description").ToString




Hi Marco,

We need a couple of days to investigate the issue. Sorry for inconvenience.

Hi Marco,

Unfortunately I was not able to repeat the issue on my side.

I used a code below and test data from attachment:

<span style=“font-size:10.0pt;font-family:“Courier New”;color:blue;mso-no-proof:yes”>Imports<span style=“font-size:10.0pt;font-family:“Courier New”;mso-no-proof:yes”>

Module Module1

Sub Main()

Dim prj As Project

Dim reader As ProjectReader

Dim writer As ProjectWriter

Dim ead As ExtendedAttributeDefinition

Dim ea As ExtendedAttribute

'read project data from xml

reader = New ProjectReader()

prj = reader.Read("project.xml")

'add extended attribute definition

ead = New ExtendedAttributeDefinition()

ead.FieldName = "Text1"

ead.Alias = "Description"

ead.FieldId = CType(ExtendedAttributeTask.Text1, Integer).ToString

prj.ExtendedAttributes = New ArrayList()


For Each task As Task In prj.RootTask.Children

task.ExtendedAttribute = New ArrayList()

ea = New ExtendedAttribute()

ea.FieldId = ead.FieldId

ea.Value = String.Format("Description of '{0}'.", task.Name)



'write to xml

writer = New ProjectWriter()

writer.Write(prj, "project_res.xml", TasksDataFormat.XML)

End Sub

End Module

As a result I can open the resulting XML file by MS Project 2007, add the Text1 column to the Gantt Chart view (insert column) and see the data. In case if the extended attribute definition's alias was assigned I can see the description in task's custom fields tab as well.

Please note, that the Text1 column can not be made visible by default as XML format does not contain any current view settings.