Copying Components Between Reports
Our sample projects and report templates can help you learn the basics of working with our products.Reusable content can be moved between templates by serializing a component from one report and deserializing it into another.
Serialize a band, deserialize into the target.
How it works. Serialization clones the component and everything inside it, so a header (with its texts) transplants cleanly into another template.
Serialize a band, deserialize into the target.
StiHeaderBand customerHeader = (StiHeaderBand) customerReport.getComponents().get("HeaderBand1");
String headerStr = StiSerializerControler.serializedObjectAsString(customerHeader);
StiHeaderBand newHeader = new StiHeaderBand();
StiDeserializerControler.deserializeFromString(headerStr, newHeader);
newHeader.setPage(originalReport.getPages().get(0));
originalReport.getPages().get(0).getComponents().add(originalIndex, newHeader);
newHeader.setName(StiNameCreation.createName(originalReport, "HeaderBand"));serializedObjectAsString/deserializeFromString— copy a component through its serialized form.StiNameCreation.createName— give the copied band and its children unique names in the target report.
How it works. Serialization clones the component and everything inside it, so a header (with its texts) transplants cleanly into another template.