ReportBuilderContext
Inheritance: java.lang.Object, com.aspose.words.ProcessorContext
public class ReportBuilderContext extends ProcessorContext
LINQ Reporting Engine context.
Examples:
Shows how to populate document with data sources using documents from the stream.
// There is a several ways to populate document with data sources using documents from the stream:
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
try (FileInputStream streamIn = new FileInputStream(getMyDir() + "Report building.docx")) {
try (FileOutputStream streamOut = new FileOutputStream(getArtifactsDir() + "LowCode.BuildReportDataSourceStream.1.docx")) {
ReportBuilder.buildReport(streamIn, streamOut, SaveFormat.DOCX, new Object[]{sender}, new String[]{"s"});
}
try (FileOutputStream streamOut1 = new FileOutputStream(getArtifactsDir() + "LowCode.BuildReportDataSourceStream.2.docx")) {
ReportBuilder.buildReport(streamIn, streamOut1, SaveFormat.DOCX, sender, "s");
}
try (FileOutputStream streamOut2 = new FileOutputStream(getArtifactsDir() + "LowCode.BuildReportDataSourceStream.3.docx")) {
ReportBuilderOptions options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
ReportBuilder.buildReport(streamIn, streamOut2, SaveFormat.DOCX, sender, "s", options);
}
ReportBuilderOptions options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
OutputStream[] images = ReportBuilder.buildReportToImages(streamIn, new ImageSaveOptions(SaveFormat.PNG), new Object[]{sender}, new String[]{"s"}, options);
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.getReportBuilderOptions().setMissingMemberMessage("Missed members");
reportBuilderContext.getDataSources().put(sender, "s");
try (FileOutputStream streamOut3 = new FileOutputStream(getArtifactsDir() + "LowCode.BuildReportDataSourceStream.4.docx")) {
ReportBuilder.create(reportBuilderContext)
.from(streamIn)
.to(streamOut3, SaveFormat.DOCX)
.execute();
}
}
Shows how to populate document with data sources.
public void buildReportDataSource() throws Exception {
// There is a several ways to populate document with data sources:
String doc = getMyDir() + "Report building.docx";
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
ReportBuilderOptions options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.1.docx", sender, "s");
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.2.docx", new Object[]{sender}, new String[]{"s"});
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.3.docx", sender, "s", options);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.4.docx", SaveFormat.DOCX, sender, "s");
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.5.docx", SaveFormat.DOCX, new Object[]{sender}, new String[]{"s"});
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.6.docx", SaveFormat.DOCX, sender, "s", options);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.7.docx", SaveFormat.DOCX, new Object[]{sender}, new String[]{"s"}, options);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.8.docx", new Object[]{sender}, new String[]{"s"}, options);
options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
OutputStream[] images = ReportBuilder.buildReportToImages(doc, new ImageSaveOptions(SaveFormat.PNG), new Object[]{sender}, new String[]{"s"}, options);
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.getReportBuilderOptions().setMissingMemberMessage("Missed members");
reportBuilderContext.getDataSources().put(sender, "s");
ReportBuilder.create(reportBuilderContext)
.from(doc)
.to(getArtifactsDir() + "LowCode.BuildReportDataSource.9.docx")
.execute();
}
public static class MessageTestClass {
public String getName() {
return mName;
}
public void setName(String value) {
mName = value;
}
private String mName;
public String getMessage() {
return mMessage;
}
public void setMessage(String value) {
mMessage = value;
}
private String mMessage;
public MessageTestClass(String name, String message) {
setName(name);
setMessage(message);
}
}
Constructors
Constructor | Description |
---|---|
ReportBuilderContext() | Initializes a new instance of this class. |
Methods
Method | Description |
---|---|
getDataSources() | Data sources used to build the report. |
getFontSettings() | Font settings used by the processor. |
getLayoutOptions() | Document layout options used by the processor. |
getReportBuilderOptions() | Report build options. |
getWarningCallback() | Warning callback used by the processor. |
setFontSettings(FontSettings value) | Font settings used by the processor. |
setWarningCallback(IWarningCallback value) | Warning callback used by the processor. |
ReportBuilderContext()
public ReportBuilderContext()
Initializes a new instance of this class.
getDataSources()
public HashMap getDataSources()
Data sources used to build the report.
Remarks:
The key represents the data source, while the value is the data source name. The data source name can be null or an empty string; in such cases, the reporting engine will automatically detect the data source name from the specified data source.
Examples:
Shows how to populate document with data sources using documents from the stream.
// There is a several ways to populate document with data sources using documents from the stream:
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
try (FileInputStream streamIn = new FileInputStream(getMyDir() + "Report building.docx")) {
try (FileOutputStream streamOut = new FileOutputStream(getArtifactsDir() + "LowCode.BuildReportDataSourceStream.1.docx")) {
ReportBuilder.buildReport(streamIn, streamOut, SaveFormat.DOCX, new Object[]{sender}, new String[]{"s"});
}
try (FileOutputStream streamOut1 = new FileOutputStream(getArtifactsDir() + "LowCode.BuildReportDataSourceStream.2.docx")) {
ReportBuilder.buildReport(streamIn, streamOut1, SaveFormat.DOCX, sender, "s");
}
try (FileOutputStream streamOut2 = new FileOutputStream(getArtifactsDir() + "LowCode.BuildReportDataSourceStream.3.docx")) {
ReportBuilderOptions options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
ReportBuilder.buildReport(streamIn, streamOut2, SaveFormat.DOCX, sender, "s", options);
}
ReportBuilderOptions options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
OutputStream[] images = ReportBuilder.buildReportToImages(streamIn, new ImageSaveOptions(SaveFormat.PNG), new Object[]{sender}, new String[]{"s"}, options);
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.getReportBuilderOptions().setMissingMemberMessage("Missed members");
reportBuilderContext.getDataSources().put(sender, "s");
try (FileOutputStream streamOut3 = new FileOutputStream(getArtifactsDir() + "LowCode.BuildReportDataSourceStream.4.docx")) {
ReportBuilder.create(reportBuilderContext)
.from(streamIn)
.to(streamOut3, SaveFormat.DOCX)
.execute();
}
}
Shows how to populate document with data sources.
public void buildReportDataSource() throws Exception {
// There is a several ways to populate document with data sources:
String doc = getMyDir() + "Report building.docx";
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
ReportBuilderOptions options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.1.docx", sender, "s");
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.2.docx", new Object[]{sender}, new String[]{"s"});
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.3.docx", sender, "s", options);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.4.docx", SaveFormat.DOCX, sender, "s");
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.5.docx", SaveFormat.DOCX, new Object[]{sender}, new String[]{"s"});
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.6.docx", SaveFormat.DOCX, sender, "s", options);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.7.docx", SaveFormat.DOCX, new Object[]{sender}, new String[]{"s"}, options);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.8.docx", new Object[]{sender}, new String[]{"s"}, options);
options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
OutputStream[] images = ReportBuilder.buildReportToImages(doc, new ImageSaveOptions(SaveFormat.PNG), new Object[]{sender}, new String[]{"s"}, options);
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.getReportBuilderOptions().setMissingMemberMessage("Missed members");
reportBuilderContext.getDataSources().put(sender, "s");
ReportBuilder.create(reportBuilderContext)
.from(doc)
.to(getArtifactsDir() + "LowCode.BuildReportDataSource.9.docx")
.execute();
}
public static class MessageTestClass {
public String getName() {
return mName;
}
public void setName(String value) {
mName = value;
}
private String mName;
public String getMessage() {
return mMessage;
}
public void setMessage(String value) {
mMessage = value;
}
private String mMessage;
public MessageTestClass(String name, String message) {
setName(name);
setMessage(message);
}
}
Returns: java.util.HashMap - The corresponding java.util.HashMap value.
getFontSettings()
public FontSettings getFontSettings()
Font settings used by the processor.
Returns: FontSettings - The corresponding FontSettings value.
getLayoutOptions()
public LayoutOptions getLayoutOptions()
Document layout options used by the processor.
Returns: LayoutOptions - The corresponding LayoutOptions value.
getReportBuilderOptions()
public ReportBuilderOptions getReportBuilderOptions()
Report build options.
Examples:
Shows how to populate document with data sources using documents from the stream.
// There is a several ways to populate document with data sources using documents from the stream:
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
try (FileInputStream streamIn = new FileInputStream(getMyDir() + "Report building.docx")) {
try (FileOutputStream streamOut = new FileOutputStream(getArtifactsDir() + "LowCode.BuildReportDataSourceStream.1.docx")) {
ReportBuilder.buildReport(streamIn, streamOut, SaveFormat.DOCX, new Object[]{sender}, new String[]{"s"});
}
try (FileOutputStream streamOut1 = new FileOutputStream(getArtifactsDir() + "LowCode.BuildReportDataSourceStream.2.docx")) {
ReportBuilder.buildReport(streamIn, streamOut1, SaveFormat.DOCX, sender, "s");
}
try (FileOutputStream streamOut2 = new FileOutputStream(getArtifactsDir() + "LowCode.BuildReportDataSourceStream.3.docx")) {
ReportBuilderOptions options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
ReportBuilder.buildReport(streamIn, streamOut2, SaveFormat.DOCX, sender, "s", options);
}
ReportBuilderOptions options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
OutputStream[] images = ReportBuilder.buildReportToImages(streamIn, new ImageSaveOptions(SaveFormat.PNG), new Object[]{sender}, new String[]{"s"}, options);
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.getReportBuilderOptions().setMissingMemberMessage("Missed members");
reportBuilderContext.getDataSources().put(sender, "s");
try (FileOutputStream streamOut3 = new FileOutputStream(getArtifactsDir() + "LowCode.BuildReportDataSourceStream.4.docx")) {
ReportBuilder.create(reportBuilderContext)
.from(streamIn)
.to(streamOut3, SaveFormat.DOCX)
.execute();
}
}
Shows how to populate document with data sources.
public void buildReportDataSource() throws Exception {
// There is a several ways to populate document with data sources:
String doc = getMyDir() + "Report building.docx";
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
ReportBuilderOptions options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.1.docx", sender, "s");
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.2.docx", new Object[]{sender}, new String[]{"s"});
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.3.docx", sender, "s", options);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.4.docx", SaveFormat.DOCX, sender, "s");
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.5.docx", SaveFormat.DOCX, new Object[]{sender}, new String[]{"s"});
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.6.docx", SaveFormat.DOCX, sender, "s", options);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.7.docx", SaveFormat.DOCX, new Object[]{sender}, new String[]{"s"}, options);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportDataSource.8.docx", new Object[]{sender}, new String[]{"s"}, options);
options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
OutputStream[] images = ReportBuilder.buildReportToImages(doc, new ImageSaveOptions(SaveFormat.PNG), new Object[]{sender}, new String[]{"s"}, options);
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.getReportBuilderOptions().setMissingMemberMessage("Missed members");
reportBuilderContext.getDataSources().put(sender, "s");
ReportBuilder.create(reportBuilderContext)
.from(doc)
.to(getArtifactsDir() + "LowCode.BuildReportDataSource.9.docx")
.execute();
}
public static class MessageTestClass {
public String getName() {
return mName;
}
public void setName(String value) {
mName = value;
}
private String mName;
public String getMessage() {
return mMessage;
}
public void setMessage(String value) {
mMessage = value;
}
private String mMessage;
public MessageTestClass(String name, String message) {
setName(name);
setMessage(message);
}
}
Returns: ReportBuilderOptions - The corresponding ReportBuilderOptions value.
getWarningCallback()
public IWarningCallback getWarningCallback()
Warning callback used by the processor.
Returns: IWarningCallback - The corresponding IWarningCallback value.
setFontSettings(FontSettings value)
public void setFontSettings(FontSettings value)
Font settings used by the processor.
Parameters:
Parameter | Type | Description |
---|---|---|
value | FontSettings | The corresponding FontSettings value. |
setWarningCallback(IWarningCallback value)
public void setWarningCallback(IWarningCallback value)
Warning callback used by the processor.
Parameters:
Parameter | Type | Description |
---|---|---|
value | IWarningCallback | The corresponding IWarningCallback value. |