Rendering simple html code in Powerpoint text box - html

I have this string of html code and I want to display it in a Powerpoint Text box properly formatted as per the HTML code using VBA.
Any suggestion on how I do that?
I inserted some spaces in the code below to make it visible
Code:
< div> < font face=Arial color=black> </font><font face=Arial size=2 color=black><strong>Heading < /strong>< /font>< /div>
< div> & nbsp;< /div>
< div>< font face=Arial size=2 color=black>Text Sample< /font>< /div>

Related

How can I implement display inline (html/css) in VBA?

I am using VBA to generate an Outlook email. I want to put the email address with a gray background color and I want it to be in front of "Resource (s):".
This is my VBA code:
bodyHTML = bodyHTML + "<p style=""display: inline"">Resource(s): #" & "<p style=""display: inline; background-color: #EDEDE7; font-size: 15px; font-weight: normal"">" & aloc.resourceEmail & "</p></p>"
This is the result. Over the dotted line: the way it is. Below the dotted: The way it should be
<p> is a paragraph, it adds a newline.
Replace <p> with <span> which does not add a newline (and consequently replace </p> with </span>

copy html as string to visual studio 2017

i'm writing html in visual code.
example:
<header>
<h1 style="text-align: center">Customer Name: 0</h1>
<h2 style="text-align: center">Year: 2001 ,month: 12</h2>
<h3 style="text-align: center">Total price: 100</h3>
</header>
and I want to copy paste the code to visual studio 2017
but in visual studio is look like:
"<header>
< h1 style = "text-align: center" > Customer Name: 0 </ h1 >
< h2 style = "text-align: center" > Year: 2001 ,month: 12 </ h2 >
< h3 style = "text-align: center" > Total price: 100 </ h3 >
</ header > "
how can I paste it like this?
"<!DOCTYPE html><html><head><title></title></head><body><header>
First you need to format your Html online and convert it into single line format
Use
Www.textfilter.com
And also convert double inverted commas to single inverted commas
Secondly when u use it in visual studio , if putting it in string variable u need to add # behind your string
string myhtmlstring = #"myanyhtmtags";
This will prevent escaping and will work

How to extract something between <!-- --> using VBA?

I'm trying to scrape a page using VBA. I know how to get elements by id class and tag names. But now I have come across this Tag
<!-- <b>IE CODE : 3407004044</b> -->
Now after searching on the internet I know that this is a comment in the HTML, but what I'm unable to find is what is the tag name of this element ,if it qualifies as a tag at all. Should I use
documnet.getelementsbytagname("!") ?
If not, how else can I extract these comments ?
EDIT:
I have a bunch of these td elements within tr elements and I want to extract IE Code : 3407004044
Below is a larger set of HTML code:
<tr align="left">
<td width="50%" class="subhead1">
' this is the part that I want to extract
<!-- <b>IE CODE : 3108011111</b> -->
</td>
<td rowspan="9" valign="top">
<span id="datalist1_ctl00_lbl_p"></span>
</td>
</tr>
Thanks!
Give it a try like this, it works if you fix it a bit further:
Option Explicit
Public Sub TestMe()
Dim myString As String
Dim cnt As Long
Dim myArr As Variant
myString = "<!-- <b>IE CODE : Koj sega e</b> -->blas<hr>My Website " & _
"is here<B><B><B><!-- <b>IE CODE : nomer </b> -->" & _
"is here<B><B><B><!-- <b>IE CODE : 1? </b> -->"
myString = Replace(myString, "-->", "<!--")
myArr = Split(myString, "<!--")
For cnt = LBound(myArr) To UBound(myArr)
If cnt Mod 2 = 1 Then Debug.Print myArr(cnt)
Next cnt
End Sub
This is what you get:
<b>IE CODE : Koj sega e</b>
<b>IE CODE : nomer </b>
<b>IE CODE : 1? </b>
The idea is the following:
Replace the --> with <!--
Split the input by <!--
Take every second value from the array
There are some possible scenarios, where it will not work, e.g. if you have --> or <!-- written somewhere within the text, but in the general case it should be ok.
You can use XPath:
substring-before(substring-after(//tr//comment(), "<b>"), "</b>")
to get required data

Replacing span element text with color

I have below span tag generated by custom tool (I can't ask it to generate in different way)
<span tabindex="0" > FINDME </span>
I want to write a script section within and to find the text "FINDME" and replace this with :
<span tabindex="0" style="color:red">FINDME</span>
or
<span tabindex="0">
<font color="red"> FINDME </font>
</span>
Basically I want to get the text colored. Also since I would have multiple span element coming that way so I had to search by text before replacing it.
I don't know how to code it so any help will be appreciated.
thanks !
This code will search for all the spans in your code and the one that have the text " FINDME " will get the color replaced. This solution is using jQuery
$(document).ready(function(){
$("span").each(function(){
if($(this).text() == ' FINDME '){
$(this).css('color','red');
}
});
});
https://jsfiddle.net/wearetamo/mdwkakzz/
The answer is :
<script> var span3 = document.querySelector('#dashboard_page_3_tab span'); span3.innerHTML = '<font color="red"> FINDME </font>' ; </script>

Hover text is broken if text has special symbols when description is given

Example:
<a title="A web design community.'test'~`!##$%^&*()-_+=\|][{};:,<.>?/ **"new test"** " href="http://css-tricks.com">CSS-Tricks</a>
In tooltip, after the double quotes "new test" is not working.
Is there any possible to show the content in tooltip like this
ex: testing 'welcome', # 3 $ ^ & * "flow"?
The problem is that your double quotes in the title close your title automatically. Escape them by replacing " with " and also funkwurm recommends to replace < and > with < and > respectively to avoid errors in xml:
<a title="A web design community.'test'~`!##$%^&*()-_+=\|][{};:,<.>?/ **"new test"** " href="http://css-tricks.com">CSS-Tricks</a>
You can use this is also.
<a title="Answer to your's question.'Test It' :):)'B Happy' :):)"new test"**" href="http://css-tricks.com">CSS-Tricks</a>