Free Support Forum - aspose.com

Xml works- but mpp doesn't

Hello,

I'm new to aspose tasks, and am having great difficulty with creating a mpp file. I have a pretty big pharma client that wishes to use my product to perform calculations and export it into project, so if this can't work, I would imagine I would have to determine that Aspose Tasks can't handle it.

I have an mpp template that I'm reading from and opening. This template is blank and has no tasks. I would like to add tasks, resources and resource assignments to it on the fly and spit out in the response of my asp.net mvc application. When I save the data using teh following line...

prjWriter.Write(prj, , TasksDataFormat.MPP);

It shows nothing, but when I save it with this. It also doesn't throw any errors...

prjWriter.Write(prj, strm, TasksDataFormat.XML);

It does save it correctly, and I can open it up in project.

Here are code snippets...

Opening up the template....

ProjectReader rdr = new ProjectReader();

FileStream fs = new FileStream(strFromPath, FileMode.Open);

Aspose.Tasks.Project prj = rdr.Read(fs);

fs.Close();

prj.AreNewTasksEffortDriven = false;

prj.DurationFormat = TimeUnitType.Day;

Writing a task (a grandparent,parent and 5 children tasks)...

This is one of the children tasks..

Task pcpaTask = new Task("PC to PA");

pcpaTask.Id = intTaskID;

pcpaTask.Uid = intTaskID;

pcpaTask.OutlineLevel = 3;

if (c.PC > DateTime.Now)

{

pcpaTask.ManualStart = c.PC;

pcpaTask.ManualFinish = c.PA.AddDays(-1);

}

else

{

pcpaTask.ManualStart = c.PC;

pcpaTask.ManualFinish = c.PA.AddDays(-1);

}

pcpaTask.IsEffortDriven = false;

pcpaTask.IsManual = true;

pcpaTask.DurationFormat = TimeUnitType.Day;

pcpaTask.EarlyStart = c.PC;

pcpaTask.EarlyFinish = c.PA.AddDays(-1);

TimeSpan pcpaDays = c.PA.Subtract(c.PC);

pcpaTask.ConstraintType = ConstraintType.StartNoEarlierThan;

pcpaTask.ConstraintDate = c.PC;

pcpaTask.Calendar = Calendar.MakeStandardCalendar();

pcpaTask.ManualDuration = new TimeSpan(pcpaDays.Days, 0, 0, 0);

pcpaTask.Type = TaskType.FixedUnits;

studyTask.Children.Add(pcpaTask);

intTaskID++;

Resource Class...

Resource resource = new Resource(c.CalcType);

resource.Type = ResourceType.Work;

resource.Id = prj.Resources.Count + 1;

resource.Uid = prj.Resources.Count + 1;

//resource.Work = studyTaskForResource.ManualDuration;

prj.Resources.Add(resource);

Resource Assignment Class...

ResourceAssignment pcpaResAssign = new ResourceAssignment(pcpaTaskForResource, resource);

pcpaResAssign.Units = Decimal.ToDouble(c.PCPA_FULLFTE);

pcpaResAssign.Start = pcpaTaskForResource.ManualStart;

pcpaResAssign.Finish = pcpaTaskForResource.ManualFinish;

pcpaResAssign.Milestone = false;

pcpaResAssign.TimephasedDataFromTaskDuration(pcpaTaskForResource.Calendar);

Save...

prj.CalcResourceIds();

prj.CalcResourceUids();

prj.CalcResourceFields();

prj.CalcTaskIds();

prj.CalcTaskUids();

prj.CalcResourceAssignmentIds();

prj.CalcResourceAssignmentUids();

prj.CalcCalendarUids();

ProjectWriter prjWriter = new ProjectWriter();

HttpContext.Current.Response.ContentType = "application/vnd.ms-project";

HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=project.mpp");

HttpContext.Current.Response.Flush();

System.IO.Stream strm = HttpContext.Current.Response.OutputStream;

prjWriter.Write(prj, strm, TasksDataFormat.MPP);

HttpContext.Current.Response.End();

(I've also tried saving it directly to the path of the template, but that didn't work either, and it also doens't throw any exceptions)

I did also want to note, that I’m using the fully licensed version of Aspose.Tasks.

Dear Thomas,

Unfortunately, writing project data back to MPP format or updating MPP files is not supported in the present versions. At the moment, you can update common project properties only in the MPP files as you can see in this topic http://www.aspose.com/documentation/.net-components/aspose.tasks-for-.net/project-data.html.

This feature is under development and hopefully it will be available in next 4-5 months. We will keep you updated on this issue (ID = 11799) in this thread.

Please check all the sub-headings under this heading http://www.aspose.com/documentation/.net-components/aspose.tasks-for-.net/ms-project-data-reading-and-writing-summary.html for a list of supported features and feel free to contact us in case you have further comments or questions.

Best Regards,

The issues you have found earlier (filed as TASKS-11799) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(13)

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.