ReportBuilder.BuildReport
BuildReport(string, string, object, ReportBuilderOptions)
Populates the specified template document with data from the specified source making it a ready report.
public static void BuildReport(string inputFileName, string outputFileName, object data,
ReportBuilderOptions reportBuilderOptions = null)
Parameter | Type | Description |
---|---|---|
inputFileName | String | The input file name. |
outputFileName | String | The output file name. |
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.
Examples
Shows how to fill template with data from JSON data source loaded from file using LINQ Reporting engine.
JsonDataSource ds = new JsonDataSource(MyDir + "ReportingData.json", new JsonDataLoadOptions() { AlwaysGenerateRootObject = true });
ReportBuilder.BuildReport(MyDir + "ReportingTemplateForeach.docx", ArtifactsDir + "ReportingForeachJsonDataSource.docx", ds);
See Also
- class ReportBuilderOptions
- class ReportBuilder
- namespace Wordize.Reporting
- assembly Wordize
BuildReport(string, string, SaveFormat, object, ReportBuilderOptions)
Populates the specified template document with data from the specified source making it a ready report.
public static void BuildReport(string inputFileName, string outputFileName, SaveFormat saveFormat,
object data, ReportBuilderOptions reportBuilderOptions = null)
Parameter | Type | Description |
---|---|---|
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. |
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 fill a template from a JSON file using LINQ Reporting Engine and save the result with a specified format.
JsonDataSource ds = new JsonDataSource(MyDir + "ReportingData.json", new JsonDataLoadOptions() { AlwaysGenerateRootObject = true });
ReportBuilder.BuildReport(MyDir + "ReportingTemplateForeach.docx", ArtifactsDir + "ReportingForeachJsonDataSource.rtf", SaveFormat.Rtf, ds);
See Also
- enum SaveFormat
- class ReportBuilderOptions
- class ReportBuilder
- namespace Wordize.Reporting
- assembly Wordize
BuildReport(Stream, Stream, SaveFormat, object, ReportBuilderOptions)
Populates the specified template document with data from the specified source making it a ready report.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveFormat saveFormat,
object data, ReportBuilderOptions reportBuilderOptions = null)
Parameter | Type | Description |
---|---|---|
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. |
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.
Examples
Shows how to fill a template from a XML file using LINQ Reporting Engine and save the result to stream.
XmlDataLoadOptions xmlLoadOptions = new XmlDataLoadOptions();
xmlLoadOptions.AlwaysGenerateRootObject = true;
XmlDataSource ds = new XmlDataSource(MyDir + "ReportingData.xml", xmlLoadOptions);
using (Stream input = File.OpenRead(MyDir + "ReportingTemplateForeach.docx"))
using (Stream output = File.Create(ArtifactsDir + "ReportingForeachXmlDataSource.pdf"))
{
ReportBuilder.BuildReport(input, output, SaveFormat.Pdf, ds);
}
See Also
- enum SaveFormat
- class ReportBuilderOptions
- class ReportBuilder
- namespace Wordize.Reporting
- assembly Wordize
BuildReport(string, string, object, string, ReportBuilderOptions)
Populates the specified template document with data from the specified source making it a ready report.
public static void BuildReport(string inputFileName, string outputFileName, object data,
string dataSourceName, ReportBuilderOptions reportBuilderOptions = null)
Parameter | Type | Description |
---|---|---|
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. |
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 fill template with data from CSV data source loaded from stream using LINQ Reporting engine.
string csvString = "Name,Position\r\nJames Bond,Spy";
CsvDataLoadOptions csvLoadOptions = new CsvDataLoadOptions() { HasHeaders = true };
CsvDataSource ds = new CsvDataSource(new MemoryStream(Encoding.UTF8.GetBytes(csvString)), csvLoadOptions);
ReportBuilder.BuildReport(MyDir + "ReportingTemplateForeach.docx", ArtifactsDir + "ReportingForeachCsvDataSource.docx", ds, "data");
See Also
- class ReportBuilderOptions
- class ReportBuilder
- namespace Wordize.Reporting
- assembly Wordize
BuildReport(string, string, SaveFormat, object, string, ReportBuilderOptions)
Populates the specified template document with data from the specified source making it a ready report.
public static void BuildReport(string inputFileName, string outputFileName, SaveFormat saveFormat,
object data, string dataSourceName, ReportBuilderOptions reportBuilderOptions = null)
Parameter | Type | Description |
---|---|---|
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. |
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
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 with a specified format.
List<DummyData> data = new List<DummyData>();
data.Add(new DummyData() { Name = "James Bond", Position = "Spy" });
data.Add(new DummyData() { Name = "John Doe", Position = "Unknown" });
ReportBuilder.BuildReport(MyDir + "ReportingTemplateForeach.docx", ArtifactsDir + "ReportingForeachObjectDataSource.xps", SaveFormat.Xps, data, "data");
See Also
- enum SaveFormat
- class ReportBuilderOptions
- class ReportBuilder
- namespace Wordize.Reporting
- assembly Wordize
BuildReport(Stream, Stream, SaveFormat, object, string, ReportBuilderOptions)
Populates the specified template document with data from the specified source making it a ready report.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveFormat saveFormat,
object data, string dataSourceName, ReportBuilderOptions reportBuilderOptions = null)
Parameter | Type | Description |
---|---|---|
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. |
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.
Examples
Shows how to fill template with data from CSV data source loaded from file using LINQ Reporting engine.
CsvDataLoadOptions csvLoadOptions = new CsvDataLoadOptions();
csvLoadOptions.QuoteChar = '\'';
csvLoadOptions.CommentChar = '|';
csvLoadOptions.Delimiter = ',';
csvLoadOptions.HasHeaders = true;
CsvDataSource ds = new CsvDataSource(MyDir + "ReportingData.csv", csvLoadOptions);
ReportBuilderOptions reportBuilderOptions = new ReportBuilderOptions();
reportBuilderOptions.AllowMissingMembers = true;
using (Stream input = File.OpenRead(MyDir + "ReportingTemplateForeach.docx"))
using (Stream output = File.Create(ArtifactsDir + "ReportingForeachCsvDataSource.pdf"))
{
ReportBuilder.BuildReport(input, output, SaveFormat.Pdf, ds, "data", reportBuilderOptions);
}
See Also
- enum SaveFormat
- class ReportBuilderOptions
- class ReportBuilder
- namespace Wordize.Reporting
- assembly Wordize
BuildReport(string, string, object[], string[], ReportBuilderOptions)
Populates the specified template document with data from the specified sources making it a ready report.
public static void BuildReport(string inputFileName, string outputFileName, object[] data,
string[] dataSourceNames, ReportBuilderOptions reportBuilderOptions = null)
Parameter | Type | Description |
---|---|---|
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. |
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 fill template with data using LINQ Reporting engine.
CsvDataLoadOptions csvLoadOptions = new CsvDataLoadOptions() { HasHeaders = true, QuoteChar = '\'' };
CsvDataSource ds = new CsvDataSource(MyDir + "ReportingData.csv", csvLoadOptions);
ReportBuilder.BuildReport(MyDir + "ReportingTemplateForeach.docx",
ArtifactsDir + "ReportingForeachCsvDataSource.rtf",
new object[] { ds },
new string[] { "data" });
See Also
- class ReportBuilderOptions
- class ReportBuilder
- namespace Wordize.Reporting
- assembly Wordize
BuildReport(string, string, SaveFormat, object[], string[], ReportBuilderOptions)
Populates the specified template document with data from the specified sources making it a ready report.
public static void BuildReport(string inputFileName, string outputFileName, SaveFormat saveFormat,
object[] data, string[] dataSourceNames, ReportBuilderOptions reportBuilderOptions = null)
Parameter | Type | Description |
---|---|---|
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. |
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 fill a template with data using the LINQ Reporting Engine and save the result in a specified format.
JsonDataSource ds = new JsonDataSource(MyDir + "ReportingData.json");
ReportBuilder.BuildReport(MyDir + "ReportingTemplateForeach.docx",
ArtifactsDir + "ReportingForeachJsonDataSource.html",
SaveFormat.Html,
new object[] { ds },
new string[] { "data" });
See Also
- enum SaveFormat
- class ReportBuilderOptions
- class ReportBuilder
- namespace Wordize.Reporting
- assembly Wordize
BuildReport(Stream, Stream, SaveFormat, object[], string[], ReportBuilderOptions)
Populates the specified template document with data from the specified sources making it a ready report.
public static void BuildReport(Stream inputStream, Stream outputStream, SaveFormat saveFormat,
object[] data, string[] dataSourceNames, ReportBuilderOptions reportBuilderOptions = null)
Parameter | Type | Description |
---|---|---|
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. |
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.
Examples
Shows how to fill a template with data using the LINQ Reporting Engine and save the result to stream in a specified format.
JsonDataSource ds = new JsonDataSource(MyDir + "ReportingData.json");
using (Stream input = File.OpenRead(MyDir + "ReportingTemplateForeach.docx"))
using (Stream output = File.Create(ArtifactsDir + "ReportingForeachJsonDataSource.svg"))
{
ReportBuilder.BuildReport(input, output, SaveFormat.Svg, new object[] { ds }, new string[] { "data" });
}
See Also
- enum SaveFormat
- class ReportBuilderOptions
- class ReportBuilder
- namespace Wordize.Reporting
- assembly Wordize