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

Free Support Forum - aspose.com

How to set background color for specific cell

Please help me with code example - how to set background color for specific cell of the task. For example I want to highlight Duration, Start, Finish of the selected task.



Thank you for contacting Aspose support team.

You may please use following sample code which demonstrates the formatting of task cell and share the feedback.

string path = url + “Tasks_793461_793835\”;<o:p></o:p>

Project project = new Project(@"D:\Aspose_DotNetProjects\blank2010.mpp");

project.Set(Prj.NewTasksAreManual, false);

project.RootTask.Children.Add("Task 1");

project.RootTask.Children.Add("Task 2");

GanttChartView view = project.Views.ToList()[1] as GanttChartView;

// Set first task name text style

TableTextStyle tableTextStyle = new TableTextStyle(1);

tableTextStyle.BackgroundColor = Color.Blue;

tableTextStyle.Color = Color.Red;

tableTextStyle.Field = Field.TaskName;

tableTextStyle.FontStyle = FontStyle.Bold | FontStyle.Italic;


// Set second task duration text style

tableTextStyle = new TableTextStyle(2);

tableTextStyle.Color = Color.Yellow;

//tableTextStyle.BackgroundColor = Color.Red;

tableTextStyle.Field = Field.TaskDurationText;

tableTextStyle.FontStyle = FontStyle.Underline;


MPPSaveOptions saveOptions = new MPPSaveOptions();

saveOptions.WriteViewData = true;

project.Save(path + "temp updated.mpp", saveOptions);

Thanks for the sample, can you please also help me with saving mpp as Stream, the problem place is here

var ms = new MemoryStream();
var saveOptions = new MPPSaveOptions {WriteViewData = true};
project.Save(ms, saveOptions);

I try to use

but can’t resolve MPPSaveOptions to SaveOptions convertation


I have checked the scenario and observed that it is an issue and needs consideration. It is logged under Id: TASKSNET-1859 for further investigation by the product team. You will be automatically notified once any update is received.


We have just released Aspose.Tasks for .NET 17.7 version where this issue has been fixed. Please download this latest version for testing at your end and let us know if we can be of any additional help to you.