Creating Resources
Contents
[
Hide
Show
]The Resource class exposes two methods for creating a resource: default or by name. Each is shown below.
Creating a Resource
The simplest way of creating and adding a resource is to call the Project class’ addResource method. Variants of this method let you:
- Add a resource with the default constructor
- Add a named resource
- Add a resource before some resource
The following code samples show adding resources to a project using each of these methods.
1// For complete examples and data files, please go to https://github.com/aspose-tasks/Aspose.Tasks-for-Java
2// The path to the documents directory.
3String dataDir = Utils.getDataDir(CreateResources.class);
4
5Project project = new Project();
6Resource rsc = project.getResources().add("Rsc");