Class ReportBuilder
Namespace: Aspose.Words.LowCode
Assembly: Aspose.Words.dll (25.12.0)
Provides methods intended to fill template with data using LINQ Reporting Engine.
public class ReportBuilder : ProcessorInheritance
object ← Processor ← ReportBuilder
Inherited Members
Processor.mResultDocument , Processor.From(string) , Processor.From(string, LoadOptions) , Processor.From(Stream) , Processor.From(Stream, LoadOptions) , Processor.To(string) , Processor.To(string, SaveOptions) , Processor.To(string, SaveFormat) , Processor.To(Stream, SaveOptions) , Processor.To(Stream, SaveFormat) , Processor.To(List<Stream>, SaveOptions) , Processor.To(List<Stream>, SaveFormat) , Processor.Execute() , Processor.Execute(CancellationToken) , Processor.ExecuteCore() , Processor.CheckArgumentsSet() , Processor.GetPartFileName(string, int, SaveFormat) , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Methods
BuildReport(string, string, object)
Populates the template document with data from the specified source, generating a completed report with additional options.
public static void BuildReport(string inputFileName, string outputFileName, object data)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
data object
A data source object.
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.
BuildReport(string, string, object, ReportBuilderOptions)
Populates the template document with data from the specified source, generating a completed report with additional options.
public static void BuildReport(string inputFileName, string outputFileName, object data, ReportBuilderOptions reportBuilderOptions)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
data object
A data source object.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Examples
Shows how to populate document with data.
public void BuildReportData()
{
// There is a several ways to populate document with data:
string doc = MyDir + "Reporting engine template - If greedy.docx";
AsposeData obj = new AsposeData { List = new List<string> { "abc" } };
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportWithObject.1.docx", obj);
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportWithObject.2.docx", obj, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportWithObject.3.docx", SaveFormat.Docx, obj);
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportWithObject.4.docx", SaveFormat.Docx, obj, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
}
public class AsposeData
{
public List<string> List { get; set; }
}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.
BuildReport(string, string, SaveFormat, object)
Populates the template document with data from the specified source, generating a completed report with specified output format and additional options.
public static void BuildReport(string inputFileName, string outputFileName, SaveFormat saveFormat, object data)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveFormat SaveFormat
The output’s save format.
data object
A data source object.
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.
BuildReport(string, string, SaveFormat, object, ReportBuilderOptions)
Populates the template document with data from the specified source, generating a completed report with specified output format and additional options.
public static void BuildReport(string inputFileName, string outputFileName, SaveFormat saveFormat, object data, ReportBuilderOptions reportBuilderOptions)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveFormat SaveFormat
The output’s save format.
data object
A data source object.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Examples
Shows how to populate document with data.
public void BuildReportData()
{
// There is a several ways to populate document with data:
string doc = MyDir + "Reporting engine template - If greedy.docx";
AsposeData obj = new AsposeData { List = new List<string> { "abc" } };
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportWithObject.1.docx", obj);
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportWithObject.2.docx", obj, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportWithObject.3.docx", SaveFormat.Docx, obj);
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportWithObject.4.docx", SaveFormat.Docx, obj, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
}
public class AsposeData
{
public List<string> List { get; set; }
}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.
BuildReport(string, string, SaveOptions, object)
Populates the template document with data from the specified source, generating a completed report with specified output format and additional options.
public static void BuildReport(string inputFileName, string outputFileName, SaveOptions saveOptions, object data)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveOptions SaveOptions
The output’s save options.
data object
A data source object.
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.
BuildReport(string, string, SaveOptions, object, ReportBuilderOptions)
Populates the template document with data from the specified source, generating a completed report with specified output format and additional options.
public static void BuildReport(string inputFileName, string outputFileName, SaveOptions saveOptions, object data, ReportBuilderOptions reportBuilderOptions)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveOptions SaveOptions
The output’s save options.
data object
A data source object.
reportBuilderOptions ReportBuilderOptions
Additional report build 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.
BuildReport(Stream, Stream, SaveFormat, object)
Populates the template document with data from the specified source, generating a completed report with specified output format and additional options, from input and output streams.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveFormat saveFormat, object data)Parameters
inputStream Stream
The input file stream.
outputStream Stream
The output file stream.
saveFormat SaveFormat
The output’s save format.
data object
A data source object.
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
BuildReport(Stream, Stream, SaveFormat, object, ReportBuilderOptions)
Populates the template document with data from the specified source, generating a completed report with specified output format and additional options, from input and output streams.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveFormat saveFormat, object data, ReportBuilderOptions reportBuilderOptions)Parameters
inputStream Stream
The input file stream.
outputStream Stream
The output file stream.
saveFormat SaveFormat
The output’s save format.
data object
A data source object.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Examples
Shows how to populate document with data using documents from the stream.
// There is a several ways to populate document with data using documents from the stream:
AsposeData obj = new AsposeData { List = new List<string> { "abc" } };
using (FileStream streamIn = new FileStream(MyDir + "Reporting engine template - If greedy.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataStream.1.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, obj);
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataStream.2.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, obj, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataStream.3.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
}Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
BuildReport(Stream, Stream, SaveOptions, object)
Populates the template document with data from the specified source, generating a completed report with specified output format and additional options, from input and output streams.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveOptions saveOptions, object data)Parameters
inputStream Stream
The input file stream.
outputStream Stream
The output file stream.
saveOptions SaveOptions
The output’s save options.
data object
A data source object.
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
BuildReport(Stream, Stream, SaveOptions, object, ReportBuilderOptions)
Populates the template document with data from the specified source, generating a completed report with specified output format and additional options, from input and output streams.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveOptions saveOptions, object data, ReportBuilderOptions reportBuilderOptions)Parameters
inputStream Stream
The input file stream.
outputStream Stream
The output file stream.
saveOptions SaveOptions
The output’s save options.
data object
A data source object.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
BuildReport(string, string, object, string)
Populates the template document with data from the specified source, generating a completed report with a named data source reference and additional options.
public static void BuildReport(string inputFileName, string outputFileName, object data, string dataSourceName)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
data object
A data source object.
dataSourceName string
A name to reference the data source object in the template.
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.
BuildReport(string, string, object, string, ReportBuilderOptions)
Populates the template document with data from the specified source, generating a completed report with a named data source reference and additional options.
public static void BuildReport(string inputFileName, string outputFileName, object data, string dataSourceName, ReportBuilderOptions reportBuilderOptions)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
data object
A data source object.
dataSourceName string
A name to reference the data source object in the template.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Examples
Shows how to populate document with data sources.
public void BuildReportDataSource()
{
// There is a several ways to populate document with data sources:
string doc = MyDir + "Report building.docx";
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.1.docx", sender, "s");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.2.docx", new object[] { sender }, new[] { "s" });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.3.docx", sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.4.docx", SaveFormat.Docx, sender, "s");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.5.docx", SaveFormat.Docx, new object[] { sender }, new[] { "s" });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.6.docx", SaveFormat.Docx, sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.7.docx", SaveFormat.Docx, new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.8.docx", new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
Stream[] images = ReportBuilder.BuildReportToImages(doc, new ImageSaveOptions(SaveFormat.Png), new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.ReportBuilderOptions.MissingMemberMessage = "Missed members";
reportBuilderContext.DataSources.Add(sender, "s");
ReportBuilder.Create(reportBuilderContext)
.From(doc)
.To(ArtifactsDir + "LowCode.BuildReportDataSource.9.docx")
.Execute();
}
public class MessageTestClass
{
public string Name { get; set; }
public string Message { get; set; }
public MessageTestClass(string name, string message)
{
Name = name;
Message = message;
}
}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.
BuildReport(string, string, SaveFormat, object, string)
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.
public static void BuildReport(string inputFileName, string outputFileName, SaveFormat saveFormat, object data, string dataSourceName)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveFormat SaveFormat
The output’s save format.
data object
A data source object.
dataSourceName string
A name to reference the data source object in the template.
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.
BuildReport(string, string, SaveFormat, object, string, 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.
public static void BuildReport(string inputFileName, string outputFileName, SaveFormat saveFormat, object data, string dataSourceName, ReportBuilderOptions reportBuilderOptions)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveFormat SaveFormat
The output’s save format.
data object
A data source object.
dataSourceName string
A name to reference the data source object in the template.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Examples
Shows how to populate document with data sources.
public void BuildReportDataSource()
{
// There is a several ways to populate document with data sources:
string doc = MyDir + "Report building.docx";
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.1.docx", sender, "s");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.2.docx", new object[] { sender }, new[] { "s" });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.3.docx", sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.4.docx", SaveFormat.Docx, sender, "s");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.5.docx", SaveFormat.Docx, new object[] { sender }, new[] { "s" });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.6.docx", SaveFormat.Docx, sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.7.docx", SaveFormat.Docx, new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.8.docx", new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
Stream[] images = ReportBuilder.BuildReportToImages(doc, new ImageSaveOptions(SaveFormat.Png), new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.ReportBuilderOptions.MissingMemberMessage = "Missed members";
reportBuilderContext.DataSources.Add(sender, "s");
ReportBuilder.Create(reportBuilderContext)
.From(doc)
.To(ArtifactsDir + "LowCode.BuildReportDataSource.9.docx")
.Execute();
}
public class MessageTestClass
{
public string Name { get; set; }
public string Message { get; set; }
public MessageTestClass(string name, string message)
{
Name = name;
Message = message;
}
}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.
BuildReport(string, string, SaveOptions, object, string)
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.
public static void BuildReport(string inputFileName, string outputFileName, SaveOptions saveOptions, object data, string dataSourceName)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveOptions SaveOptions
The output’s save options.
data object
A data source object.
dataSourceName string
A name to reference the data source object in the template.
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.
BuildReport(string, string, SaveOptions, object, string, 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.
public static void BuildReport(string inputFileName, string outputFileName, SaveOptions saveOptions, object data, string dataSourceName, ReportBuilderOptions reportBuilderOptions)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveOptions SaveOptions
The output’s save options.
data object
A data source object.
dataSourceName string
A name to reference the data source object in the template.
reportBuilderOptions ReportBuilderOptions
Additional report build 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.
BuildReport(Stream, Stream, SaveFormat, object, string)
Populates the template document with data from the specified source, generating a completed report with a named data source reference and additional options.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveFormat saveFormat, object data, string dataSourceName)Parameters
inputStream Stream
The input file stream.
outputStream Stream
The output file stream.
saveFormat SaveFormat
The output’s save format.
data object
A data source object.
dataSourceName string
A name to reference the data source object in the template.
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
BuildReport(Stream, Stream, SaveFormat, object, string, ReportBuilderOptions)
Populates the template document with data from the specified source, generating a completed report with a named data source reference and additional options.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveFormat saveFormat, object data, string dataSourceName, ReportBuilderOptions reportBuilderOptions)Parameters
inputStream Stream
The input file stream.
outputStream Stream
The output file stream.
saveFormat SaveFormat
The output’s save format.
data object
A data source object.
dataSourceName string
A name to reference the data source object in the template.
reportBuilderOptions ReportBuilderOptions
Additional 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");
using (FileStream streamIn = new FileStream(MyDir + "Report building.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataSourceStream.1.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, new object[] { sender }, new[] { "s" });
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataSourceStream.2.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, sender, "s");
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataSourceStream.3.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
Stream[] images = ReportBuilder.BuildReportToImages(streamIn, new ImageSaveOptions(SaveFormat.Png), new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.ReportBuilderOptions.MissingMemberMessage = "Missed members";
reportBuilderContext.DataSources.Add(sender, "s");
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataSourceStream.4.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.Create(reportBuilderContext)
.From(streamIn)
.To(streamOut, SaveFormat.Docx)
.Execute();
}Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
BuildReport(Stream, Stream, SaveOptions, object, string)
Populates the template document with data from the specified source, generating a completed report with a named data source reference and additional options.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveOptions saveOptions, object data, string dataSourceName)Parameters
inputStream Stream
The input file stream.
outputStream Stream
The output file stream.
saveOptions SaveOptions
The output’s save options.
data object
A data source object.
dataSourceName string
A name to reference the data source object in the template.
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
BuildReport(Stream, Stream, SaveOptions, object, string, ReportBuilderOptions)
Populates the template document with data from the specified source, generating a completed report with a named data source reference and additional options.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveOptions saveOptions, object data, string dataSourceName, ReportBuilderOptions reportBuilderOptions)Parameters
inputStream Stream
The input file stream.
outputStream Stream
The output file stream.
saveOptions SaveOptions
The output’s save options.
data object
A data source object.
dataSourceName string
A name to reference the data source object in the template.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
BuildReport(string, string, object[], string[])
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.
public static void BuildReport(string inputFileName, string outputFileName, object[] data, string[] dataSourceNames)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
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.
BuildReport(string, string, object[], string[], 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.
public static void BuildReport(string inputFileName, string outputFileName, object[] data, string[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Examples
Shows how to populate document with data sources.
public void BuildReportDataSource()
{
// There is a several ways to populate document with data sources:
string doc = MyDir + "Report building.docx";
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.1.docx", sender, "s");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.2.docx", new object[] { sender }, new[] { "s" });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.3.docx", sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.4.docx", SaveFormat.Docx, sender, "s");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.5.docx", SaveFormat.Docx, new object[] { sender }, new[] { "s" });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.6.docx", SaveFormat.Docx, sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.7.docx", SaveFormat.Docx, new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.8.docx", new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
Stream[] images = ReportBuilder.BuildReportToImages(doc, new ImageSaveOptions(SaveFormat.Png), new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.ReportBuilderOptions.MissingMemberMessage = "Missed members";
reportBuilderContext.DataSources.Add(sender, "s");
ReportBuilder.Create(reportBuilderContext)
.From(doc)
.To(ArtifactsDir + "LowCode.BuildReportDataSource.9.docx")
.Execute();
}
public class MessageTestClass
{
public string Name { get; set; }
public string Message { get; set; }
public MessageTestClass(string name, string message)
{
Name = name;
Message = message;
}
}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.
BuildReport(string, string, SaveFormat, object[], string[])
Populates the template document with data from multiple sources, generating a completed report with a specified output format and additional options.
public static void BuildReport(string inputFileName, string outputFileName, SaveFormat saveFormat, object[] data, string[] dataSourceNames)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveFormat SaveFormat
The output’s save format.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
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.
BuildReport(string, string, SaveFormat, object[], string[], ReportBuilderOptions)
Populates the template document with data from multiple sources, generating a completed report with a specified output format and additional options.
public static void BuildReport(string inputFileName, string outputFileName, SaveFormat saveFormat, object[] data, string[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveFormat SaveFormat
The output’s save format.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Examples
Shows how to populate document with data sources.
public void BuildReportDataSource()
{
// There is a several ways to populate document with data sources:
string doc = MyDir + "Report building.docx";
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.1.docx", sender, "s");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.2.docx", new object[] { sender }, new[] { "s" });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.3.docx", sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.4.docx", SaveFormat.Docx, sender, "s");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.5.docx", SaveFormat.Docx, new object[] { sender }, new[] { "s" });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.6.docx", SaveFormat.Docx, sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.7.docx", SaveFormat.Docx, new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.8.docx", new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
Stream[] images = ReportBuilder.BuildReportToImages(doc, new ImageSaveOptions(SaveFormat.Png), new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.ReportBuilderOptions.MissingMemberMessage = "Missed members";
reportBuilderContext.DataSources.Add(sender, "s");
ReportBuilder.Create(reportBuilderContext)
.From(doc)
.To(ArtifactsDir + "LowCode.BuildReportDataSource.9.docx")
.Execute();
}
public class MessageTestClass
{
public string Name { get; set; }
public string Message { get; set; }
public MessageTestClass(string name, string message)
{
Name = name;
Message = message;
}
}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.
BuildReport(string, string, SaveOptions, object[], string[])
Populates the template document with data from multiple sources, generating a completed report with a specified output format and additional options.
public static void BuildReport(string inputFileName, string outputFileName, SaveOptions saveOptions, object[] data, string[] dataSourceNames)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveOptions SaveOptions
The output’s save options.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
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.
BuildReport(string, string, SaveOptions, object[], string[], ReportBuilderOptions)
Populates the template document with data from multiple sources, generating a completed report with a specified output format and additional options.
public static void BuildReport(string inputFileName, string outputFileName, SaveOptions saveOptions, object[] data, string[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)Parameters
inputFileName string
The input file name.
outputFileName string
The output file name.
saveOptions SaveOptions
The output’s save options.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
reportBuilderOptions ReportBuilderOptions
Additional report build 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.
BuildReport(Stream, Stream, SaveFormat, object[], string[])
Populates the template document with data from multiple sources, generating a completed report with specified output format and additional options from the specified input and output file streams.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveFormat saveFormat, object[] data, string[] dataSourceNames)Parameters
inputStream Stream
The input file stream.
outputStream Stream
The output file stream.
saveFormat SaveFormat
The output’s save format.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
BuildReport(Stream, Stream, SaveFormat, object[], string[], ReportBuilderOptions)
Populates the template document with data from multiple sources, generating a completed report with specified output format and additional options from the specified input and output file streams.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveFormat saveFormat, object[] data, string[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)Parameters
inputStream Stream
The input file stream.
outputStream Stream
The output file stream.
saveFormat SaveFormat
The output’s save format.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Examples
Shows how to populate document with data using documents from the stream.
// There is a several ways to populate document with data using documents from the stream:
AsposeData obj = new AsposeData { List = new List<string> { "abc" } };
using (FileStream streamIn = new FileStream(MyDir + "Reporting engine template - If greedy.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataStream.1.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, obj);
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataStream.2.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, obj, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataStream.3.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
}Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
BuildReport(Stream, Stream, SaveOptions, object[], string[])
Populates the template document with data from multiple sources, generating a completed report with specified output format and additional options from the specified input and output file streams.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveOptions saveOptions, object[] data, string[] dataSourceNames)Parameters
inputStream Stream
The input file stream.
outputStream Stream
The output file stream.
saveOptions SaveOptions
The output’s save options.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
BuildReport(Stream, Stream, SaveOptions, object[], string[], ReportBuilderOptions)
Populates the template document with data from multiple sources, generating a completed report with specified output format and additional options from the specified input and output file streams.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveOptions saveOptions, object[] data, string[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)Parameters
inputStream Stream
The input file stream.
outputStream Stream
The output file stream.
saveOptions SaveOptions
The output’s save options.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Remarks
If the output format is an image (BMP, EMF, EPS, GIF, JPEG, PNG, or WebP), only the first page of the output will be saved to the specified stream.
If the output format is TIFF, the output will be saved as a single multi-frame TIFF to the specified stream.
BuildReportToImages(string, ImageSaveOptions, object[], string[])
Populates the template document with data from multiple sources. Renders the output to images.
public static Stream[] BuildReportToImages(string inputFileName, ImageSaveOptions saveOptions, object[] data, string[] dataSourceNames)Parameters
inputFileName string
The input file name.
saveOptions ImageSaveOptions
The output’s save options.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
Returns
Stream []
BuildReportToImages(string, ImageSaveOptions, object[], string[], ReportBuilderOptions)
Populates the template document with data from multiple sources. Renders the output to images.
public static Stream[] BuildReportToImages(string inputFileName, ImageSaveOptions saveOptions, object[] data, string[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)Parameters
inputFileName string
The input file name.
saveOptions ImageSaveOptions
The output’s save options.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Returns
Stream []
Examples
Shows how to populate document with data sources.
public void BuildReportDataSource()
{
// There is a several ways to populate document with data sources:
string doc = MyDir + "Report building.docx";
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.1.docx", sender, "s");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.2.docx", new object[] { sender }, new[] { "s" });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.3.docx", sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.4.docx", SaveFormat.Docx, sender, "s");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.5.docx", SaveFormat.Docx, new object[] { sender }, new[] { "s" });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.6.docx", SaveFormat.Docx, sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.7.docx", SaveFormat.Docx, new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.8.docx", new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
Stream[] images = ReportBuilder.BuildReportToImages(doc, new ImageSaveOptions(SaveFormat.Png), new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.ReportBuilderOptions.MissingMemberMessage = "Missed members";
reportBuilderContext.DataSources.Add(sender, "s");
ReportBuilder.Create(reportBuilderContext)
.From(doc)
.To(ArtifactsDir + "LowCode.BuildReportDataSource.9.docx")
.Execute();
}
public class MessageTestClass
{
public string Name { get; set; }
public string Message { get; set; }
public MessageTestClass(string name, string message)
{
Name = name;
Message = message;
}
}BuildReportToImages(Stream, ImageSaveOptions, object[], string[])
Populates the template document with data from multiple sources. Renders the output to images.
public static Stream[] BuildReportToImages(Stream inputStream, ImageSaveOptions saveOptions, object[] data, string[] dataSourceNames)Parameters
inputStream Stream
The input file stream.
saveOptions ImageSaveOptions
The output’s save options.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
Returns
Stream []
BuildReportToImages(Stream, ImageSaveOptions, object[], string[], ReportBuilderOptions)
Populates the template document with data from multiple sources. Renders the output to images.
public static Stream[] BuildReportToImages(Stream inputStream, ImageSaveOptions saveOptions, object[] data, string[] dataSourceNames, ReportBuilderOptions reportBuilderOptions)Parameters
inputStream Stream
The input file stream.
saveOptions ImageSaveOptions
The output’s save options.
data object
[]
An array of data source objects.
dataSourceNames string
[]
An array of names to reference the data source objects within the template.
reportBuilderOptions ReportBuilderOptions
Additional report build options.
Returns
Stream []
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");
using (FileStream streamIn = new FileStream(MyDir + "Report building.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataSourceStream.1.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, new object[] { sender }, new[] { "s" });
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataSourceStream.2.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, sender, "s");
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataSourceStream.3.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
Stream[] images = ReportBuilder.BuildReportToImages(streamIn, new ImageSaveOptions(SaveFormat.Png), new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.ReportBuilderOptions.MissingMemberMessage = "Missed members";
reportBuilderContext.DataSources.Add(sender, "s");
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataSourceStream.4.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.Create(reportBuilderContext)
.From(streamIn)
.To(streamOut, SaveFormat.Docx)
.Execute();
}Create()
Creates new instance of the report builder processor.
public static ReportBuilder Create()Returns
Create(ReportBuilderContext)
Creates new instance of the report builder processor.
public static ReportBuilder Create(ReportBuilderContext context)Parameters
context ReportBuilderContext
Returns
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");
using (FileStream streamIn = new FileStream(MyDir + "Report building.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataSourceStream.1.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, new object[] { sender }, new[] { "s" });
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataSourceStream.2.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, sender, "s");
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataSourceStream.3.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.BuildReport(streamIn, streamOut, SaveFormat.Docx, sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
Stream[] images = ReportBuilder.BuildReportToImages(streamIn, new ImageSaveOptions(SaveFormat.Png), new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.ReportBuilderOptions.MissingMemberMessage = "Missed members";
reportBuilderContext.DataSources.Add(sender, "s");
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.BuildReportDataSourceStream.4.docx", FileMode.Create, FileAccess.ReadWrite))
ReportBuilder.Create(reportBuilderContext)
.From(streamIn)
.To(streamOut, SaveFormat.Docx)
.Execute();
}Shows how to populate document with data sources.
public void BuildReportDataSource()
{
// There is a several ways to populate document with data sources:
string doc = MyDir + "Report building.docx";
MessageTestClass sender = new MessageTestClass("LINQ Reporting Engine", "Hello World");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.1.docx", sender, "s");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.2.docx", new object[] { sender }, new[] { "s" });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.3.docx", sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.4.docx", SaveFormat.Docx, sender, "s");
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.5.docx", SaveFormat.Docx, new object[] { sender }, new[] { "s" });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.6.docx", SaveFormat.Docx, sender, "s", new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.7.docx", SaveFormat.Docx, new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilder.BuildReport(doc, ArtifactsDir + "LowCode.BuildReportDataSource.8.docx", new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
Stream[] images = ReportBuilder.BuildReportToImages(doc, new ImageSaveOptions(SaveFormat.Png), new object[] { sender }, new[] { "s" }, new ReportBuilderOptions() { Options = ReportBuildOptions.AllowMissingMembers });
ReportBuilderContext reportBuilderContext = new ReportBuilderContext();
reportBuilderContext.ReportBuilderOptions.MissingMemberMessage = "Missed members";
reportBuilderContext.DataSources.Add(sender, "s");
ReportBuilder.Create(reportBuilderContext)
.From(doc)
.To(ArtifactsDir + "LowCode.BuildReportDataSource.9.docx")
.Execute();
}
public class MessageTestClass
{
public string Name { get; set; }
public string Message { get; set; }
public MessageTestClass(string name, string message)
{
Name = name;
Message = message;
}
}ExecuteCore()
protected override void ExecuteCore()