I started by adding a table to the existing reports, as in above mentioned post, removed the unnecessary columns, then added an image to the left out cell in the rdlc design. In the image property set the source to "External"
Now open the rdlc in xml view, there find the dataset tag, add a new dataset for the new table with images
<DataSet Name="DataSet1">
<Fields>
<Field Name="filepath">
<DataField>track_file_id_pk</DataField>
<rd:TypeName>System.string</rd:TypeName>
</Field>
</Field>
</Fields>
<Query>
<DataSourceName>xxxt</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<rd:DataSetInfo>
<rd:DataSetName>xxx</rd:DataSetName>
...
</rd:DataSetInfo>
</DataSet>
Now adding the images list dataset to the new table as shown below
<Tablix Name="Tablix2">
....
</TablixRowHierarchy>
<DataSetName>ImgDataSet</DataSetName>
Go back to design view of rdlc, go to image properties, set the "use this image" field
In code behind create Datatable with one column "filepath", add rows with images filepath
then add datasource to report below the existing datasource.
DataTable dtable = new DataTable();
DataColumn dcol = new DataColumn("filepath");
dtable.Columns.Add(dcol);
DataRow drow = dtable.NewRow();
string pat = new Uri(Server.MapPath("~/Content/DSC_019.jpg")).AbsoluteUri;
drow["track_file_uuidName"] = pat;
dtable.Rows.Add(drow);
...
ReportViewer1.LocalReport.EnableExternalImages = true;
...
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("rptDataSet", objCommonreport.ReportTable));
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dtable));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…