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:

  1. Add a resource with the default constructor
  2. Add a named resource
  3. 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");
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.