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

Free Support Forum - aspose.com

Error when saving mpp file. Incorrect data after saving mpp file

Hello! I have two mistakes, help me figure it out pls
OS on which I tried:

  • local - MacOs Monterey 12.2.1
  • server - Ubuntu 20.04 lts
  1. Error when saving mpp file
    if i try to run this code:
    var project2 = new Project();
    project2.Set(Prj.Name, “Test”);
    View view = new GanttChartView();

         view.ShowInMenu = true;
         view.HighlightFilter = true;
         
         view.Filter = null;
         view.Group = null;
         view.Table = null;
         
         view.PageInfo.PageViewSettings.FirstColumnsCount = 4;
         view.PageInfo.PageViewSettings.PrintFirstColumnsCountOnAllPages = true;
    
         project2.Views.Add(view);
    
         project2.Save( "test.mpp", new MPPSaveOptions
         {
             WriteViewData = true
         });
    

an error occurs:
Aspose.Tasks.TasksWritingException: Project writing exception.
—> System.NullReferenceException: Object reference not set to an instance of an object.
at #=zb7ZUF0iESYl0Kd3IW$Wb0ZnMFtGpczJ5Dw==.#=zk03ZuFk=(View #=zxvF9atw=)
at #=zb7ZUF0iESYl0Kd3IW$Wb0ZnMFtGpczJ5Dw==.#=zqMuf1Pk=(View #=zxvF9atw=)
at #=zb7ZUF0iESYl0Kd3IW$Wb0ZnMFtGpczJ5Dw==.#=zJ109aAI=(View #=zxvF9atw=)
at #=zb7ZUF0iESYl0Kd3IW$Wb0ZnMFtGpczJ5Dw==.#=zJ109aAI=(Boolean #=zNuz5AToeRaf$)

  1. Incorrect data after saving mpp file

if i try to run this code is successful

        var project = new Project("template.mpp");
        
        //logic to add extented attributes in project
        SetAllExtendedAttribute(ref project, listGuidProject);

        fullInfo.TasksProject = fullInfo.TasksProject.OrderBy(a => a.WBS).ToList();
        
        //logic to add task in project
        SetAllTask(ref project, fullInfo.TasksProject);

        var memoryStream = new MemoryStream();

        project.Save(memoryStream, new MPPSaveOptions() { WriteViewData = true });

        memoryStream.Position = 0;
        
        return new InfoExportMppDto
        {
            File = memoryStream
        };

but output date in file incorrect
image.jpg (62.1 KB)
“Стадия ЖЦ” - its extented attributes Text22
“Вид работ” - its extended attibutes Text26

Default field write correct, but extended attributes no. They should contain words, but symbols or single letters are displayed that are not related to the data. And if you import this file and upload it to stream and then to the project , then the data inside is correct

We were able to reproduce the issue.
I’ve created a ticket with ID TASKSNET-10634 has been created to further fix the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The cannot reproduce the issue because we can’t compile and execute the provided code snippet.

We need a sample code which can be compiled and executed so that we may further investigate to help you out.

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