如何在 table oracle 过程中添加背景图像

How to add background image on a table oracle procedure

我正在尝试在我的 table in oracle 中添加背景图片。这是我的代码。发送电子邮件后,图像不会显示在 table 的背景中。这存储在一个过程中。

<table width="100%" style="background:url(http://linktomyimage.png);  background-repeat:no-repeat;">
   <tr>

for i in (select doc, source, title from table)
loop
    msg_html := msg_html ||'<td>'||'i.doc||'</td><td>'||'i.source||'</td><td>'||'i.title||'</td>
end loop;
    msg_html := msg_html ||'</tr></table>';

我知道存在一些验证问题,但我认为问题在于电子邮件客户端对背景图像的支持不一致。 http://www.campaignmoniter.com/css

现在,有一种方法可以获得它,因此大多数电子邮件客户端都会接受它,但它需要相当多的代码并且可能会变得复杂。

背景必须在HTML属性("background=")和CSS(background-image:url(htp://)中声明。对于 Outlook,也需要在 VBA 中完成。

开始这些的好地方是:https://backgrounds.cm/

他们为您完成大部分基本工作,包括设置背景图片和后备颜色等。

示例:

<td background="https://i.imgur.com/YJOX1PC.png" bgcolor="#7bceeb" width="120" height="92" valign="top" style="background-image: url(https://i.imgur.com/YJOX1PC.png); background-color:#7bceeb;" >
  <!--[if gte mso 9]>
  <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:120px;height:92px;">
    <v:fill type="tile" src="https://i.imgur.com/YJOX1PC.png" color="#7bceeb" />
    <v:textbox inset="0,0,0,0">
  <![endif]-->
  <div>
   INSERT CONTENT HERE
  </div>
  <!--[if gte mso 9]>
    </v:textbox>
  </v:rect>
  <![endif]-->
</td>

根据您提供的代码:

 <td background="https://i.imgur.com/YJOX1PC.png" bgcolor="#7bceeb" width="120" height="92" valign="top" style="background-image: url(https://i.imgur.com/YJOX1PC.png); background-color:#7bceeb;" >
  <!--[if gte mso 9]>
  <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:120px;height:92px;">
    <v:fill type="tile" src="https://i.imgur.com/YJOX1PC.png" color="#7bceeb" />
    <v:textbox inset="0,0,0,0">
  <![endif]-->
  <div>
        msg_html := msg_html || '<table width="100%">
                          <tr>
                            <td nowrap style="font-weight: bold;">Document</td>
                            <th nowrap style="font-weight: bold; text-align:left;">Collections</td>
                            <th nowrap style="font-weight: bold; text-align:left;">Title</td>
                          </tr>
                          <tr style="background-color: #ffffff;">';
for i in (select DOCNO, SOURCE, TITLE, GUIDE from tablename)
loop
        msg_html := msg_html || '<td nowrap class="leftAlignment"><a href="http://mywebsite.com?guideURL='''||i.guide||'''&docnum='''||i.docno||'''">DocNum</a></td>
        <td nowrap class="leftAlignment">'||i.source|| '</td>
        <td nowrap class="leftAlignment">'||i.title|| '</td>
        <td nowrap class="leftAlignment">'||i.source||'</td>
        <td class="leftAlignment"></td></tr><tr class="read">';
 end loop;

 msg_html :=msg_html ||'<td class="leftAlignment"></td></tr>

  <!--[if gte mso 9]>
    </v:textbox>
  </v:rect>
  <![endif]-->
   </div>
   </table>
</td>

看来问题是您忘记关闭脚本中的 table 标签和保存脚本的 div 标签。如果你关闭它们,我相信它应该可以工作。