Définition des attributs pour de nouvelles tâches

Définition des attributs pour les nouvelles tâches

Microsoft Project permet de définir les propriétés par défaut pour les nouvelles tâches ajoutées. Ce sujet explique comment définir la date de début par défaut pour les nouvelles tâches à l’aide d’Aspose.Tasks pour l’API C ++.

La classe Project expose la propriété NewTaskStartDate qui définit la date de début d’une nouvelle tâche. Cette propriété prend en charge les valeurs définies par le type d’énumération TaskStartDateType.

Pour voir l’attribut de tâche:

  1. Ouvrez le fichier avec Microsoft Project.

  2. Dans le menu outils, sélectionnez Options.

  3. Sélectionnez l’onglet Schedule.

The tab looks like the one shown below.

New tasks set to start on the current date

edit task’s schedule options in Microsoft Project

The code example given below demonstrates how to set the new task start date.

 1// The path to the documents directory.
 2System::String dataDir = RunExamples::GetDataDir(System::Reflection::MethodBase::GetCurrentMethod(ASPOSE_CURRENT_FUNCTION)->get_DeclaringType().get_FullName());
 3    
 4// Create a project instance Set new task property and Save the project as XML project file
 5System::SharedPtr<Project> project = System::MakeObject<Project>();
 6project->Set<TaskStartDateType>(Prj::NewTaskStartDate(), Aspose::Tasks::TaskStartDateType::CurrentDate);
 7project->Save(dataDir + u"SetAttributesForNewTasks_out.xml", Aspose::Tasks::Saving::SaveFileFormat::XML);
 8    
 9// Display Status.
10System::Console::WriteLine(u"New Task created with start date successfully.");
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.