Come convertire MPP in XPS usando C++

In questo argomento esploreremo come convertire MPP in XPS utilizzando C++. XPS è un formato di file ampiamente utilizzato e puoi facilmente esportare file MPP in XPS in C++ utilizzando poche chiamate API senza dipendere da MS Project.

Passaggi per convertire MPP in XPS usando C++

  1. Installa Aspose.Tasks for C++ utilizzando lo strumento Gestione pacchetti NuGet
  2. Includi il riferimento allo spazio dei nomi Aspose::Tasks
  3. Istanziare l’istanza della classe Project per caricare il file MPP da salvare come XPS
  4. Salva il file MPP su XPS in C++ usando il metodo Save

Puoi esportare file MPP su XPS in C++ in poche chiamate API. Tutto ciò che serve è accedere al file MPP e quindi salvarlo come XPS nella successiva chiamata API utilizzando C++.

Codice per convertire MPP in XPS usando C++

#pragma once
#include <Project.h>
#include <Task.h>
#include<License/License.h>
#include<Saving/Enums/SaveFileFormat.h>
#include<Prj.h>
#include <system/string.h>
#include <system/console.h>
#include <system/environment.h>
#include <system/shared_ptr.h>
#include <system/environment.h>
#include <system/object_ext.h>
#include <system/object.h>
#include <stdio.h>
using namespace Aspose::Tasks;
using namespace Aspose::Tasks::Saving;
using namespace System;
void MPPToXPS()
{
// Set license to perform MPP to XPS conversion
SharedPtr<License> AsposeTasksLicense = System::MakeObject<License>();
AsposeTasksLicense->SetLicense(u"licFile");
// The path to sour MPP file and directory.
System::String SourceFile = u"SourceMPPFile.mpp";
// Load the source MPP file to export to XPS
SharedPtr<Project> MppToXps = MakeObject<Project>(SourceFile);
// Save the MPP to XPS in C++
MppToXps->Save(u"MPPSavedToXPS.xps", SaveFileFormat::XPS);
}

In precedenza, abbiamo appreso come estrarre i metadati dei file di Microsoft Project in C++. Tuttavia, in questo argomento ci siamo concentrati sulla conversione da MPP a XPS in C++.

 Italiano