Databases Reference
In-Depth Information
C#
private void btnRender_Click(object sender, System.EventArgs e)
{
//get the format and report item from the comboboxes
Format format = (Format)cboFormat.SelectedItem;
ReportItem reportItem = (ReportItem)cboReports.SelectedItem;
//set up variables needed to call render method
ParameterValue[] parameters = GetParameters();
string encoding;
string mimeType;
ParameterValue[] parametersUsed;
Warning[] warnings;
string[] streamIds;
//render the report
byte[] data;
data = _rs.Render(reportItem.Path, format.Name,
null, null, parameters, null, null, out encoding, out mimeType,
out parametersUsed, out warnings, out streamIds);
//create a file stream to write the output
string fileName = txtOutputLocation.Text + “\\” +
reportItem.Name + format.Extension;
System.IO.FileStream fs = new System.IO.FileStream(fileName, System.IO.FileMode
.OpenOrCreate);
System.IO.BinaryWriter writer = new System.IO.BinaryWriter(fs);
writer.Write(data, 0, data.Length);
writer.Close();
fs.Close();
MessageBox.Show(“File written to: “ + fileName);
}
VB
Private Sub btnRender_Click(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles btnRender.Click
'get the format and report item from the comboboxes
Dim format As Format = CType(cboFormat.SelectedItem, Format)
Dim reportItem As ReportItem = CType(cboReports.SelectedItem, ReportItem)
'set up variables needed to call render method
Dim parameters As ParameterValue() = GetParameters()
Dim encoding As String
Dim mimeType As String
Dim parametersUsed() As ParameterValue
Dim warnings() As Warning
Dim streamIds() As String
'render the report
Dim data() As Byte
data = _rs.Render(reportItem.Path, format.Name, Nothing, Nothing, _
Search WWH ::




Custom Search