Java library to build highly customized reports using REST API
Start Free TrialGroupDocs.Assembly Cloud is a fully managed, REST‑based service that enables Java developers to create highly‑customized documents, reports, contracts, invoices, and mail‑merge letters directly from the cloud. The solution works with a wide set of input and output formats, allowing you to store template files in GroupDocs Cloud Storage, bind them to XML or JSON data sources, and receive the assembled document in the format of your choice – DOCX, PDF, HTML, PPTX, XLSX, etc. Because all processing happens on the server side, there is no need to install any third‑party software or libraries on the client machine; the only requirement is a Java runtime and the Assembly Cloud SDK, which provides thin wrappers around the API endpoints.
Typical Java workflow consists of three simple steps. First, add the Assembly Cloud SDK dependency to your Maven or Gradle project and initialise the ApiClient with your personal App SID and App Key. Second, upload the template file to GroupDocs Cloud Storage using the uploadFile
method. Third, create an AssembleOptions
object, specify the path of the template, the data file (XML or JSON), the desired output format, and invoke assembleDocument
. The service returns the assembled document as a stream that can be saved locally or further processed. The SDK also exposes helper methods for previewing templates, retrieving supported formats, and handling errors. This straightforward approach lets you integrate document generation into web applications, batch processing jobs, or micro‑services with minimal code.
All communications are encrypted with SSL/TLS, and access is controlled by personal keys. The platform automatically scales to handle large volumes of requests and supports batch mail‑merge operations where a single API call can generate thousands of personalized letters. Additionally, the SDK supports embedding images, charts, barcodes and applying conditional logic directly within the template using LINQ‑style expressions, giving you full control over the final document layout.
The snippet below demonstrates how to upload a template, set the data source and generate a DOCX report using the Assembly Cloud API.
Steps
AssembleOptions
– template path, output format and data file.assembleDocument
to produce the result.import com.groupdocs.assembly.*;
AssemblyApi assemblyApi = new AssemblyApi(new ApiClient());
ApiClient client = assemblyApi.getApiClient();
client.setAppKey("####################").setAppSid("####-####-####-####-####");
String fileName = "Input1.docx";
String dataFile = "Input2.docx";
File requestFileContent = new File(fileName);
UploadFileRequest uploadDocumentRequest =
new UploadFileRequest(requestFileContent, fileName, null);
assemblyApi.uploadFile(uploadDocumentRequest);
AssembleOptions assembleOptions = new AssembleOptions();
assembleOptions.setTemplateFileInfo(new TemplateFileInfo().filePath(fileName));
assembleOptions.setSaveFormat("docx");
assembleOptions.setReportData(Paths.get(dataFile).toString());
AssembleDocumentRequest request = new AssembleDocumentRequest(assembleOptions);
assemblyApi.assembleDocument(request);