I need your little help to get stock value(corresponding to stock name) from the HTTP Response I got. Received Response is in form of HTML, of which i put some part as code is too long. downwards I have mention the VBA Code i am using but it is showing error. Please anyone help me..!!
Note: Stock Name and Values are present in "Input type"(line 5 from down)
<!-- <table align="left">
<tr>
<td> -->
<div class="table-responsive" style="width: 110%;">
<table border="0" align="left" width="688" cellpadding="5" cellspacing="1" class="table_style table_111111" id="data_table">
<thead>
<tr class="table_header">
<td width="15" class="center_align"><strong></strong></td>
<td width="50" class="left_align"><strong>Security </strong></td>
<td width="20" class="center_align"><strong>ME</strong></td>
<td width="15" class="center_align"><strong>Exch Code</strong></td>
<td width="15" class="center_align"><strong>Tradesmart Trends</strong></td>
<td width="20" class="center_align"><strong>IT</strong></td>
<td width="50" class="center_align"><strong>Expiry Date</strong></td>
<td width="50" class="center_align"><strong>Strike Price</strong></td>
<td width="10" class="center_align"><strong>Opt Type</strong></td>
<td width="32" class="center_align"><strong>Open Price</strong></td>
<td width="40" class="center_align"><strong>Buy Price</strong></td>
<td width="32" class="center_align"><strong>Buy Vol</strong></td>
<td width="41" class="center_align"><strong>Sell Price</strong></td>
<td width="32" class="center_align"><strong>Sell Vol</strong></td>
<td width="41" class="center_align"><strong>Last Price</strong></td>
<td width="28" class="center_align"><strong>High Price</strong></td>
<td width="41" class="center_align"><strong>Low Price</strong></td>
<td width="25" class="center_align"><strong>O.I.</strong></td>
<td width="20" class="center_align"><strong>CAs</strong></td>
<td width="50" class="center_align"><strong> % Change</strong></td>
<td width="50" class="center_align"><strong>Net Change</strong></td>
</tr>
</thead>
<input type='hidden' id='first_watch' name='first_watch' value='current'/><tr class='tinside'><td class="left_align"><input type=checkbox name="stkcode" value="1157(NN)EQ" onClick="checkCheck(4);"></td><td class="left_align">APOLLOTYRE</td><td class="center_align">NSE</td><td class="center_align">163</td><td class="center_align"><A style='font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: #31B404; font-weight: bold;' HREF="/itrade/user/recognia.exe?action=access" >Bullish</A></td><td class="center_align">EQ</td><td class="center_align">-</td><td class="center_align">0.00</td><td class="center_align">- </td><td class="center_align">201.00</td><td class="center_align">0.00</td><td class="center_align"></td><td class="center_align">199.50</td><td class="center_align">1,990</td><td class="center_align">199.50</td><td class="center_align">203.85</td><td class="center_align">198.50</td><td class="center_align"> 0</td><td class="center_align">XD</td> <td class="center_align"> 0.00</td> <td class="center_align"> 0.00</td> </tr><tr class='tinside'><td class="left_align"><input type=checkbox name="stkcode" value="2441(NN)EQ" onClick="checkCheck(5);"></td><td class="left_align">SUNPHARMA</td><td class="center_align">NSE</td><td class="center_align">3351</td><td class="center_align"><A style='font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: #31B404; font-weight: bold;' HREF="/itrade/user/recognia.exe?action=access" >Bullish</A></td><td class="center_align">EQ</td><td class="center_align">-</td><td class="center_align">0.00</td><td class="center_align">- </td><td class="center_align">454.90</td><td class="center_align">0.00</td><td class="center_align"></td><td class="center_align">431.25</td><td class="center_align">66,412</td><td class="center_align">431.25</td><td class="center_align">455.00</td><td class="center_align">426.45</td><td class="center_align"> 0</td><td class="center_align">XD</td> <td class="center_align"> 0.00</td> <td class="center_align"> 0.00</td> </tr></table>
</div>
<!--</td>
</tr>
<tr>
Here is the VBA Code. what I am Using to send POST Req to get stock value in response.
Dim cook As String, bodyk As String, xmlhttp As Object, response As String
Dim getcookres As String, html As New HTMLDocument
Dim document As Object
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
cook = Worksheets("Action").Range("X2").Value
bodyk = Worksheets("Action").Range("X1").Value
URL = "https://www.xxxxxxxx.com/itrade/user/watch.exe?action=C"
xmlhttp.Open "POST", URL, False
xmlhttp.setRequestHeader "Host", "www.xxxxxxxx.com"
xmlhttp.setRequestHeader "Connection", "keep-alive"
xmlhttp.setRequestHeader "Content-Length", "700"
xmlhttp.setRequestHeader "Cache-Control", "max-age=0"
xmlhttp.setRequestHeader "Origin", "https://www.xxxxxxxx.com"
xmlhttp.setRequestHeader "Upgrade-Insecure-Requests", "1"
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
xmlhttp.setRequestHeader "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
xmlhttp.setRequestHeader "Referer", "https://www.xxxxxxxx.com/itrade/user/watch.exe?action=C"
xmlhttp.setRequestHeader "Accept-Encoding", "gzip, deflate, br"
xmlhttp.setRequestHeader "Accept-Language", "en-US,en;q=0.9"
xmlhttp.setRequestHeader "Cookie", cook
xmlhttp.send bodyk
html.body.innerHTML = xmlhttp.responseText
'Set document = html.getElementsByid("header").getElementsByid("container")(0).getElementsByClassName("table-responsive")(0).getElementsByid("first_watch")(1)
Set document = html.getElementsByClassName("tinside")
'Debug.Print html.body.innerHTML
Debug.Print document
Sheets(1).Cells(2, 1).Value = document.getElementsByTagName("td")(0).innerText
You can use css selectors to target the td elements
Dim nodeList As Object, i As Long
Set nodeList = html.querySelectorAll("#data_table tr.tinside td")
For i = 0 To nodeList.Length -1
Debug.Print nodeList.item(i).innerText
Next
The whole table you can use id selector
Dim ele As Object
Set ele = html.getElementById("data_table")
' then loop the tr tags and then the td tags
Related
I'm trying to send dynamic emails with Twilio SendGrid Rest API with Nodejs and handlebars. I have created my own custom template and placed the design in a file template.html. I'm successfully using this template using Nodemailer and SMTP-transport. But when trying to send it with SendGrid I get error :
ResponseError: Forbidden
at node_modules/#sendgrid/client/src/classes/client.js:146:29
at processTicksAndRejections (internal/process/task_queues.js:95:5) { code: 403, response: {
headers: {
server: 'nginx',
date: 'Wed, 07 Sep 2022 17:03:16 GMT',
'content-type': 'application/json',
'content-length': '281',
connection: 'close',
'access-control-allow-origin': 'https://sendgrid.api-docs.io',
'access-control-allow-methods': 'POST',
'access-control-allow-headers': 'Authorization, Content-Type, On-behalf-of, x-sg-elas-acl',
'access-control-max-age': '600',
'x-no-cors-reason': 'https://sendgrid.com/docs/Classroom/Basics/API/cors.html',
'strict-transport-security': 'max-age=600; includeSubDomains'
},
body: { errors: [Array] } } }
This is my nodejs
const handlebars = require('handlebars');
const path = require('path');
const fs = require('fs');
const sendgrid = require('#sendgrid/mail')
sendgrid.setApiKey(sendgrid_api_key);
//readhtmfile
var readHTMLFile = function (path, callback) {
fs.readFile(path, { encoding: 'utf-8' }, function (err, html) {
if (err) {
throw err;
callback(err);
}
else {
callback(null, html);
}
});
};
//dynamic variable received from client
var name = 'John Doe';
//email user
readHTMLFile(path.join(__dirname, '/', 'template.html'), function (err, html) {
var template = handlebars.compile(html);
var replacements = {
email_title: 'Welcome email',
email_body: 'Welcome to our website '+name
};
var htmlToSend = template(replacements);
var mailOptions = {
from: '"Company Website" <verified_sendgrid_email#company.com>', // sender address
to: email, // list of receivers
subject: "Welcome email ", // Subject line
html: htmlToSend, // html body
};
sendgrid.send(mailOptions, function (error, response) {
if (error) {
console.log(error);
} else {
console.log(response);
}
});
});
Upon printing the body errors, which I should have done, the detailed error was :
{
errors: [
{
message: 'The from address does not match a verified Sender Identity. Mail cannot be sent until this error is resolved. Visit https://sendgrid.com/docs/for-developers/sending-email/sender-identity/ to see the Sender Identity requirements',
field: 'from',
help: null
}
]
}
Unlike me, make sure you enter the Verified SendGrid mail. I had misspelled it.
Everything works like a charm now!
If you wonder what the template looks like and how to make it dynamic here it is :
template.html
<html>
<head>
<style>
#media only screen and (max-width: 600px) {
.main {
width: 320px !important;
}
.top-image {
width: 20px !important;
}
.inside-footer {
width: 320px !important;
}
table[class="contenttable"] {
width: 320px !important;
text-align: left !important;
}
td[class="force-col"] {
display: block !important;
}
td[class="rm-col"] {
display: none !important;
}
.mt {
margin-top: 15px !important;
}
*[class].width300 {width: 255px !important;}
*[class].block {display:block !important;}
*[class].blockcol {display:none !important;}
.emailButton{
width: 100% !important;
}
.emailButton a {
display:block !important;
font-size:18px !important;
}
}
.coupon {
border: 5px dotted #bbb;
width: 80%;
border-radius: 15px;
margin: 0 auto;
max-width: 600px;
}
.container {
padding: 2px 16px;
background-color: #f1f1f1;
}
.promo {
background: #ccc;
padding: 3px;
}
.expire {
color: red;
}
</style>
</head>
<body link="#00a5b5" vlink="#00a5b5" alink="#00a5b5">
<table class="main contenttable" align="center" style="font-weight: normal;border-collapse: collapse;border: 0;margin-left: auto;margin-right: auto;padding: 0;font-family: Arial, sans-serif;color: #555559;background-color: white;font-size: 16px;line-height: 26px;width: 600px;">
<tr>
<td class="border" style="border-collapse: collapse;border: 1px solid #eeeff0;margin: 0;padding: 0;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 26px;">
<table style="font-weight: normal;border-collapse: collapse;border: 0;margin: 0;padding: 0;font-family: Arial, sans-serif;">
<tr>
<td colspan="4" valign="top" class="image-section" style="border-collapse: collapse;border: 0;margin: 0;padding: 0;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 26px;background-color: #fff;border-bottom: none !important;">
<a href="https://mycompany.com">
<img class="top-image"
src="https://mycompany.com/images/webb_logo_.png"
style="line-height: 1;width: 100px;"
alt="My Company Logo">
</a>
</td>
</tr>
<tr>
<td valign="top" class="side title" style="border-collapse: collapse;border: 0;margin: 0;padding: 20px;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 26px;vertical-align: top;background-color: white;border-top: none;">
<table style="font-weight: normal;border-collapse: collapse;border: 0;margin: 0;padding: 0;font-family: Arial, sans-serif;">
<tr style="display: none !important;">
<td class="head-title" style="border-collapse: collapse;border: 0;margin: 0;padding: 0;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 28px;line-height: 34px;font-weight: bold; text-align: center;">
<div class="mktEditable" id="main_title">
{{{email_title}}}
</div>
</td>
</tr>
<tr style="display: none !important;">
<td class="sub-title" style="border-collapse: collapse;border: 0;margin: 0;padding: 0;padding-top:5px;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 18px;line-height: 29px;font-weight: bold;text-align: center;">
<div class="mktEditable" id="intro_title">
{{{email_subtitle}}}
</div></td>
</tr>
<tr>
<td class="top-padding" style="border-collapse: collapse;border: 0;margin: 0;padding: 5px;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 26px;"></td>
</tr>
<tr>
<td class="grey-block" style="border-collapse: collapse;border: 0;margin: 0;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 26px;background-color: #fff; text-align:center;">
<div class="mktEditable" id="cta">
<img class="top-image"
src="https://mycompany.com/images/learn.gif"
style="width:100% !important;" />
<br><br>
<a style="color:#000067;
background-color:#FCE8ED;
border: 10px solid #FCE8ED;
border-radius: 3px;
text-decoration:none;" href="https://mycompany.com/login.php">
Log In Your Account Now
</a>
</div>
</td>
</tr>
<tr>
<td class="top-padding" style="border-collapse: collapse;border: 0;margin: 0;padding: 15px 0;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 21px;">
<hr size="1" color="#eeeff0">
</td>
</tr>
<tr>
<td class="text" style="border-collapse: collapse;border: 0;margin: 0;padding: 0;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 26px;">
<div class="mktEditable" id="main_text">
{{{email_body}}}
<br><br>
<span style="font-style: italic;">
<small>
<strong>
“ Build powerful and beautiful websites in 5 mins or less without coding ”
</strong>
</small>
</span>
</div>
</td>
</tr>
<tr>
<td style="border-collapse: collapse;border: 0;margin: 0;padding: 0;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 24px;">
<br>
</td>
</tr>
<tr>
<td class="text" style="border-collapse: collapse;border: 0;margin: 0;padding: 0;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 24px;">
<div class="mktEditable" id="download_button" style="text-align: center;">
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="border-collapse: collapse;border: 0;margin: 0;padding: 0;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 24px; padding: 20px;">
<div class="mktEditable" id="cta_try">
<table border="0" cellpadding="0" cellspacing="0" class="mobile" style="font-weight: normal;border-collapse: collapse;border: 0;margin: 0;padding: 0;font-family: Arial, sans-serif;">
<tr>
<td class="rm-col" style="border-collapse: collapse;border: 0;margin: 0;padding: 0;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 24px;padding-right: 15px;"></td>
<td class="force-col" valign="top" style="border-collapse: collapse;border: 0;margin: 0;padding: 0;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 24px;">
<table class="mb mt" style="font-weight: normal;border-collapse: collapse;border: 0;margin: 0;padding: 0;font-family: Arial, sans-serif;margin-bottom: 15px;margin-top: 0;">
<tr>
<td class="grey-block" style="border-collapse: collapse;border: 0;margin: 0;padding: 18px;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 24px;background-color: #fff; border-top: 3px solid #00a5b5; border-left: 1px solid #E6E6E6; border-right: 1px solid #E6E6E6; border-bottom: 1px solid #E6E6E6; width: 250px; text-align: center;">
<span style="font-family: Arial, sans-serif;
font-size: 24px;
line-height: 39px;
border-collapse: collapse;
border: 0;
margin: 0;
padding: 0;
-webkit-text-size-adjust: none;
color: #555559;
text-align: center;
font-weight: bold;">
Need Help?
</span>
<br>
My Company team is here to support you.
Visit our Help Center.<br><br>
<a style="color:#ffffff;
background-color: #00a5b5;
border-top: 10px solid #00a5b5;
border-bottom: 10px solid #00a5b5;
border-left: 20px solid #00a5b5;
border-right: 20px solid #00a5b5;
border-radius: 3px;
text-decoration:none;"
href="http://mycompany.com/contact.php">
Contact Us
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr bgcolor="#fff" style="border-top: 4px solid #00a5b5;">
<td valign="top" class="footer" style="border-collapse: collapse;border: 0;margin: 0;padding: 0;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 16px;line-height: 26px;background: #fff;text-align: center;">
<table style="font-weight: normal;border-collapse: collapse;border: 0;margin: 0;padding: 0;font-family: Arial, sans-serif;">
<tr>
<td class="inside-footer" align="center" valign="middle" style="border-collapse: collapse;border: 0;margin: 0;padding: 20px;-webkit-text-size-adjust: none;color: #555559;font-family: Arial, sans-serif;font-size: 12px;line-height: 16px;vertical-align: middle;text-align: center;width: 580px;">
<div id="address" class="mktEditable">
<b>
My Company Inc
<br>
Tech Support : 24/7/365
</b><br>
<a style="color: #00a5b5;"
href="https://mycompany.com">
Visit our website
</a>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
I have a problem with TinyMCE editor which I cannot resolve.
If I copy a table from Excel and paste it into the editor it loses the formatting. I have set up extended_valid_elements as follows...
extended_valid_elements:"a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],table[style|class|border=2|width|cellspacing|cellpadding|bgcolor],colgroup,col[style|width],tbody,tr[style|class],td[style|class|colspan|rowspan|width|height|background|span|padding],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style|font-family|color]"
The HTML that is saved into the MySQL field is as follows
From Excel ...
<table style="border-collapse: collapse; width: 242pt;" border="2" width="322">
<tbody>
<tr style="height: 14.25pt;">
<td style="height: 14.25pt; width: 105pt;" width="140">Test</td>
<td style="width: 104pt;" width="138"></td>
<td style="width: 33pt;" width="44"> </td>
</tr>
</tbody>
</table>
From Word ...
<table style="width: 242.0pt; border-collapse: collapse;" border="2" width="0">
<tbody>
<tr style="height: 14.25pt;">
<td style="width: 105.0pt; padding: 0cm 5.4pt 0cm 5.4pt; height: 14.25pt;" width="140">
<p style="margin-bottom: .0001pt; line-height: normal;"><span style="font-size: 10.0pt; font-family: 'Arial',sans-serif; color: black;">Test</span></p>
</td>
<td style="width: 104.0pt; padding: 0cm 5.4pt 0cm 5.4pt; height: 14.25pt;" width="139"></td>
<td style="width: 33.0pt; background: #92D050; padding: 0cm 5.4pt 0cm 5.4pt; height: 14.25pt;" width="44">
<p style="margin-bottom: .0001pt; line-height: normal;"><span style="font-size: 10.0pt; font-family: 'Arial',sans-serif; color: black;"> </span></p>
</td>
</tr>
</tbody>
</table>
How can I make this work from excel without having to go through word first?
It would appear I have to use power paste which is a paid-for option ... I have a call setup with their sales team to see how much it will cost! Fingers crossed.
I'm building a printable Report based off a saved search to group and subtotal multiple Lots and inventory Detail listing it under each item and displaying the subtotal below each group of items.
I can format the code properly to display 1 item at a time using this
<#if results?has_content>
<table class="itemtable" dir="ltr" style="width:100%;"><!-- start items --><#list results as result><tr>
<td style="width: 43px;"><span style="font-size:10px;">**</span></td>
<td colspan="2" rowspan="1" style="width: 70px;"><span style="font-size:10px;">${result.itemid}</span></td>
<td colspan="2" rowspan="1" style="width: 94px; white-space: nowrap;"><span style="font-size:10px;">${result.displayname}</span></td>
<td style="width: 133px;"> </td>
<td style="width: 72px;"> </td>
<td style="width: 47px;"> </td>
<td style="width: 120px;"> </td>
<td style="width: 79px;"> </td>
<td style="width: 68px;"> </td>
</tr>
<tr>
<td style="width: 43px;"><span style="font-size:10px;">${result.custitempacksize}</span></td>
<td style="width: 70px;"><span style="font-size:10px;">${result.custcol_lottextitemlinelevel}</span></td>
<td style="width: 48px;"><span style="font-size:10px;">${result.custitem_brand}</span></td>
<td style="width: 94px;">${result.expirationdate}</td>
<td style="width: 97px;"><span style="font-size:10px;">${result.serialnumbers}</span></td>
<td style="width: 133px;"><span style="font-size:10px;">${result.location}</span></td>
<td style="width: 72px;"><span style="font-size:10px;">${result.custbodyestimatedarrivaldate}</span></td>
<td style="width: 47px;"><span style="font-size:10px;">${result.rate}</span></td>
<td style="width: 120px;"><span style="font-size:10px;">${result.formulacurrency}</span></td>
<td style="width: 79px;"><span style="font-size:10px;">${result.quantityavailable}</span></td>
<td style="width: 68px;"><span style="font-size:10px;">${result.formulanumeric}</span></td>
</tr>
<tr>
<td style="width: 43px;">**</td>
<td colspan="3" rowspan="1" style="width: 70px;">Subtotal for : ${result.itemid}</td>
<td style="width: 97px;"> </td>
<td style="width: 133px;"> </td>
<td style="width: 72px;"> </td>
<td style="width: 47px;"> </td>
<td style="width: 120px;">
<hr />{subtotalEC}</td>
<td style="width: 79px;">
<hr />{subtotalLB}</td>
<td style="width: 68px;">
<hr />{subtotalCS}</td>
</tr>
</#list><!-- end items --></table>
</#if>
</body>
</pdf>
I'm on the right track to getting the results I want in the PDF but when I Attempt to add <#if> and <#else> tags to group the items It will save but then generate an Unexpected Error when I attempt to print it.
<pdf>
<head>
<link name="NotoSans" type="font" subtype="truetype" src="${nsfont.NotoSans_Regular}" src-bold="${nsfont.NotoSans_Bold}" src-italic="${nsfont.NotoSans_Italic}" src-bolditalic="${nsfont.NotoSans_BoldItalic}" bytes="2" />
<#if .locale == "zh_CN">
<link name="NotoSansCJKsc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKsc_Regular}" src-bold="${nsfont.NotoSansCJKsc_Bold}" bytes="2" />
<#elseif .locale == "zh_TW">
<link name="NotoSansCJKtc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKtc_Regular}" src-bold="${nsfont.NotoSansCJKtc_Bold}" bytes="2" />
<#elseif .locale == "ja_JP">
<link name="NotoSansCJKjp" type="font" subtype="opentype" src="${nsfont.NotoSansCJKjp_Regular}" src-bold="${nsfont.NotoSansCJKjp_Bold}" bytes="2" />
<#elseif .locale == "ko_KR">
<link name="NotoSansCJKkr" type="font" subtype="opentype" src="${nsfont.NotoSansCJKkr_Regular}" src-bold="${nsfont.NotoSansCJKkr_Bold}" bytes="2" />
<#elseif .locale == "th_TH">
<link name="NotoSansThai" type="font" subtype="opentype" src="${nsfont.NotoSansThai_Regular}" src-bold="${nsfont.NotoSansThai_Bold}" bytes="2" />
</#if>
<macrolist>
<macro id="nlheader">
${preferences.formlandscape}
<table class="header" style="width:100%;"><tr>
<td colspan="3" style="text-align: left; vertical-align: top; white-space: nowrap; height: 40px; width: 178px;"><span style="font-size:12px;"><strong>Date:</strong></span></td>
<td colspan="5" style="text-align: center; vertical-align: middle; white-space: nowrap; height: 40px; width: 400px;"><span style="font-size:12px;"><strong>Hofseth North America<br />In Stock Inventory Report sorted by Item<br />For All Items Available All Locations</strong></span></td>
<td colspan="3" style="text-align: right; vertical-align: top; white-space: nowrap; height: 40px;"><span style="font-size:12px;"><strong>Page:<pagenumber/> of <totalpages/></strong></span></td>
</tr></table>
<table boarder="1" class="header" style="width:100%;">
<thead>
<tr>
<th style="width: 40px;"><span style="font-size:12px;">Pack Size</span></th>
<th style="width: 55px;"><span style="font-size:12px;">Load #</span></th>
<th style="width: 75px;"><span style="font-size:12px;">Brand</span></th>
<th style="width: 50px;"><span style="font-size:12px;">Exp. Date</span></th>
<th style="width: 90px;"><span style="font-size:12px;">Lot #</span></th>
<th style="width: 100px;"><span style="font-size:12px;">Location</span></th>
<th style="width: 65px;"><span style="font-size:12px;">Arrival<br />Date</span></th>
<th style="width: 69px;"><span style="font-size:12px;">Unit<br />Cost</span></th>
<th style="width: 110px;"><span style="font-size:12px;">Extended<br />Cost</span></th>
<th style="width: 70px;"><span style="font-size:12px;">Qty<br />Available</span></th>
<th style="width: 64px;"><span style="font-size:12px;">Units<br />Available</span></th>
</tr>
</thead>
</table>
</macro>
</macrolist>
<style type="text/css">* {
<#if .locale == "zh_CN">
font-family: NotoSans, NotoSansCJKsc, sans-serif;
<#elseif .locale == "zh_TW">
font-family: NotoSans, NotoSansCJKtc, sans-serif;
<#elseif .locale == "ja_JP">
font-family: NotoSans, NotoSansCJKjp, sans-serif;
<#elseif .locale == "ko_KR">
font-family: NotoSans, NotoSansCJKkr, sans-serif;
<#elseif .locale == "th_TH">
font-family: NotoSans, NotoSansThai, sans-serif;
<#else>
font-family: NotoSans, sans-serif;
</#if>
}
table {
font-size: 9pt;
}
th {
font-weight: bold;
font-size: 8pt;
vertical-align: middle;
padding: 5px 6px 3px;
background-color: #e3e3e3;
color: #333333;
}
td {
padding: 4px 6px;
}
td p { align:left }
</style>
</head>
<body header="nlheader" header-height="15%" padding="0.2in 0.2in 0.2in 0.2in" size="Letter-LANDSCAPE">
<#if results?has_content><#assign subtotalEC = 0 subtotalLB = 0 subtotalCS = 0>
<table class="itemtable" style="width:100%;"><!-- start items --><#list results as result><#list result.itemid as items>
<tr>
<td style="width: 43px;"><span style="font-size:10px;">**</span></td>
<td colspan="2" rowspan="1" style="width: 70px;"><span style="font-size:10px;">${result.itemid}</span></td>
<td colspan="2" rowspan="1" style="width: 94px; white-space: nowrap;"><span style="font-size:10px;">${result.displayname}</span></td>
<td style="width: 133px;"> </td>
<td style="width: 72px;"> </td>
<td style="width: 47px;"> </td>
<td style="width: 120px;"> </td>
<td style="width: 79px;"> </td>
<td style="width: 68px;"> </td>
</tr>
<#elseif><tr>
<td style="width: 43px;"><span style="font-size:10px;">${result.custitempacksize}</span></td>
<td style="width: 70px;"><span style="font-size:10px;">${result.custcol_lottextitemlinelevel}</span></td>
<td style="width: 48px;"><span style="font-size:10px;">${result.custitem_brand}</span></td>
<td style="width: 94px;">${result.expirationdate}</td>
<td style="width: 97px;"><span style="font-size:10px;">${result.serialnumbers}</span></td>
<td style="width: 133px;"><span style="font-size:10px;">${result.location}</span></td>
<td style="width: 72px;"><span style="font-size:10px;">${result.custbodyestimatedarrivaldate}</span></td>
<td style="width: 47px;"><span style="font-size:10px;">${result.rate}</span></td>
<td style="width: 120px;"><span style="font-size:10px;">${result.formulacurrency}</span></td>
<td style="width: 79px;"><span style="font-size:10px;">${result.quantityavailable}</span></td>
<td style="width: 68px;"><span style="font-size:10px;">${result.formulanumeric}</span></td>
</tr>
</#elseif></#list>
<#else><tr>
<td style="width: 43px;">**</td>
<td colspan="3" rowspan="1" style="width: 70px;">Subtotal for : ${result.itemid}</td>
<td style="width: 97px;"> </td>
<td style="width: 133px;"> </td>
<td style="width: 72px;"> </td>
<td style="width: 47px;"> </td>
<td style="width: 120px;">
<hr />{subtotalEC}</td>
<td style="width: 79px;">
<hr />{subtotalLB}</td>
<td style="width: 68px;">
<hr />{subtotalCS}</td>
</tr>
</#else></#list><!-- end items --></table>
</#if>
</body>
</pdf>
I cannot get it to create the list I want using freemarker tags.
The code I've supplied saves with no errors
but then generates an unknown error when trying to print
or display it as PDF from the UI.
I would like the following to happen.
Have the report Group and list all items.
Under each Item List the Line level detailed information contained in the search from that item.
Subtotal 3 fields from the Grouped Info under each item and display it under the last Line of Grouped Information.
Then repeat for all items contained in the search
It might be finicky about your if-else structure.
You are closing the tags for the else-ifs and else's, where it might not like that.
Here's an example from the freemarker website:
<#if x == 1>
x is 1
<#elseif x == 2>
x is 2
<#elseif x == 3>
x is 3
<#elseif x == 4>
x is 4
<#else>
x is not 1 nor 2 nor 3 nor 4
< /#if>
Worth a try!
I have a string like below
String str ='<table height="400" width="600" cellpadding="5" border="0" cellspacing="5" > <tr height="50" valign="top" > <td style=" color:#000000; font-size:12pt; background-color:#FFFFFF; font-family:arial; bLabel:main; bEditID:r3st1;" tEditID="c1r1" locked="0" aEditID="c1r1" > <![CDATA[<div><br></div><div>hi Rajib1 maity1,</div>this is your header<div><br></div>]]></td> </tr> <tr height="300" valign="top" > <td style=" color:#000000; font-size:12pt; background-color:#FFFFFF; font-family:arial; bLabel:main; bEditID:r3st1;" tEditID="c1r2" locked="0" aEditID="c1r2" > <![CDATA[ <div><div>hi Rajib1 maity1,</div>this is your body</div>]]></td> </tr> <tr height="50" valign="top" > <td style=" color:#000000; font-size:12pt; background-color:#FFFFFF; font-family:arial; bLabel:main; bEditID:r3st1;" tEditID="c1r3" locked="0" aEditID="c1r3" > <![CDATA[<div><br></div><div><div>hi Rajib1 maity1,</div>this is your footer</div>]]></td> </tr> </table>';
I want to remove "<![CDATA[" and "]]" from the string using apex.
I tried the following,
str = str.replaceAll('<![CDATA[','');
str = str.replaceAll('<]]','');
It did not work. Then I tried
str = str.replaceAll('\\<![CDATA[','');
str = str.replaceAll('\\<]]','');
This also not working.
Can anybody help me out?
Thanks.
The following works,
str = str.replaceAll('<!\\[CDATA\\[', ''); // replace '<![CDATA['
str= str.replaceAll('\\]\\]>', ''); // replace ']]'
My code :
<tr>
<td align="center" style="font-size:9pt; font-weight : bold;font-family:Arial; color:black;">
SELLE ZETA CONFORT GEL
</td>
</tr>
When i try on different mail client, the text is black, but on gmail (explorer,chrome and firefox) this text is blue.
How can i fix this?
If you want to look an exemple:
http://issl.fr/test/test_validator.html
Take all the code html and copy it there :
https://litmus.com/email-testing
You will be able to have a preview on every client. Look the gmail one.
Because your text is sitting in an <a> tag (your <a> is wrapping the table with your text in it). That's why your text is turning to blue. Apply a color to your <a> and that should solve it... John is right to use a proper hex code for the color.
As well, Gmail likes to change color:#000000 on links to default blue even if you state that it should be color:#000000. Use color:#000001. That will solve it.
With gmail you need to be redundant on your colors.
Not only would you have to declare a color with in the but you should also wrap it in a span with the color as well.
This is one of your items below with the correct code:
<Track Link>
<a style="text-decoration : none; color:#000000;" href="http://www.decathlon.be/selle-zeta-confort-gel-id_8052361.html">
<table height="100%" width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody>
<tr><td>
<table height="100%" width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody>
<tr height="3"></tr><tr style="height : 32px !important; min-height : 32px !important; max-height : 32px !important; ">
<td width="6"></td>
<td align="left">
<div style="height :32px !important; min-height : 32px !important; max-height : 32px !important; "></div>
</td>
<td width="58"></td>
<td align="right">
<div style="height :32px !important; min-height : 32px !important; max-height : 32px !important; "><img border="0" style="display:block;" width="64" height="32" alt=" " src="http://decathlonbe.net/images/Marques/geonaute.png"></div>
</td>
<td width="6"></td>
</tr><tr height="1"></tr>
</tbody></table>
</td></tr>
<tr><td>
<table height="100%" width="100%" cellspacing="0" cellpadding="0" border="0"><tbody>
<tr>
<td align="center">
<table height="100%" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="5"></td>
<td><img width="188" border="0" alt="" src="http://www.decathlon.be/media/805/8052361/classic_400PX_asset_71685950.jpg" style="display : block;"></td>
<td width="5"></td>
</table>
</td>
</tr>
<tr>
<td align="center" style="font-size:9pt; font-weight : bold;font-family:Arial; color:black;"><span style="color:#000000;">SELLE ZETA CONFORT GEL</span></td>
</tr>
<tr>
<td align="center" style="font-size:9pt; font-family:Arial; color:#6f6f6f;"></td>
</tr>
</tbody></table>
</td></tr><tr><td>
<div class="price" style="font-family : Arial; font-size : 22pt; color : black; text-align : center;"><div class="nopromo" style="font-weight:bold;font-family : Arial; font-size : 19pt; color : black; text-align : center;">29<sup style="font-size:12pt;">95</sup></div></div>
</td></tr><tr><td>
<table height="100%" width="100%" cellspacing="0" cellpadding="0" border="0"><tbody>
<tr>
<td width="15"></td>
<td valign="middle" align="center">
<Track Link><a style="text-decoration : none; font-family : Arial; font-weight : bold; font-size : 11pt; color : white;" href="http://www.decathlon.be/selle-zeta-confort-gel-id_8052361.html"><table align="center" cellspacing="0" cellpadding="0" border="0" style="background : #efefef;" >
<tr height="32" style="background-color : #FF7100;">
<td width="5" ><span style="color: #FF7100;">i<span></td>
<td style = "max-width: 144px;"> <div style="color : white;text-align:center; font-size : 10pt;font-family:Arial;font-weight: bold; ">sefsefse </div></td>
<td style="padding-left : 5px;">
<span style="color : white; font-weight : bold; font-size : 12pt;"> > </span>
</td>
<td width="5"><span style="color: #FF7100;">i</span></td>
</tr>
</table>
</a></Track Link>
</td>
<td width="15"></td>
</tr>
<tr height="8"></tr>
</tbody></table>
</td></tr>
</tbody></table>
</a>
In email you must use the 6-digit hex codes for maximum compatibility across email clients. Use CSS for text ie: color:#000000;, and html's bgcolor="#FFFFFF" for backgrounds
Darryl Vos's Answer is correct.
I style links with color:#00001 to achieve a black link in emails all the time.
I work in an agency and no one has ever complained it does not look black.