Browse our Products

Aspose.Tasks for .NET 21.9 Release Notes

All Changes

KeySummaryIssue Type
TASKSNET-4609Implement feature “Fit to X pages tall and Y pages wide”New Feature
TASKSNET-10333Add support for scaling with given scale factorNew Feature
TASKSNET-10344Fix ‘The start time should be not greater than the finish one’ exception when creating project from Primavera .xer fileBug
TASKSNET-4757Fix invalid position of progress rectangle in task bars in Gantt chartBug
TASKSNET-10345Fix reading of values of lookup extended attributesBug

Public API and Backwards Incompatible Changes

Examples and additional notes

Related issue: TASKSNET-10333 - Add support for scaling with given scale factor

Now PageSettings.PercentOfNormalSize and PageSettings.AdjustToPercentOfNormalSize properties are taken into account when View is rendered. These properties correspond to “Adjust to X % normal size” field of “Page Setup” dialog of MS Project:

Page settings dialog

Values of these properties are stored in MPP file and one can set values of these properties to render a view with a given scale factor:

Project project = new Project("Project.mpp");

var ganttChartView = project.Views.FirstOrDefault(v => v.Screen == ViewScreen.Gantt);
ganttChartView.PageInfo.PageSettings.AdjustToPercentOfNormalSize = true;
ganttChartView.PageInfo.PageSettings.PercentOfNormalSize = 45;

PdfSaveOptions saveOptions = new PdfSaveOptions()
{
    StartDate = new DateTime(2021, 09, 16),
    EndDate = new DateTime(2021, 12, 31),
    ViewSettings = ganttChartView,
    Timescale = Timescale.DefinedInView
};

project.Save("OutputScaledTo45.pdf", saveOptions);
Related issue: TASKSNET-4609 - Implement feature “Fit to X pages tall and Y pages wide”

Now PageSettings.PagesInWidth and PageSettings.PagesInHeight are taken into account when View is rendered. These properties correspond to “Fit to X pages wide by Y tall” fields of “Page Setup” dialog of MS Project. The properties can be used to fit the rendered view to the specified number of pages in width and height:

Project project = new Project("Project.mpp");

var taskUsageView= project.Views.FirstOrDefault(v => v.Screen == ViewScreen.TaskUsage);
taskUsageView.PageInfo.PageSettings.AdjustToPercentOfNormalSize = false;
taskUsageView.PageInfo.PageSettings.PagesInWidth = 2;
taskUsageView.PageInfo.PageSettings.PagesInHeight = 2;

PdfSaveOptions saveOptions = new PdfSaveOptions()
{
    ViewSettings = taskUsageView,
    StartDate = new DateTime(2021, 09, 16),
    EndDate = new DateTime(2021, 12, 31),
    Timescale = Timescale.DefinedInView
};

project.Save("OutputFitTo2х2.pdf", saveOptions);