Neste tópico, exploraremos como converter MPP para XPS usando C++. XPS é um formato de arquivo amplamente usado e você pode exportar facilmente o arquivo MPP para XPS em C++ usando poucas chamadas de API sem dependência do MS Project.
Etapas para converter MPP para XPS usando C++
- Instale Aspose.Tasks for C++ usando a ferramenta NuGet Package Manager
- Incluir referência ao namespace Aspose::Tasks
- Instanciar a instância da classe Project para carregar o arquivo MPP para salvar como XPS
- Salve o arquivo MPP para XPS em C++ usando o método Save
Você pode exportar arquivo MPP para XPS em C++ em poucas chamadas de API. Tudo o que você precisa é acessar o arquivo MPP e salvá-lo como XPS na chamada API subsequente usando C++.
Código para converter MPP para 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); | |
} |
Anteriormente, aprendemos como extrair metadados de arquivos do Microsoft Project em C++. No entanto, neste tópico, focamos na conversão de MPP para XPS em C++.