Renumber WBS Codes with Aspose.Tasks for .NET 18.2

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

aspose-tasks-for-netWe are pleased to announce the release of Aspose.Tasks for .NET 18.2. This new version of API introduces a new feature of renumbering WBS Codes for tasks like Renumber function of Microsoft Project. It also provides an enhancement to get page count from a document for defined start and end dates. For a detailed note on what is new and fixed, you can visit the release notes section of API documentation.

Renumber WBS Codes using Aspose.Tasks for .NET

Aspose.Tasks for .NET API lets you work with WBS codes associated with tasks in a project. This latest release of API introduces a new feature of Renumbering WBS codes for tasks like Microsoft Project’s Renumber functionality. It lets you renumber all or selective WBS codes of tasks in a project as shown in the following code sample.

var project = new Project(dataDir + "RenumberExample.mpp");

var tasks = project.RootTask.SelectAllChildTasks().ToList();

Console.WriteLine("WBS codes before: ");

// output: ""; "1"; "2"; "4"
foreach (var task in tasks)
{
    Console.WriteLine("\"" + task.Get(Tsk.WBS) + "\"" + "; ");
}

// project.RenumberWBSCode(); // this overload could have used too
project.RenumberWBSCode(new List { 1, 2, 3 });

Console.WriteLine("\nWBS codes after: ");

// output: ""; "1"; "2"; "3"
foreach (var task in tasks)
{
    Console.WriteLine("\"" + task.Get(Tsk.WBS) + "\"" + "; ");
}

Get Page Count for Specific Dates

This release also introduces an enhancement for getting number of pages based on specified Start and End dates. This feature can be used to get specific page count for specified dates even during conversion to various output formats.

Project project = new Project(dataDir + "GetNumberOfPages.mpp");

var options = new ImageSaveOptions(SaveFileFormat.PNG)
{
    SaveToSeparateFiles = true,
    PageSize = PageSize.A3,
    Timescale = Timescale.Months,
    StartDate = project.Get(Prj.StartDate) - TimeSpan.FromDays(10),
    EndDate = project.Get(Prj.FinishDate) + TimeSpan.FromDays(30)
};
int pageCount = project.GetPageCount(
    PageSize.A3,
    Timescale.Months,
    project.Get(Prj.StartDate) - TimeSpan.FromDays(10),
    project.Get(Prj.FinishDate) + TimeSpan.FromDays(30));

Console.WriteLine(pageCount);

API Resources

You may visit the following API resources for getting started and working with the API.

  • Product Documentation – Detailed API documentation with code examples and details about API functional areas
  • Aspose.Tasks Forum – Our online support forum where we address your queries and inquiries

To keep up with our news, you can follow us on Twitter or follow our Facebook page.

Leave a Reply