C++を使用してMPPをXPSに変換する方法

このトピックでは、C++を使用してMPPXPSに変換する方法について説明します。 XPSは広く使用されているファイル形式であり、MS Projectに依存せずに、いくつかのAPI呼び出しを使用して、MPPファイルをC++のXPSに簡単にエクスポートできます。

C++を使用してMPPをXPSに変換する手順

  1. NuGetパッケージマネージャーツールを使用してAspose.Tasks for C++をインストールします
  2. Aspose::Tasks名前空間への参照を含める
  3. Projectクラスインスタンスをインスタンス化してMPPファイルをロードし、XPSとして保存します
  4. Saveメソッドを使用してMPPファイルをC++のXPSに保存します

いくつかのAPI呼び出しで、MPPファイルをC++のXPSにエクスポートできます。必要なのは、MPPファイルにアクセスし、C++を使用した後続のAPI呼び出しでXPSとして保存することだけです。

C++を使用してMPPをXPSに変換するコード

#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);
}

以前、C++でMicrosoftProjectファイルのメタデータを抽出する方法を学びました。ただし、このトピックでは、C++でのMPPからXPSへの変換に焦点を当てています。

 日本語