2016-01-19 17 views
0

我想在我的oracle表中添加背景圖像。這是我的代碼。發送電子郵件時,圖像不會顯示在表格的背景中。這存儲在一個過程中。如何在表上添加背景圖像oracle程序

<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>'; 
+0

我在你的html中看到一個arror:' td>' – Aleksej

+1

首先,檢查HTML錯誤的最終生成電子郵件源並更正它們。其次,請注意,許多電子郵件客戶端對背景圖像的處理不一致 - 特別是Outlook:http://blog.mailermailer.com/email-design/background-images-in-html-email-the-naked-truth –

+0

這是奇怪,因爲它在td中工作得很好,但是當我把它放在表中時,它不會 – Gee

回答

0

我知道有一些驗證問題,但我認爲問題是電子郵件客戶端不支持背景圖像。 http://www.campaignmoniter.com/css

現在,有一種方法可以讓大多數電子郵件客戶端都能接受,但它需要相當多的代碼,並且可能會變得複雜。

( 「背景=」)和CSS(背景圖像

背景必須在HTML屬性聲明:URL(HTP://)還需要在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> 

它看起來像問題是,你忘了關閉表標籤在你的腳本,並保存腳本div標籤。如果你結束這些,它應該工作,我相信。

+0

此網站幫助我解決我的問題[https://backgrounds.cm/]謝謝 – Gee