Microsoft Project MPPファイルを変換します

この記事では、MicrosoftプロジェクトMPPファイルを、.NETのAsophes.Tasksを使用してHTML、Plain Text、Microsoft Project Template(MPT)を含むさまざまな出力形式に変換する方法について説明します。 APIは、リソース処理、ヘッダー設定、スタイリングオプション、コンテンツフィルタリングなど、出力をカスタマイズするための包括的な機能セットを提供します。各フォーマットには、実用的な例とオプションのカスタマイズ手順が含まれています。

Microsoft Project(MSP)により、開発者はプロジェクトデータ(MPP/XML)をHTML、テキスト、MPTテンプレートに保存できます。 Aspose.tasksを使用すると、MSPと同様の同じ形式にプロジェクトデータを保存することもできます。これは、 プロジェクトクラスによって公開された標準保存方法を使用して達成されます。

プロジェクトデータをHTMLとして保存

HTMLSaveOptionsクラスにより、開発者はエクスポートされたHTMLファイルのレイアウトとコンテンツを制御できます。マルチページのエクスポート、ページサイズの構成、タイムスケールの選択、CSS、フォント、および画像の埋め込みまたは外部化をサポートします。 Aspose.tasksは、プロジェクトデータをHTML形式にエクスポートできます。これにより、すべてのデータをHTMLに保存するか、次のコードサンプルに示すようにSaveOptionsを使用して、必要なページのみをHTMLにエクスポートできます。

Controlling Header and Title Output in HTML

By default, the exported HTML document includes the project name in the HTML <title> and in the document’s page header. You can disable either of these elements by modifying the corresponding properties of the HtmlSaveOptions class.

Saving Fonts, Images and CSS Styles Separately

Aspose.Tasks supports saving fonts, images, and CSS styles as external files. This is particularly useful when you want to integrate HTML output into an existing website or manage styling separately from the content. This is achieved using the HtmlSaveOptions class by providing information about CSS, Font and Image destinations. The resource export behavior can be configured through HtmlSaveOptions.ExportFonts, ExportImages, and ExportCss.

Adding Custom Prefixes to CSS Class Names While Exporting to HTML

To avoid CSS class name conflicts when integrating the exported HTML into a broader application, you can define a custom prefix using the CssStylePrefix property.

Save Project to Text

Project data can be exported to plain text using SaveFileFormat.TXT. This format is intended for simple logging, debugging, or archival purposes.

Save Project Data as Template (MPT)

Aspose.Tasks allows saving a project as a Microsoft Project Template (MPT) file. This is useful when you want to create reusable project structures. Use the SaveAsTemplate method and configure optional parameters through the SaveTemplateOptions class to remove actual and baseline values.

Conclusion

Aspose.Tasks for .NET provides flexible and developer-friendly methods for exporting project data to multiple formats, including HTML, text, and templates. With the help of configuration classes such as HtmlSaveOptions and SaveTemplateOptions, developers can fine-tune the output to meet a wide range of business requirements. For additional details, refer to the API Reference or explore other export scenarios in the documentation.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.