ReportBuilder
Inheritance: java.lang.Object, com.aspose.words.Processor
public class ReportBuilder extends Processor
Provides methods intended to fill template with data using LINQ Reporting Engine.
Methods
buildReport(InputStream inputStream, OutputStream outputStream, SaveOptions saveOptions, Object data)
public static void buildReport(InputStream inputStream, OutputStream outputStream, SaveOptions saveOptions, Object data)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveOptions | SaveOptions | |
data | java.lang.Object |
buildReport(InputStream inputStream, OutputStream outputStream, SaveOptions saveOptions, Object data, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(InputStream inputStream, OutputStream outputStream, SaveOptions saveOptions, Object data, ReportBuilderOptions reportBuilderOptions)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveOptions | SaveOptions | |
data | java.lang.Object | |
reportBuilderOptions | ReportBuilderOptions |
buildReport(InputStream inputStream, OutputStream outputStream, SaveOptions saveOptions, Object data, String dataSourceName)
public static void buildReport(InputStream inputStream, OutputStream outputStream, SaveOptions saveOptions, Object data, String dataSourceName)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveOptions | SaveOptions | |
data | java.lang.Object | |
dataSourceName | java.lang.String |
buildReport(InputStream inputStream, OutputStream outputStream, SaveOptions saveOptions, Object data, String dataSourceName, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(InputStream inputStream, OutputStream outputStream, SaveOptions saveOptions, Object data, String dataSourceName, ReportBuilderOptions reportBuilderOptions)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveOptions | SaveOptions | |
data | java.lang.Object | |
dataSourceName | java.lang.String | |
reportBuilderOptions | ReportBuilderOptions |
buildReport(InputStream inputStream, OutputStream outputStream, SaveOptions saveOptions, Object[] data, String[] dataSourceNames)
public static void buildReport(InputStream inputStream, OutputStream outputStream, SaveOptions saveOptions, Object[] data, String[] dataSourceNames)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveOptions | SaveOptions | |
data | java.lang.Object[] | |
dataSourceNames | java.lang.String[] |
buildReport(InputStream inputStream, OutputStream outputStream, SaveOptions saveOptions, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(InputStream inputStream, OutputStream outputStream, SaveOptions saveOptions, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveOptions | SaveOptions | |
data | java.lang.Object[] | |
dataSourceNames | java.lang.String[] | |
reportBuilderOptions | ReportBuilderOptions |
buildReport(InputStream inputStream, OutputStream outputStream, int saveFormat, Object data)
public static void buildReport(InputStream inputStream, OutputStream outputStream, int saveFormat, Object data)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveFormat | int | |
data | java.lang.Object |
buildReport(InputStream inputStream, OutputStream outputStream, int saveFormat, Object data, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(InputStream inputStream, OutputStream outputStream, int saveFormat, Object data, ReportBuilderOptions reportBuilderOptions)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveFormat | int | |
data | java.lang.Object | |
reportBuilderOptions | ReportBuilderOptions |
buildReport(InputStream inputStream, OutputStream outputStream, int saveFormat, Object data, String dataSourceName)
public static void buildReport(InputStream inputStream, OutputStream outputStream, int saveFormat, Object data, String dataSourceName)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveFormat | int | |
data | java.lang.Object | |
dataSourceName | java.lang.String |
buildReport(InputStream inputStream, OutputStream outputStream, int saveFormat, Object data, String dataSourceName, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(InputStream inputStream, OutputStream outputStream, int saveFormat, Object data, String dataSourceName, ReportBuilderOptions reportBuilderOptions)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveFormat | int | |
data | java.lang.Object | |
dataSourceName | java.lang.String | |
reportBuilderOptions | ReportBuilderOptions |
buildReport(InputStream inputStream, OutputStream outputStream, int saveFormat, Object[] data, String[] dataSourceNames)
public static void buildReport(InputStream inputStream, OutputStream outputStream, int saveFormat, Object[] data, String[] dataSourceNames)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveFormat | int | |
data | java.lang.Object[] | |
dataSourceNames | java.lang.String[] |
buildReport(InputStream inputStream, OutputStream outputStream, int saveFormat, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(InputStream inputStream, OutputStream outputStream, int saveFormat, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
outputStream | java.io.OutputStream | |
saveFormat | int | |
data | java.lang.Object[] | |
dataSourceNames | java.lang.String[] | |
reportBuilderOptions | ReportBuilderOptions |
buildReport(String inputFileName, String outputFileName, SaveOptions saveOptions, Object data)
public static void buildReport(String inputFileName, String outputFileName, SaveOptions saveOptions, Object data)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveOptions | SaveOptions | |
data | java.lang.Object |
buildReport(String inputFileName, String outputFileName, SaveOptions saveOptions, Object data, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(String inputFileName, String outputFileName, SaveOptions saveOptions, Object data, ReportBuilderOptions reportBuilderOptions)
Populates the template document with data from the specified source, generating a completed report with specified output format and additional options.
Remarks:
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | The input file name. |
outputFileName | java.lang.String | The output file name. |
saveOptions | SaveOptions | The output’s save options. |
data | java.lang.Object | A data source object. |
reportBuilderOptions | ReportBuilderOptions | Additional report build options. |
buildReport(String inputFileName, String outputFileName, SaveOptions saveOptions, Object data, String dataSourceName)
public static void buildReport(String inputFileName, String outputFileName, SaveOptions saveOptions, Object data, String dataSourceName)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveOptions | SaveOptions | |
data | java.lang.Object | |
dataSourceName | java.lang.String |
buildReport(String inputFileName, String outputFileName, SaveOptions saveOptions, Object data, String dataSourceName, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(String inputFileName, String outputFileName, SaveOptions saveOptions, Object data, String dataSourceName, ReportBuilderOptions reportBuilderOptions)
Populates the template document with data from the specified source, generating a completed report with specified output format, a named data source reference, and additional options.
Remarks:
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | The input file name. |
outputFileName | java.lang.String | The output file name. |
saveOptions | SaveOptions | The output’s save options. |
data | java.lang.Object | A data source object. |
dataSourceName | java.lang.String | A name to reference the data source object in the template. |
reportBuilderOptions | ReportBuilderOptions | Additional report build options. |
buildReport(String inputFileName, String outputFileName, SaveOptions saveOptions, Object[] data, String[] dataSourceNames)
public static void buildReport(String inputFileName, String outputFileName, SaveOptions saveOptions, Object[] data, String[] dataSourceNames)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveOptions | SaveOptions | |
data | java.lang.Object[] | |
dataSourceNames | java.lang.String[] |
buildReport(String inputFileName, String outputFileName, SaveOptions saveOptions, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(String inputFileName, String outputFileName, SaveOptions saveOptions, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
Populates the template document with data from multiple sources, generating a completed report with a specified output format and additional options.
Remarks:
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | The input file name. |
outputFileName | java.lang.String | The output file name. |
saveOptions | SaveOptions | The output’s save options. |
data | java.lang.Object[] | An array of data source objects. |
dataSourceNames | java.lang.String[] | An array of names to reference the data source objects within the template. |
reportBuilderOptions | ReportBuilderOptions | Additional report build options. |
buildReport(String inputFileName, String outputFileName, int saveFormat, Object data)
public static void buildReport(String inputFileName, String outputFileName, int saveFormat, Object data)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveFormat | int | |
data | java.lang.Object |
buildReport(String inputFileName, String outputFileName, int saveFormat, Object data, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(String inputFileName, String outputFileName, int saveFormat, Object data, ReportBuilderOptions reportBuilderOptions)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveFormat | int | |
data | java.lang.Object | |
reportBuilderOptions | ReportBuilderOptions |
buildReport(String inputFileName, String outputFileName, int saveFormat, Object data, String dataSourceName)
public static void buildReport(String inputFileName, String outputFileName, int saveFormat, Object data, String dataSourceName)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveFormat | int | |
data | java.lang.Object | |
dataSourceName | java.lang.String |
buildReport(String inputFileName, String outputFileName, int saveFormat, Object data, String dataSourceName, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(String inputFileName, String outputFileName, int saveFormat, Object data, String dataSourceName, ReportBuilderOptions reportBuilderOptions)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveFormat | int | |
data | java.lang.Object | |
dataSourceName | java.lang.String | |
reportBuilderOptions | ReportBuilderOptions |
buildReport(String inputFileName, String outputFileName, int saveFormat, Object[] data, String[] dataSourceNames)
public static void buildReport(String inputFileName, String outputFileName, int saveFormat, Object[] data, String[] dataSourceNames)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveFormat | int | |
data | java.lang.Object[] | |
dataSourceNames | java.lang.String[] |
buildReport(String inputFileName, String outputFileName, int saveFormat, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(String inputFileName, String outputFileName, int saveFormat, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
saveFormat | int | |
data | java.lang.Object[] | |
dataSourceNames | java.lang.String[] | |
reportBuilderOptions | ReportBuilderOptions |
buildReport(String inputFileName, String outputFileName, Object data)
public static void buildReport(String inputFileName, String outputFileName, Object data)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
data | java.lang.Object |
buildReport(String inputFileName, String outputFileName, Object data, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(String inputFileName, String outputFileName, Object data, ReportBuilderOptions reportBuilderOptions)
Populates the template document with data from the specified source, generating a completed report with additional options.
Remarks:
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
Examples:
Shows how to populate document with data.
public void buildReportData() throws Exception {
// There is a several ways to populate document with data:
String doc = getMyDir() + "Reporting engine template - If greedy (Java).docx";
AsposeData obj = new AsposeData();
{
obj.setList(new ArrayList<>());
{
obj.getList().add("abc");
}
}
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportWithObject.1.docx", obj);
ReportBuilderOptions options = new ReportBuilderOptions();
options.setOptions(ReportBuildOptions.ALLOW_MISSING_MEMBERS);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportWithObject.2.docx", obj, options);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportWithObject.3.docx", SaveFormat.DOCX, obj);
ReportBuilder.buildReport(doc, getArtifactsDir() + "LowCode.BuildReportWithObject.4.docx", SaveFormat.DOCX, obj, options);
}
public static class AsposeData {
public ArrayList getList() {
return mList;
}
;
public void setList(ArrayList value) {
mList = value;
}
;
private ArrayList mList;
}
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | The input file name. |
outputFileName | java.lang.String | The output file name. |
data | java.lang.Object | A data source object. |
reportBuilderOptions | ReportBuilderOptions | Additional report build options. |
buildReport(String inputFileName, String outputFileName, Object data, String dataSourceName)
public static void buildReport(String inputFileName, String outputFileName, Object data, String dataSourceName)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
data | java.lang.Object | |
dataSourceName | java.lang.String |
buildReport(String inputFileName, String outputFileName, Object data, String dataSourceName, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(String inputFileName, String outputFileName, Object data, String dataSourceName, ReportBuilderOptions reportBuilderOptions)
Populates the template document with data from the specified source, generating a completed report with a named data source reference and additional options.
Remarks:
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
Examples:
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);
}
}
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | The input file name. |
outputFileName | java.lang.String | The output file name. |
data | java.lang.Object | A data source object. |
dataSourceName | java.lang.String | A name to reference the data source object in the template. |
reportBuilderOptions | ReportBuilderOptions | Additional report build options. |
buildReport(String inputFileName, String outputFileName, Object[] data, String[] dataSourceNames)
public static void buildReport(String inputFileName, String outputFileName, Object[] data, String[] dataSourceNames)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
outputFileName | java.lang.String | |
data | java.lang.Object[] | |
dataSourceNames | java.lang.String[] |
buildReport(String inputFileName, String outputFileName, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
public static void buildReport(String inputFileName, String outputFileName, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
Populates the template document with data from multiple sources, generating a completed report with additional options. This overload automatically determines the save format based on the output file extension.
Remarks:
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), each page of the output will be saved as a separate file. The specified output file name will be used to generate file names for each part following the rule: outputFile_partIndex.extension.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF file.
Examples:
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);
}
}
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | The input file name. |
outputFileName | java.lang.String | The output file name. |
data | java.lang.Object[] | An array of data source objects. |
dataSourceNames | java.lang.String[] | An array of names to reference the data source objects within the template. |
reportBuilderOptions | ReportBuilderOptions | Additional report build options. |
buildReportToImages(InputStream inputStream, ImageSaveOptions saveOptions, Object[] data, String[] dataSourceNames)
public static OutputStream[] buildReportToImages(InputStream inputStream, ImageSaveOptions saveOptions, Object[] data, String[] dataSourceNames)
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | |
saveOptions | ImageSaveOptions | |
data | java.lang.Object[] | |
dataSourceNames | java.lang.String[] |
Returns: java.io.OutputStream[]
buildReportToImages(InputStream inputStream, ImageSaveOptions saveOptions, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
public static OutputStream[] buildReportToImages(InputStream inputStream, ImageSaveOptions saveOptions, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
Populates the template document with data from multiple sources. Renders the output to images.
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();
}
}
Parameters:
Parameter | Type | Description |
---|---|---|
inputStream | java.io.InputStream | The input file stream. |
saveOptions | ImageSaveOptions | The output’s save options. |
data | java.lang.Object[] | An array of data source objects. |
dataSourceNames | java.lang.String[] | An array of names to reference the data source objects within the template. |
reportBuilderOptions | ReportBuilderOptions | Additional report build options. |
Returns: java.io.OutputStream[]
buildReportToImages(String inputFileName, ImageSaveOptions saveOptions, Object[] data, String[] dataSourceNames)
public static OutputStream[] buildReportToImages(String inputFileName, ImageSaveOptions saveOptions, Object[] data, String[] dataSourceNames)
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | |
saveOptions | ImageSaveOptions | |
data | java.lang.Object[] | |
dataSourceNames | java.lang.String[] |
Returns: java.io.OutputStream[]
buildReportToImages(String inputFileName, ImageSaveOptions saveOptions, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
public static OutputStream[] buildReportToImages(String inputFileName, ImageSaveOptions saveOptions, Object[] data, String[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)
Populates the template document with data from multiple sources. Renders the output to images.
Examples:
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);
}
}
Parameters:
Parameter | Type | Description |
---|---|---|
inputFileName | java.lang.String | The input file name. |
saveOptions | ImageSaveOptions | The output’s save options. |
data | java.lang.Object[] | An array of data source objects. |
dataSourceNames | java.lang.String[] | An array of names to reference the data source objects within the template. |
reportBuilderOptions | ReportBuilderOptions | Additional report build options. |
Returns: java.io.OutputStream[]
create()
public static ReportBuilder create()
Creates new instance of the report builder processor.
Returns: ReportBuilder
create(ReportBuilderContext context)
public static ReportBuilder create(ReportBuilderContext context)
Creates new instance of the report builder processor.
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);
}
}
Parameters:
Parameter | Type | Description |
---|---|---|
context | ReportBuilderContext |
Returns: ReportBuilder
execute()
public void execute()
Execute the processor action.
Examples:
Shows how to convert documents with a single line of code using context.
String doc = getMyDir() + "Big document.docx";
ConverterContext converterContext = new ConverterContext();
Converter.create(converterContext)
.from(doc)
.to(getArtifactsDir() + "LowCode.ConvertContext.1.pdf")
.execute();
Converter.create(converterContext)
.from(doc)
.to(getArtifactsDir() + "LowCode.ConvertContext.2.pdf", SaveFormat.RTF)
.execute();
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
{
saveOptions.setPassword("Aspose.Words");
}
LoadOptions loadOptions = new LoadOptions();
{
loadOptions.setIgnoreOleData(true);
}
Converter.create(converterContext)
.from(doc, loadOptions)
.to(getArtifactsDir() + "LowCode.ConvertContext.3.docx", saveOptions)
.execute();
Converter.create(converterContext)
.from(doc)
.to(getArtifactsDir() + "LowCode.ConvertContext.4.png", new ImageSaveOptions(SaveFormat.PNG))
.execute();
Shows how to convert documents from a stream with a single line of code using context.
String doc = getMyDir() + "Document.docx";
ConverterContext converterContext = new ConverterContext();
try (FileInputStream streamIn = new FileInputStream(doc)) {
try (FileOutputStream streamOut = new FileOutputStream(getArtifactsDir() + "LowCode.ConvertContextStream.1.docx")) {
Converter.create(converterContext)
.from(streamIn)
.to(streamOut, SaveFormat.RTF)
.execute();
}
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
{
saveOptions.setPassword("Aspose.Words");
}
LoadOptions loadOptions = new LoadOptions();
{
loadOptions.setIgnoreOleData(true);
}
try (FileOutputStream streamOut1 = new FileOutputStream(getArtifactsDir() + "LowCode.ConvertContextStream.2.docx")) {
Converter.create(converterContext)
.from(streamIn, loadOptions)
.to(streamOut1, saveOptions)
.execute();
}
}
Shows how to merge documents into a single output document using context.
//There is a several ways to merge documents:
String inputDoc1 = getMyDir() + "Big document.docx";
String inputDoc2 = getMyDir() + "Tables.docx";
MergerContext mergerContext = new MergerContext();
mergerContext.setMergeFormatMode(MergeFormatMode.KEEP_SOURCE_FORMATTING);
Merger.create(mergerContext)
.from(inputDoc1)
.from(inputDoc2)
.to(getArtifactsDir() + "LowCode.MergeContextDocuments.1.docx")
.execute();
LoadOptions firstLoadOptions = new LoadOptions();
{
firstLoadOptions.setIgnoreOleData(true);
}
LoadOptions secondLoadOptions = new LoadOptions();
{
secondLoadOptions.setIgnoreOleData(false);
}
Merger.create(mergerContext)
.from(inputDoc1, firstLoadOptions)
.from(inputDoc2, secondLoadOptions)
.to(getArtifactsDir() + "LowCode.MergeContextDocuments.2.docx", SaveFormat.DOCX)
.execute();
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
{
saveOptions.setPassword("Aspose.Words");
}
Merger.create(mergerContext)
.from(inputDoc1)
.from(inputDoc2)
.to(getArtifactsDir() + "LowCode.MergeContextDocuments.3.docx", saveOptions)
.execute();
Shows how to merge documents from stream into a single output document using context.
//There is a several ways to merge documents:
String inputDoc1 = getMyDir() + "Big document.docx";
String inputDoc2 = getMyDir() + "Tables.docx";
MergerContext mergerContext = new MergerContext();
mergerContext.setMergeFormatMode(MergeFormatMode.KEEP_SOURCE_FORMATTING);
try (FileInputStream firstStreamIn = new FileInputStream(inputDoc1)) {
try (FileInputStream secondStreamIn = new FileInputStream(inputDoc2)) {
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
{
saveOptions.setPassword("Aspose.Words");
}
try (FileOutputStream streamOut = new FileOutputStream(getArtifactsDir() + "LowCode.MergeStreamContextDocuments.1.docx")) {
Merger.create(mergerContext)
.from(firstStreamIn)
.from(secondStreamIn)
.to(streamOut, saveOptions)
.execute();
}
LoadOptions firstLoadOptions = new LoadOptions();
{
firstLoadOptions.setIgnoreOleData(true);
}
LoadOptions secondLoadOptions = new LoadOptions();
{
secondLoadOptions.setIgnoreOleData(false);
}
try (FileOutputStream streamOut1 = new FileOutputStream(getArtifactsDir() + "LowCode.MergeStreamContextDocuments.2.docx")) {
Merger.create(mergerContext)
.from(firstStreamIn, firstLoadOptions)
.from(secondStreamIn, secondLoadOptions)
.to(streamOut1, SaveFormat.DOCX)
.execute();
}
}
}
from(InputStream input)
public Processor from(InputStream input)
Parameters:
Parameter | Type | Description |
---|---|---|
input | java.io.InputStream |
Returns: Processor
from(InputStream input, LoadOptions loadOptions)
public Processor from(InputStream input, LoadOptions loadOptions)
Specifies input document for processing.
Remarks:
If the processor accepts only one file as an input, only the last specified file will be processed. Merger processor accepts multiple files as an input, as the result all the specified documents will be merged. Converter processor accepts only one file as an input, so only the last specified file will be converted.
Examples:
Shows how to convert documents from a stream with a single line of code using context.
String doc = getMyDir() + "Document.docx";
ConverterContext converterContext = new ConverterContext();
try (FileInputStream streamIn = new FileInputStream(doc)) {
try (FileOutputStream streamOut = new FileOutputStream(getArtifactsDir() + "LowCode.ConvertContextStream.1.docx")) {
Converter.create(converterContext)
.from(streamIn)
.to(streamOut, SaveFormat.RTF)
.execute();
}
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
{
saveOptions.setPassword("Aspose.Words");
}
LoadOptions loadOptions = new LoadOptions();
{
loadOptions.setIgnoreOleData(true);
}
try (FileOutputStream streamOut1 = new FileOutputStream(getArtifactsDir() + "LowCode.ConvertContextStream.2.docx")) {
Converter.create(converterContext)
.from(streamIn, loadOptions)
.to(streamOut1, saveOptions)
.execute();
}
}
Shows how to merge documents from stream into a single output document using context.
//There is a several ways to merge documents:
String inputDoc1 = getMyDir() + "Big document.docx";
String inputDoc2 = getMyDir() + "Tables.docx";
MergerContext mergerContext = new MergerContext();
mergerContext.setMergeFormatMode(MergeFormatMode.KEEP_SOURCE_FORMATTING);
try (FileInputStream firstStreamIn = new FileInputStream(inputDoc1)) {
try (FileInputStream secondStreamIn = new FileInputStream(inputDoc2)) {
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
{
saveOptions.setPassword("Aspose.Words");
}
try (FileOutputStream streamOut = new FileOutputStream(getArtifactsDir() + "LowCode.MergeStreamContextDocuments.1.docx")) {
Merger.create(mergerContext)
.from(firstStreamIn)
.from(secondStreamIn)
.to(streamOut, saveOptions)
.execute();
}
LoadOptions firstLoadOptions = new LoadOptions();
{
firstLoadOptions.setIgnoreOleData(true);
}
LoadOptions secondLoadOptions = new LoadOptions();
{
secondLoadOptions.setIgnoreOleData(false);
}
try (FileOutputStream streamOut1 = new FileOutputStream(getArtifactsDir() + "LowCode.MergeStreamContextDocuments.2.docx")) {
Merger.create(mergerContext)
.from(firstStreamIn, firstLoadOptions)
.from(secondStreamIn, secondLoadOptions)
.to(streamOut1, SaveFormat.DOCX)
.execute();
}
}
}
Parameters:
Parameter | Type | Description |
---|---|---|
input | java.io.InputStream | Input document stream. |
loadOptions | LoadOptions | Optional load options used to load the document. |
Returns: Processor - Returns processor with specified input file stream.
from(String input)
public Processor from(String input)
Parameters:
Parameter | Type | Description |
---|---|---|
input | java.lang.String |
Returns: Processor
from(String input, LoadOptions loadOptions)
public Processor from(String input, LoadOptions loadOptions)
Specifies input document for processing.
Remarks:
If the processor accepts only one file as an input, only the last specified file will be processed. Merger processor accepts multiple files as an input, as the result all the specified documents will be merged. Converter processor accepts only one file as an input, so only the last specified file will be converted.
Examples:
Shows how to convert documents with a single line of code using context.
String doc = getMyDir() + "Big document.docx";
ConverterContext converterContext = new ConverterContext();
Converter.create(converterContext)
.from(doc)
.to(getArtifactsDir() + "LowCode.ConvertContext.1.pdf")
.execute();
Converter.create(converterContext)
.from(doc)
.to(getArtifactsDir() + "LowCode.ConvertContext.2.pdf", SaveFormat.RTF)
.execute();
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
{
saveOptions.setPassword("Aspose.Words");
}
LoadOptions loadOptions = new LoadOptions();
{
loadOptions.setIgnoreOleData(true);
}
Converter.create(converterContext)
.from(doc, loadOptions)
.to(getArtifactsDir() + "LowCode.ConvertContext.3.docx", saveOptions)
.execute();
Converter.create(converterContext)
.from(doc)
.to(getArtifactsDir() + "LowCode.ConvertContext.4.png", new ImageSaveOptions(SaveFormat.PNG))
.execute();
Shows how to merge documents into a single output document using context.
//There is a several ways to merge documents:
String inputDoc1 = getMyDir() + "Big document.docx";
String inputDoc2 = getMyDir() + "Tables.docx";
MergerContext mergerContext = new MergerContext();
mergerContext.setMergeFormatMode(MergeFormatMode.KEEP_SOURCE_FORMATTING);
Merger.create(mergerContext)
.from(inputDoc1)
.from(inputDoc2)
.to(getArtifactsDir() + "LowCode.MergeContextDocuments.1.docx")
.execute();
LoadOptions firstLoadOptions = new LoadOptions();
{
firstLoadOptions.setIgnoreOleData(true);
}
LoadOptions secondLoadOptions = new LoadOptions();
{
secondLoadOptions.setIgnoreOleData(false);
}
Merger.create(mergerContext)
.from(inputDoc1, firstLoadOptions)
.from(inputDoc2, secondLoadOptions)
.to(getArtifactsDir() + "LowCode.MergeContextDocuments.2.docx", SaveFormat.DOCX)
.execute();
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
{
saveOptions.setPassword("Aspose.Words");
}
Merger.create(mergerContext)
.from(inputDoc1)
.from(inputDoc2)
.to(getArtifactsDir() + "LowCode.MergeContextDocuments.3.docx", saveOptions)
.execute();
Parameters:
Parameter | Type | Description |
---|---|---|
input | java.lang.String | Input document file name. |
loadOptions | LoadOptions | Optional load options used to load the document. |
Returns: Processor - Returns processor with specified input file.
to(OutputStream output, SaveOptions saveOptions)
public Processor to(OutputStream output, SaveOptions saveOptions)
Parameters:
Parameter | Type | Description |
---|---|---|
output | java.io.OutputStream | |
saveOptions | SaveOptions |
Returns: Processor
to(OutputStream output, int saveFormat)
public Processor to(OutputStream output, int saveFormat)
Parameters:
Parameter | Type | Description |
---|---|---|
output | java.io.OutputStream | |
saveFormat | int |
Returns: Processor
to(String output)
public Processor to(String output)
Parameters:
Parameter | Type | Description |
---|---|---|
output | java.lang.String |
Returns: Processor
to(String output, SaveOptions saveOptions)
public Processor to(String output, SaveOptions saveOptions)
Specifies output file for the processor.
Remarks:
If the output consists of multiple files, the specified output file name is used to generate the file name for each part following the rule: ‘outputFile_partIndex.extension’.
Examples:
Shows how to convert documents with a single line of code using context.
String doc = getMyDir() + "Big document.docx";
ConverterContext converterContext = new ConverterContext();
Converter.create(converterContext)
.from(doc)
.to(getArtifactsDir() + "LowCode.ConvertContext.1.pdf")
.execute();
Converter.create(converterContext)
.from(doc)
.to(getArtifactsDir() + "LowCode.ConvertContext.2.pdf", SaveFormat.RTF)
.execute();
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
{
saveOptions.setPassword("Aspose.Words");
}
LoadOptions loadOptions = new LoadOptions();
{
loadOptions.setIgnoreOleData(true);
}
Converter.create(converterContext)
.from(doc, loadOptions)
.to(getArtifactsDir() + "LowCode.ConvertContext.3.docx", saveOptions)
.execute();
Converter.create(converterContext)
.from(doc)
.to(getArtifactsDir() + "LowCode.ConvertContext.4.png", new ImageSaveOptions(SaveFormat.PNG))
.execute();
Shows how to merge documents into a single output document using context.
//There is a several ways to merge documents:
String inputDoc1 = getMyDir() + "Big document.docx";
String inputDoc2 = getMyDir() + "Tables.docx";
MergerContext mergerContext = new MergerContext();
mergerContext.setMergeFormatMode(MergeFormatMode.KEEP_SOURCE_FORMATTING);
Merger.create(mergerContext)
.from(inputDoc1)
.from(inputDoc2)
.to(getArtifactsDir() + "LowCode.MergeContextDocuments.1.docx")
.execute();
LoadOptions firstLoadOptions = new LoadOptions();
{
firstLoadOptions.setIgnoreOleData(true);
}
LoadOptions secondLoadOptions = new LoadOptions();
{
secondLoadOptions.setIgnoreOleData(false);
}
Merger.create(mergerContext)
.from(inputDoc1, firstLoadOptions)
.from(inputDoc2, secondLoadOptions)
.to(getArtifactsDir() + "LowCode.MergeContextDocuments.2.docx", SaveFormat.DOCX)
.execute();
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
{
saveOptions.setPassword("Aspose.Words");
}
Merger.create(mergerContext)
.from(inputDoc1)
.from(inputDoc2)
.to(getArtifactsDir() + "LowCode.MergeContextDocuments.3.docx", saveOptions)
.execute();
Parameters:
Parameter | Type | Description |
---|---|---|
output | java.lang.String | Output file name. |
saveOptions | SaveOptions | Optional save options. If not specified, save format is determined by the file extension. |
Returns: Processor - Returns processor with specified output file.
to(String output, int saveFormat)
public Processor to(String output, int saveFormat)
Parameters:
Parameter | Type | Description |
---|---|---|
output | java.lang.String | |
saveFormat | int |
Returns: Processor
to(ArrayList output, SaveOptions saveOptions)
public Processor to(ArrayList output, SaveOptions saveOptions)
Parameters:
Parameter | Type | Description |
---|---|---|
output | java.util.ArrayList | |
saveOptions | SaveOptions |
Returns: Processor
to(ArrayList output, int saveFormat)
public Processor to(ArrayList output, int saveFormat)
Parameters:
Parameter | Type | Description |
---|---|---|
output | java.util.ArrayList | |
saveFormat | int |
Returns: Processor
toOutput(ArrayList output, SaveOptions saveOptions)
public Processor toOutput(ArrayList output, SaveOptions saveOptions)
Parameters:
Parameter | Type | Description |
---|---|---|
output | java.util.ArrayList | |
saveOptions | SaveOptions |
Returns: Processor
toOutput(ArrayList output, int saveFormat)
public Processor toOutput(ArrayList output, int saveFormat)
Parameters:
Parameter | Type | Description |
---|---|---|
output | java.util.ArrayList | |
saveFormat | int |
Returns: Processor