handy_ou 发表于 2018-4-11 14:10:42

图片绑定问题

<?xml version="1.0" encoding="UTF-8"?>
<ActiveReportsLayout Version="3.1" PrintWidth="11906" DocumentName="ARNet Document" ScriptLang="C#" MasterReport="0">
    <Sections>
      <Section Type="ReportHeader" Name="ReportHeader1" Height="0" BackColor="16777215" />
      <Section Type="PageHeader" Name="PageHeader1" Height="469.7938" BackColor="16777215">
            <Control Type="AR.Line" Name="horizontalLine1" X1="14.8481" Y1="164.8294" X2="11863.5164" Y2="164.8294" />
            <Control Type="AR.Line" Name="horizontalLine2" X1="14.8481" Y1="479.7938" X2="11863.5164" Y2="479.7938" />
            <Control Type="AR.Line" Name="PageHeaderVerticalBar0" X1="14.8481" Y1="164.8294" X2="14.8481" Y2="509.7938" />
            <Control Type="AR.Line" Name="PageHeaderVerticalBar1" X1="3974.3530" Y1="164.8294" X2="3974.3530" Y2="509.7938" />
            <Control Type="AR.Line" Name="PageHeaderVerticalBar2" X1="7933.8578" Y1="164.8294" X2="7933.8578" Y2="509.7938" />
            <Control Type="AR.Line" Name="PageHeaderVerticalBar3" X1="11863.5164" Y1="164.8294" X2="11863.5164" Y2="509.7938" />
      </Section>
      <Section Type="Detail" Name="Detail1" Height="324.9606" BackColor="16777215">
            <Control Type="AR.Line" Name="horizontalLine3" X1="14.8481" Y1="319.9606" X2="11863.5164" Y2="319.9606" />
            <Control Type="AR.Line" Name="DetailVerticalBar0" X1="14.8481" Y1="0" X2="14.8481" Y2="314.9606" />
            <Control Type="AR.Line" Name="DetailVerticalBar1" X1="3974.3530" Y1="0" X2="3974.3530" Y2="314.9606" />
            <Control Type="AR.Line" Name="DetailVerticalBar2" X1="7933.8578" Y1="0" X2="7933.8578" Y2="314.9606" />
            <Control Type="AR.Line" Name="DetailVerticalBar3" X1="11863.5164" Y1="0" X2="11863.5164" Y2="304.9606" />
            <Control Type="AR.Image" Name="Picture40" DataField="MdPicUrl" Left="3989.3511" Top="94.9981" Width="3824.5217" Height="284.9644"/>
            <Control Type="AR.Field" Name="Textbox2" DataField="MdCode" Left="29.8463" Top="94.9981" Width="3824.5217" Height="284.9644" Text="商品编码" Style="font-family:宋体; font-size:10.5pt; vertical-align:top; text-align:left;vertical-align: middle; ddo-char-set: 0;" />
      </Section>
      <Section Type="PageFooter" Name="PageFooter1" Height="0" BackColor="16777215" />
      <Section Type="ReportFooter" Name="ReportFooter1" Height="885.0019" BackColor="16777215">
            <Control Type="AR.Line" Name="horizontalLine4" X1="14.8481" Y1="399.9587" X2="11863.5164" Y2="399.9587" />
            <Control Type="AR.Line" Name="PageFooterVerticalBar0" X1="14.8481" Y1="-40" X2="14.8481" Y2="404.9587" />
            <Control Type="AR.Line" Name="PageFooterVerticalBar1" X1="3974.3530" Y1="-40" X2="3974.3530" Y2="404.9587" />
            <Control Type="AR.Line" Name="PageFooterVerticalBar2" X1="7933.8578" Y1="-40" X2="7933.8578" Y2="404.9587" />
            <Control Type="AR.Line" Name="PageFooterVerticalBar3" X1="11863.5164" Y1="-40" X2="11863.5164" Y2="399.9587" />
      </Section>
    </Sections>
    <ReportComponentTray />
    <Script>
      <!.Controls;float y = 0;foreach(object obj in ctl){if (obj is Line){Line l = (Line)obj;if (l.Y1 == l.Y2)y = l.Y1;}}foreach(object obj in ctl){if(obj is Line){Line l = (Line)obj;if (l.X1 == l.X2)l.Y2 = y;}}}]]>
    </Script>
    <PageSettings LeftMargin="567" RightMargin="567" TopMargin="567" BottomMargin="567" PaperWidth="13040" PaperHeight="11169" PaperSize="0" PaperName="Custom paper" />
    <Parameters />
</ActiveReportsLayout>



数据源绑定:

foreach (DataRow row in table.Rows)
                {
                  //var buff = Convert.FromBase64String(row["Img"].ToString());
                  row["MdPicUrl"] = "http://img10.360buyimg.com/n0/jfs/t19669/78/1470434306/357290/f5ff6839/5acc84faN1c77a4a5.jpg";
                }
                //dv = table.DefaultView;

                report.DataSource = dv;
                report.Document.Printer.PrinterName = "";
                report.Run(true);


这样图片无法显示

KearneyKang 发表于 2018-4-11 17:58:46

您好!
您先确定您的图像路径是正确的,比如先放一个本地路径的图片,看是否可以正常显示。

handy_ou 发表于 2018-4-11 18:01:25

KearneyKang 发表于 2018-4-11 17:58
您好!
您先确定您的图像路径是正确的,比如先放一个本地路径的图片,看是否可以正常显示。

http://img10.360buyimg.com/n0/jfs/t19669/78/1470434306/357290/f5ff6839/5acc84faN1c77a4a5.jpg 这个路径是可以正常访问的

KearneyKang 发表于 2018-4-12 09:43:29

您好!
你用的是区域报表,然后图片是绑定的一个数据源里的地址,还是直接绑定的一个链接地址。

要不您把报表模板发过来看看,因为报表图片绑定路径就两种
页: [1]
查看完整版本: 图片绑定问题