Šioje temoje išnagrinėsime, kaip konvertuoti MPP į XPS naudojant C++. XPS yra plačiai naudojamas failo formatas ir galite lengvai eksportuoti MPP failą į XPS C++ naudodami kelis API iškvietimus, nepriklausydami nuo MS Project.
Veiksmai, kaip konvertuoti MPP į XPS naudojant C++
- Įdiekite Aspose.Tasks for C++ naudodami NuGet paketų tvarkyklės įrankį
- Įtraukite nuorodą į Aspose::Tasks vardų erdvę
- Sukurkite projekto klasės egzempliorių, kad įkeltumėte MPP failą ir išsaugotumėte jį kaip XPS
- Išsaugokite MPP failą į XPS C++ naudodami Įrašymo metodą
Galite * eksportuoti MPP failą į XPS C++* per kelis API skambučius. Viskas, ko jums reikia, yra pasiekti MPP failą ir išsaugoti jį kaip XPS kitame API skambutyje naudojant C++.
Kodas konvertuoti MPP į XPS naudojant 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); | |
} |
Anksčiau sužinojome kaip išgauti Microsoft Project failo metaduomenis C++. Tačiau šioje temoje mes sutelkėme dėmesį į MPP konvertavimą į XPS C++.