Cara Mengekstrak Metadata File Proyek Microsoft menggunakan C++

Dalam topik ini, kita akan mengeksplorasi cara mengekstrak Microsoft Project file metadata menggunakan C++. Anda akan mengamati cara mengakses file MPP dan informasi metadatanya di C++ menggunakan panggilan API sederhana tanpa ketergantungan pada MS Project.

Langkah-langkah Mengekstrak Metadata File Proyek Microsoft menggunakan C++

  1. Instal Aspose.Tasks for C++ dari NuGet package Manager Tool
  2. Tambahkan referensi ke Aspose::Tasks namespace
  3. Buat instance kelas Project untuk memuat file MPP untuk mengekstrak informasi metadata
  4. Ekstrak informasi metadata untuk properti yang berbeda menggunakan metode statis kelas Prj

Anda dapat mengekstrak metadata file MPP di C++ dengan menggunakan panggilan API sederhana dalam beberapa kode baris. Anda hanya perlu mengakses file MPP dan melakukan iterasi melalui properti metadata yang diinginkan yang diekspos oleh Prj class di C++.

Kode untuk Mengekstrak Metadata File Proyek Microsoft menggunakan C++

#pragma once
#include <Project.h>
#include <Task.h>
#include<License/License.h>
#include<Saving/Html/HtmlSaveOptions.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 ExtractMetaInformation()
{
// Setting the license extracting metadata from MPP Project file
SharedPtr<License> AsposeTasksLicense = System::MakeObject<License>();
AsposeTasksLicense->SetLicense(u"licFile");
// Source MPP file path and name
System::String SourceFile = u"SourceMicrosoftProjectFile.mpp";
// Load the MPP file to extract meta information
SharedPtr<Project> MSProjectFile = MakeObject<Project>(SourceFile);
// Access and sae different meta information properties inside project file
System::String ProjectAuthor = MSProjectFile->Get(Prj::Author());
System::String ProjectCategory = MSProjectFile->Get(Prj::Category());
System::String ProjectCompany = MSProjectFile->Get(Prj::Company());
System::String ProjectComments = MSProjectFile->Get(Prj::Comments());
// Show the meta-data information extracted from the Microsoft Project file
System::Console::Write(u"Author:{0}, Catgory:{1}, Company:{2}, Comments:{3}",
ProjectAuthor, ProjectCategory, ProjectCompany, ProjectComments);
}

Sebelumnya, kita telah mempelajari cara mengekstrak metadata file Microsoft Project di C#. Namun, dalam topik ini kami telah menerapkan ekstraktor metadata Microsoft Project di C++.

 Indonesian