Sign In  Sign Up Live-Chat

An import error occured

Last post 09-25-2008, 5:25 AM by joe@ctis. 3 replies.
Sort Posts: Previous Next
  •  09-20-2008, 5:46 AM 144844

    An import error occured

    Attachment: Present (inaccessible)

    Dear Team,

    I have just got the aspose task tool. i just executed the sample given the Featured demo in C#. I am getting this error. Please guide me to resolve this error.

     

     


    This message was posted using Page2Forum (attachment) from Our Blog - Aspose.Tasks for .NET
     
  •  09-22-2008, 4:29 PM 145037 in reply to 144844

    Re: An import error occured

    Are you using Project 2007? The problem occurs with it and we are trying to fix it. Please see this thread.

    http://www.aspose.com/community/forums/thread/94160/vb-demo-example-and-project-2007.aspx


    Many Thanks and Kind Regards,

    Shakeel Faiz
    Support Engineer
    Aspose Tyumen Team
     
  •  09-23-2008, 6:23 AM 145128 in reply to 145037

    Re: An import error occured

    No. I am working with MS Project 2003. But in the same machine i can open the demo file in the aspose website. But when i trying the sample provided by aspose component in my local machine i am getting this error. Please reply asap.
     
  •  09-25-2008, 5:25 AM 145504 in reply to 145128

    Re: An import error occured

    Attachment: Present (inaccessible)

    here by i am pasting the code which i have used to generate an mpx file. and also the generated file is also attached here for you reference. Please guide me asap.

    MPXFile file = new MPXFile();

    //After that change project's default options to automatic generation of Calendar's,

    //Task's and Resource's id numbers, outline levels and WBS labels:

    file.AutoCalendarUniqueID = true;

    file.AutoTaskID = true;

    file.AutoTaskUniqueID = true;

    file.AutoResourceID = true;

    file.AutoResourceUniqueID = true;

    file.AutoOutlineLevel = true;

    file.AutoOutlineNumber = true;

    file.AutoWBS = true;

    //Next create a default calendar.

    //In such calendar default workdays are Monday - Friday and worktime is 8:00 – 12:00,

    file.AddDefaultBaseCalendar();

    MPXHeader prj = file.Project;

    //After that set project title and Start date

    prj.StartDate = new System.DateTime(2000, 1, 1);

    prj.Title = "sample";

    //Now add 2 resources to project:

    Resource resource1 = file.AddResource();

    resource1.Name = "Resource1";

    resource1.AvailableFrom = new System.DateTime(2000, 1, 13);

    resource1.AvailableTo = new System.DateTime(2000, 1, 16);

    Resource resource2 = file.AddResource();

    resource2.Name = "Resource2";

    resource2.AvailableFrom = new System.DateTime(2000, 1, 13);

    resource2.AvailableTo = new System.DateTime(2000, 1, 30);

    //Next step is adding a Summary Task. Every project has such task from which others are inherited. It is hidden by default.

    Task task1 = file.AddTask();

    task1.Name = "Summary Task";

    //Next we will create a first task:

    Task task2 = task1.AddTask();

    task2.Name = "First Sub Task";

    task2.Duration = new Duration(10, TimeUnit.Days);

    task2.Start = new System.DateTime(2000, 1, 1);

    //We'll set this task up as being 50% complete.

    //If we have no resource assignments for this task,

    //this is enough information for MS Project.

    //If we do have resource assignments, the assignment record needs to contain the

    //corresponding work and actual work fields set to the correct value1s in order

    //for MS project to mark the task as complete or partially complete.

    task2.PercentComplete = 50.0;

    task2.ActualStart = new System.DateTime(2000, 1, 1);

    //And now a second task:

    Task task3 = task1.AddTask();

    task3.Name = "Second Sub Task";

    task3.Start = new System.DateTime(2000, 1, 11);

    task3.Duration = new Duration(10, TimeUnit.Days);

    //We'll link these tasks so one is started after another:

    Relation rel1 = task3.AddPredecessor(task2);

    rel1.Type = TaskLinkType.FinishToStart;

    //After that add a milestone and link it with the second task:

    Task milestone1 = task1.AddTask();

    milestone1.Name = "Milestone";

    milestone1.Start = new System.DateTime(2000, 1, 21);

    milestone1.Duration = new Duration(0, TimeUnit.Days);

    Relation rel2 = milestone1.AddPredecessor(task3);

    rel2.Type = TaskLinkType.FinishToStart;

    //Now assign resources to tasks:

    ResourceAssignment assignment1 = task2.AddResourceAssignment(resource1);

    ResourceAssignment assignment2 = task3.AddResourceAssignment(resource2);

    //As the first task is partially complete, and we are adding a resource assignment,

    //we must set the work and actual work fields in the assignment to appropriate value1s,

    //or MS Project won't recognize the task as being complete or partially complete:

    assignment1.Work = new Duration(80, TimeUnit.Hours);

    assignment1.ActualWork = new Duration(40, TimeUnit.Hours);

    //Creation of project is completed and now we can send it to our browser:

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

    this.Response.AppendHeader("Content-Disposition", "attachment; filename=project.mpx");

    this.Response.Flush();

    System.IO.Stream st = this.Response.OutputStream;

    file.Write(st);

    this.Response.End();

     
View as RSS news feed in XML