User-1345489790 posted
Report RDLC problem with the size of image
I'm developing a custom dynamic report using rdlc, based on the code of this site : "http://www.gotreportviewer.com/"
The code i'm using to create the image is below ...
when I run the report the image is showing up but with width=1 and height=5
can anyone help me to solve this issue ?
tanks!
the output generated for the image is below, note the [ width="1" height="5" ]
"
<td class="Ac02edaafe3cf462da64fde7ad21cbc0c25c"><div class="Pb2192df04c1b431c81a2218a01b9f6f1_1_r2" style="min-height: 30.34mm; min-width: 24.4mm;"><img width="1" height="5" title="testing" onload="this.fitproportional=true;this.pv=0;this.ph=0;"
alt="testing" src="/Reserved.ReportViewerWebControl.axd?Culture=2070&CultureOverrides=True&UICulture=2070&UICultureOverrides=True&ReportStack=1&ControlID=b2192df04c1b431c81a2218a01b9f6f1&Mode=true&OpType=ReportImage&IterationId=78fc82afa58b4e05b2ab327b2fa7ae31&StreamID=a25a98a9eee44b8bad464cd6ae9a390f"></div></td>
"
private Rdl.ReportItemsType CreateTableCellReportItems(string fieldName)
{
string aa = m_fields.Find(x => x == fieldName);
int i = m_fields.FindIndex(x => x == fieldName);
bool isImage = false;
if (config.ArrayOfIsImage!= null && i < config.ArrayOfIsImage.Length)
{
isImage = config.ArrayOfIsImage[i];
}
Rdl.ReportItemsType reportItems = new Rdl.ReportItemsType();
if (isImage)
{
reportItems.Items = new object[] { CreateTableCellImage(fieldName) };
}
else
{
reportItems.Items = new object[] { CreateTableCellTextbox(fieldName) };
}
return reportItems;
}
+++++++++++++++++++++++++++++
private Rdl.ImageType CreateTableCellImage(string fieldName)
{
Rdl.ImageType image = new Rdl.ImageType();
image.Name = fieldName;
image.Items = new object[]
{
//Rdl.ImageTypeSizing.FitProportional,
Rdl.ImageTypeSizing.FitProportional,
/* "image/png", */
Rdl.ImageTypeSource.External,
"3cm",
"5cm",
"=Fields!" + fieldName + ".Value",
CreateTableCellImageStyle(),
/* CreateCustomPropertiesImage(), trying to fix: bug with <img=... width="1" ...> */
"testing",
};
image.ItemsElementName = new Rdl.ItemsChoiceType15[]
{
Rdl.ItemsChoiceType15.Sizing,
/* Rdl.ItemsChoiceType15.MIMEType, */
Rdl.ItemsChoiceType15.Source,
Rdl.ItemsChoiceType15.Width,
Rdl.ItemsChoiceType15.Height,
Rdl.ItemsChoiceType15.Value,
Rdl.ItemsChoiceType15.Style,
//Rdl.ItemsChoiceType15.CustomProperties,
Rdl.ItemsChoiceType15.ToolTip,
};
return image;
}
private Rdl.CustomPropertiesType CreateCustomPropertiesImage()
{
Rdl.CustomPropertyType customPropertyType = new Rdl.CustomPropertyType();
customPropertyType.Items = new object[]
{
"Width",
"123pt",
//"img",
};
customPropertyType.ItemsElementName = new Rdl.ItemsChoiceType10[]
{
Rdl.ItemsChoiceType10.Name,
Rdl.ItemsChoiceType10.Value,
//Rdl.ItemsChoiceType10.Item,
};
//XmlChoiceIdentifierAttribute
Rdl.CustomPropertiesType xxx = new Rdl.CustomPropertiesType();
xxx.CustomProperty = new Rdl.CustomPropertyType[]{ customPropertyType};
return xxx;
}