Highlighting overallocated resources in PDF reports helps project teams spot scheduling risks early. With Aspose.Tasks for .NET, the most reliable approach is to export the built‑in Overallocated Resources report and, when needed, render the Resource Usage view for time‑phased detail. This guide shows a practical workflow that avoids common pitfalls and produces clear, shareable PDFs.
Key Takeaways
- Use
Project.SaveReport(..., ReportType.OverallocatedResources)to generate a PDF that clearly flags problem resources. - Ensure calculations are up to date: set
CalculationMode = Automaticor callproject.Recalculate()before exporting. - For day‑by‑day context, also export the Resource Usage view via
PdfSaveOptionswith a daily timescale. - Large projects: control page count with timescale and fit options (
FitContent,ReduceFooterGap) when exporting.
Step‑by‑Step: From MPP to a Highlighted PDF
1) Load your project
Provide the path to an existing .mpp file and enable automatic calculation so overallocation flags are fresh.
2) Export the Overallocated Resources report (primary highlight)
This built‑in report is designed to call out overallocations clearly without custom styling.
3) (Optional) Export the Resource Usage view
Generate a second PDF to inspect day‑by‑day workload distribution for the same project.
Complete, Compilable Example (C#)
using System;
using Aspose.Tasks;
using Aspose.Tasks.Saving;
using Aspose.Tasks.Visualization;
namespace TasksOverallocatedPdf
{
internal static class Program
{
// How to run:
// 1) dotnet new console -n TasksOverallocatedPdf
// 2) cd TasksOverallocatedPdf
// 3) dotnet add package Aspose.Tasks
// 4) Replace Program.cs with this file's contents
// 5) dotnet run -- "path-to-input.mpp"
private static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Usage: dotnet run -- <path-to-input.mpp>");
return;
}
string input = args[0];
// 1) Load the project and ensure calculations are current
var project = new Project(input)
{
CalculationMode = CalculationMode.Automatic
};
// Explicit refresh in case the mode was previously Manual/None
project.Recalculate();
// 2) Export the built-in Overallocated Resources report (primary highlight)
string reportPdf = "OverallocatedResources.pdf";
project.SaveReport(reportPdf, ReportType.OverallocatedResources);
Console.WriteLine($"Saved: {reportPdf}");
// 3) (Optional) Export Resource Usage view for time-phased context
var usageOptions = new PdfSaveOptions
{
PresentationFormat = PresentationFormat.ResourceUsage,
Timescale = Timescale.Days,
FitContent = true,
ReduceFooterGap = true
};
string usagePdf = "ResourceUsage.pdf";
project.Save(usagePdf, usageOptions);
Console.WriteLine($"Saved: {usagePdf}");
// 4) Console summary: list any overallocated assignments
foreach (var ra in project.ResourceAssignments)
{
if (ra.Overallocated)
{
string resName = ra.Resource?.Get(Rsc.Name) ?? "(Unnamed Resource)";
string taskName = ra.Task?.Get(Tsk.Name) ?? "(Unnamed Task)";
Console.WriteLine($"OVERALLOCATED: Resource='{resName}' on Task='{taskName}'");
}
}
}
}
}
How to run (quick steps)
dotnet new console -n TasksOverallocatedPdfcd TasksOverallocatedPdfdotnet add package Aspose.Tasks- Replace
Program.cswith the code above. dotnet run -- "path-to-input.mpp"
What this code does
- Loads an MPP file and enables automatic calculation.
- Exports a clear Overallocated Resources PDF for high‑signal highlighting.
- Optionally renders the Resource Usage view with a daily timescale for investigative detail.
- Prints a quick console summary of any overallocated assignments.
Troubleshooting & Tips
- No highlights in PDF: make sure you’re using
SaveReport(..., ReportType.OverallocatedResources)or the Resource Usage/Sheet views, not a plain Gantt export. - Huge PDFs: prefer coarser timescales (weeks/months) or limit the date range; set
FitContent = trueand considerRenderToSinglePagefor summaries. - Fonts/locale: install required fonts on the server to avoid missing glyphs.
FAQ
Q1. Can Aspose.Tasks show overallocations without Microsoft Project installed? Yes. Aspose.Tasks renders reports and views independently; Microsoft Project is not required.
Q2. What’s the quickest way to get a one‑glance list of problem resources? Export the Overallocated Resources report. It’s purpose‑built to highlight resource conflicts.
Q3. How do I verify overallocations programmatically?
Check Task.Get(Tsk.IsOverallocated) for tasks and ResourceAssignment.Overallocated for assignments while iterating the project model.
Q4. How can I speed up exports for very large schedules? Filter inactive/complete work, use weekly/monthly timescales, and avoid rendering unnecessary views.
Q5. Can I color only overallocated rows in a sheet view? Row‑level conditional styling is limited. Prefer the Overallocated Resources report for highlights and export Resource Usage for context.
Conclusion
By combining the Overallocated Resources report for high‑signal highlighting with the Resource Usage view for detail, you can generate clear, actionable PDFs from Microsoft Project data. Keep calculations current, tune export options for large files, and your stakeholders will always see where resource conflicts demand attention.