Format option in aspose

Hi, I’am trying to develop an application by using Aspose.Tasks but I don’t know how to modify the format properties in my code.
I am creating a project and saving it but what I want is, when I open my created project with MSProject, to be able to display some properties in my Gant chart like we did when clicking on Format --> Bar.
Is it possible to do it? If it is, how can I do that?

Thanks

Fluch

Hi Fluch,


MSProject saves the formatting information in MPP files. You may achieve your goal by creating a template MPP project file in MS Project with required formatting, and then use it for Aspose.Tasks operations. At the end when this MPP file is saved back on disc (with/without same name), it will contain all the formatting information. This resultant file can be opened in MS Project with specific formatting options as present in the template project file.

I am afraid to inform that currently Aspose.Tasks does not provide support for handling the formatting options.

However Aspose.Tasks provides rich features for formatting the images created by rendering the Gantt chart to images. Please have a look at Display Multiple Columns in Rendered Gantt Chart Image.

Please feel free to write us back if you have any other query in this regard.

Thank you for your answer,

If I understand it well, that means that, in my case, I can’t do anything because I’m interested in changing the option “Bar” in “Format”. Indeed, in MS Project, the “bar” option can only be used for one particular (and selected) task so I can’t use it in an empty project (because no task is created). Am I wrong? I’m totally new in MS Project and aspose.

Thanks

Hi Fluch,


I have created an empty project using MS Project 2010. Its bar style is changed to Red color and this empty project is saved on the disc. This template project is used in a sample code which adds tasks to this template project and then saves it on the disc. The resultant MPP file contains all the new tasks in red color bar.

Could you please give a try to the following code which demonstrate this scenario:

var license3 = new Aspose.Tasks.License();
license3.SetLicense(“Aspose.Tasks.lic”);

//create a project instance
var projectReader = new ProjectReader();
Project prj = projectReader.Read(@“project1.mpp”);

//Define Tasks
Task rootTsk = new Task();
Task task1 = new Task(“Task1”);
task1.Start = DateTime.Now;
TimeSpan duration = TimeSpan.FromHours(8);
task1.IsManual = true;
task1.ManualStart = DateTime.Now;
task1.ManualDuration = duration;
task1.ManualFinish = task1.ManualStart.Add(duration);

//add tsk1 to the rootTsk
rootTsk.Children.Add(task1);

//set rootTsk as root task of the project
prj.RootTask = rootTsk;

//perform recalculations
prj.CalcTaskIds();
prj.CalcTaskUids();
prj.UpdateReferences();

//create a project writer instance
var prjWriter = new ProjectWriter();

//write the stream in mpp format
prjWriter.Write(prj, @“project2.mpp”, TasksDataFormat.MPP);

OK!! I am using MS Project 2007 but finally I succeeded in modify my tasks format in my template project!! So now I have a correct diagram…

Thank you so much for your answer I was trying to do this since almost 2 days.