プロジェクトデータをPDFに変換する方法
この記事では、JavaのAspose.Tasksを使用してプロジェクトデータをPDFにレンダリングする方法を示しています。 APIは次の機能を提供し、プロジェクトデータをPDFを含むさまざまな出力形式にレンダリングします。
PDF作成者情報
- Aspose Ltd.とAspose.TasksのThe for Java X.X.Xのため、アプリケーションおよびプロデューサーフィールドに対して値を設定することはできないことに注意してください。
PDFとしてプロジェクトを保存
プロジェクトクラスは、プロジェクトをさまざまな形式で保存するために使用される保存方法を公開します。保存方法により、SaveFileFormat列挙タイプを使用してプロジェクトデータをPDFにレンダリングできます。
プロジェクトをPDFに保存するには:
- Microsoftプロジェクトファイルをロードします。
- SaveFileFormat.pdfを使用して、プロジェクトをPDFに保存します。
次のコード行は、これを達成する方法を示しています。
Supported Graphical Column Indicators
Aspose.Tasks draw graphical column indicators while rendering project data to PDF. The following are the graphical indicators supported by Aspose.Tasks .
Indicator Type | Graphical Representation |
---|---|
Task Indicators | ![]() |
Resource Indicators | ![]() |
Assignment Indicators | ![]() |
Saving to Multiple PDF Files
To save the project data to multiple PDF files, set the SaveToSeparateFiles flag to true.
Customizing TextStyle for Project Data
Aspose.Tasks allows you to customize the text style for overallocated resources. By default, the style for overallocated resources is similar to Microsoft Project (MSP), that is, it is red and bold. TextItemType.OverallocatedResources enables you to customize the color and style for overallocated resources. The example below shows how.
Customizing Date Format
Aspose.Tasks give developers control over date formatting when rendering project data to output. The following example shows how to use the DateFormat enumerator to specify the date format.
1Project project = new Project();
2Date date = new Date();
3project.setStartDate(date);
4// By default project.DateFormat == DateFormat.Date_ddd_mm_dd_yy (Mon 09/22/14)
5// customize DateFormat (September 22, 2014)
6project.setDateFormat(DateFormat.Date_mmmm_dd_yyyy);
7project.save("saved.pdf", SaveFileFormat.PDF);
8//Export to date format 19/07/2016
9project.setDateFormat(DateFormat.DateDdMmYyyy);
10project.save("p2.pdf", SaveFileFormat.PDF);