ReportBuilder.BuildReportToImages

ReportBuilder BuildReportToImages method. Populates the template document with data from multiple sources. Renders the output to images.

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 = null)
ParameterTypeDescription
inputFileNameStringThe input file name.
saveOptionsImageSaveOptionsThe output’s save options.
dataObject[]An array of data source objects.
dataSourceNamesString[]An array of names to reference the data source objects within the template.
reportBuilderOptionsReportBuilderOptionsAdditional report build options.

Examples

Class used as a data object.

public class DummyData
{
    public string Name { get; set; }
    public string Position { get; set; }
}

Shows how to fill a template from an object using LINQ Reporting Engine and save the result to image streams.

List<DummyData> data = new List<DummyData>();
data.Add(new DummyData() { Name = "James Bond", Position = "Spy" });
data.Add(new DummyData() { Name = "John Doe", Position = "Unknown" });

Stream[] pages = ReportBuilder.BuildReportToImages(MyDir + "ReportingTemplateForeach.docx", new ImageSaveOptions(SaveFormat.Png), new object[] { data }, new string[] { "data" });

See Also


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 = null)
ParameterTypeDescription
inputStreamStreamThe input file stream.
saveOptionsImageSaveOptionsThe output’s save options.
dataObject[]An array of data source objects.
dataSourceNamesString[]An array of names to reference the data source objects within the template.
reportBuilderOptionsReportBuilderOptionsAdditional report build options.

Examples

Class used as a data object.

public class DummyData
{
    public string Name { get; set; }
    public string Position { get; set; }
}

Shows how to fill a template loaded from a stream with data from an object using the LINQ Reporting Engine and save the result as image streams.

List<DummyData> data = new List<DummyData>();
data.Add(new DummyData() { Name = "James Bond", Position = "Spy" });
data.Add(new DummyData() { Name = "John Doe", Position = "Unknown" });

using (Stream input = File.OpenRead(MyDir + "ReportingTemplateForeach.docx"))
{
    Stream[] pages = ReportBuilder.BuildReportToImages(input, new ImageSaveOptions(SaveFormat.Png), new object[] { data }, new string[] { "data" });
}

See Also