Extra quotes after every quotes when I copy and paste to notepad from excel - string

I have the following text stored in a cell in a worksheet
<tr onmouseover="this.style.backgroundColor='#74eb61';" onmouseout="this.style.backgroundColor='#e8e8e8';">
Now when I copy and paste it to notepad from that I get the extra quote sign after every quote so it becomes like the following string
<tr onmouseover=""this.style.backgroundColor='#74eb61';"" onmouseout=""this.style.backgroundColor='#e8e8e8';"">
You can recreate this by:
Copy this text:
<!-- CSS goes in the document HEAD or added to your external stylesheet -->
<style type="text/css">
table.hovertable {
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #999999;
border-collapse: collapse;
}
table.hovertable th {
background-color:#009fe3;
color:#FFFFFF;
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #a9c6c9;
}
table.hovertable tr {
background-color:#e8e8e8;
}
table.hovertable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #a9c6c9;
}
</style>
<!-- Table goes in the document BODY -->
<table class="hovertable">
<th colspan="4">Info Header</th>
<tr onmouseover="this.style.backgroundColor='#74eb61';" onmouseout="this.style.backgroundColor='#e8e8e8';">
<td>Item 1A</td><td>Item 1B</td><td>Item 1C</td>
</tr>
<tr onmouseover="this.style.backgroundColor='#74eb61';" onmouseout="this.style.backgroundColor='#e8e8e8';">
<td>Item 2A</td><td>Item 2B</td><td>Item 2C</td>
</tr>
<tr onmouseover="this.style.backgroundColor='#74eb61';" onmouseout="this.style.backgroundColor='#e8e8e8';">
<td>Item 3A</td><td>Item 3B</td><td>Item 3C</td>
</tr>
<tr onmouseover="this.style.backgroundColor='#74eb61';" onmouseout="this.style.backgroundColor='#e8e8e8';">
<td>Item 4A</td><td>Item 4B</td><td>Item 4C</td>
</tr>
<tr onmouseover="this.style.backgroundColor='#74eb61';" onmouseout="this.style.backgroundColor='#e8e8e8';">
<td>Item 5A</td><td>Item 5B</td><td>Item 5C</td>
</tr>
</table>
and paste to any cell in Excel
And then Copy the cell contents and paste on notepad and you will find extra quotes

This is 'behavior by design'. The clipboard's involvement in the process of transferring the cell value from XL to Notepad++ mean that the text string is evaluated. There are a lot of scenarios that are tested for (I do not have a complete list) but it seems that your paste operation is being interpreted as creating a comma separated or tab separated TXT export file. The quote characters are being doubled up because your system is using the quote character as the Text Qualifier special character in an XL-to-TXT export.
Unfortunately, you do not want this transitional behavior but many others do. If you need to bypass it, copy the text string from the formula bar or in-cell while in edit mode. This is not Excel's doing or even the Office Clipboard (OCB). It is the Windows clipboard's behavior which is trying to interpret a transfer from XL to Notepad++.

Related

Initialize from html table

I have been trying to make an org chart using the code from this example http://www.getorgchart.com/Demos/Initialize-From-HTML-Table
I am making my table dynamically from xml data (planning to do this for many different xml files so thats why I haven't hardcoded the table). The result does not look right and I'm not sure whats going wrong. I suspect that maybe its trying to make the org chart before my table is made. I have no console errors and I get a plain blue screen with the search bar and arrows when I try to run everything.
Here is my html code:
https://pastebin.com/6b1d0gEC
<body onload="getXML()">
<div id = "conditions"></div>
<div style="float: right; width: 10%; height:100%; text-align:center; display: none;" ></div>
<table id="orgChartData" >
<tr>
<th>title</th>
</tr>
<tr>
Here is my JS code
https://pastebin.com/c7fFerqH
Here is the XML im using to generate the table
https://pastebin.com/0k3xQ5Th

I'm trying to select and item from a dropdown kendolistbox in IE with Excel Vba

I found a solution to choosing a fixed selection from a dropdown list. Now all I have to do is figure out how to choose an item based on the choices.
The following chooses the first item in the dropdown, however, I found out that making the dropdown "open" is not necessary.
Changing the select parameter to 2 chooses the second item in the list etc.
I suppose trying to use getElementById and cycling through the innerText may be the way to go, since I don't know any other way.
ie.Document.parentWindow.execScript "$('#drgdTankCrude').data('kendoGrid').dataItem($('#Tank_ID').data('kendoDropDownList').select(1));"
Here a section of the web page code.
<input name="Tank.ID" id="Tank_ID" style="width: 200px; display: none;" type="text" data-role="dropdownlist"></span>
'Lots of other stuff in here for formatting
<div class="k-widget k-grid" id="drgdTankCrude" style="left: 890.32px; top: 93.7px; display: block; position: absolute;" data-role="grid">
<table class="k-selectable" role="grid" style="-ms-touch-action: double-tap-zoom pinch-zoom;" data-role="selectable">
<colgroup><col><col></colgroup>
<thead class="k-grid-header" role="rowgroup">
<tr role="row">
<th class="k-header" scope="col" data-title="Tank" data-index="0" data-field="ID"><span class="k-link">Tank</span></th>
<th class="k-header" scope="col" data-title="Capacity" data-index="1" data-field="Capacity"><span class="k-link">Capacity</span></th>
</tr>
</thead>
<tbody role="rowgroup">
<tr class="k-state-selected" aria-selected="true">
<td>179800</td>
<td>202.06</td></tr>
<tr class="k-alt" aria-selected="false">
<td>179801</td>
<td>202.82</td>
</tr>
</tbody>
</table>
</div>
'Code before dropdown
<tbody role="rowgroup">
<tr>
<td>179800</td>
<td>202.06</td></tr>
<tr class="k-alt">
<td>179801</td>
<td>202.82</td>
</tr>
</tbody>
'Code before dropdown opens
<div class="k-widget k-grid" id="drgdTankCrude" style="left: 890.32px; top: 93.71px; display: none; position: absolute;" data-role="grid">
'Code change after dropdown opens
<div class="k-widget k-grid **k-custom-visible**" id="drgdTankCrude" style="left: 890.32px; top: 93.71px; display: block; position: absolute;" data-role="grid">
'Code change after making a selection
<tbody role="rowgroup">
<tr class="k-state-selected" aria-selected="true">
<td>179800</td> '<<-----This item selected
<td>202.06</td></tr>
<tr class="k-alt" aria-selected="false"> '<<--If selected then unselected
<td>179801</td> 'otherwise ends at k-alt">
<td>202.82</td>
</tr>
</tbody>
The answer to selecting the first item in a kendoDropDownList ..
ie.Document.parentWindow.execScript "$('#drgdTankCrude').data('kendoGrid').dataItem($('#Tank_ID').data('kendoDropDownList').select(1));"

excel web query in vba

I have a worksheet that currently updates about 200 stocks using Yahoo Finance API and MSXML. I would like to also get some other info from other websites that don't have an api, for example "http://www.earningswhisper.com/stocks.asp?symbol=googl".
Also for example, if you look at some info from that web page below, you see there is a Release Date of 1/29/2015. There is also some text in between, currently "[not confirmed]", but at some point it will change to "[confirmed]" and both items of text are of interest.
For lack of better web skills, I currently have a single sheet with a QueryTable that is refreshed in a code synchronously. It works...eventually. I would rather work with the response in code, but I don't know how to do that. I don't need this particular info to be auto refreshed.
Questions
Is there a preferred VBA way work with the html response? Can you show a code snippet to illustrate?
Is it possible to convert the html to xml or json relatively easy? code snippet?
If QueryTable is in fact the good enough solution, would it be faster to create a sheet for each stock and refresh async, using events?
I know there is oodles of info on the web, but most of it seems dated and confusing. I am using Excel 2013.
I am able to get at the data I want using html and grabbing Table(6) as shown in the code below. I guess I could parse the InnerText but I suspect there is an easier way to grab the elements I need from that table.
Sub TestHtml()
Dim Resp, sText, FirstCode As String
Dim oHttp, oFile, oTable As Object
Dim lines As Variant
Set oHttp = CreateObject("Microsoft.XMLHttp")
oHttp.Open "GET", "http://www.earningswhisper.com/stocks.asp? symbol=googl", False
oHttp.send ("")
Resp = oHttp.responseText
Set oFile = CreateObject("htmlfile")
oFile.Write Resp
Set oTable = oFile.getElementsByTagName("Table")(6)
sText = oTable.innertext
MsgBox sText
End Sub
Here is a line from that table, and the full table below.
<tr onMouseover="this.className='newsart_s2'" onMouseOut="this.className='newsart'">
<td width="67%" align=left valign=middle> Release Date: <font color='#505050'><small>[not confirmed]</small></font>
</td>
<td width="33%" align=right valign=middle>1/29/2015 </td>
</tr>
What is the best way to drill down and get at the elements in the table, using VBA code?
<TABLE cellpadding=1 cellspacing=0 border=0 id=QEsts width="100%" bgcolor="#505050"><tr><td><TABLE cellpadding=2 cellspacing=0 border=0 width="100%" bgcolor="#FFFFFF" height='148'><tr><td valign=top>
<table cellpadding=0 cellspacing=0 border=0 width="100%" class='newsart'>
<tr><td colspan="2" bgcolor="#FFFFFF"><table width="100%" bgcolor="#FFFFFF" cellpadding=1 cellspacing=0 border=0><tr><td style="background-image: url('images/headbar2.gif'); background-color: #000000; BORDER-RIGHT: #000000 thin solid; BORDER-TOP: #000000 thin solid; FONT-WEIGHT: bold; FONT-SIZE: 12px; MARGIN: 2px; BORDER-LEFT: #000000 thin solid; COLOR: #e1b64b; BORDER-BOTTOM: #000000 thin solid; FONT-FAMILY: Arial;"> 4th Quarter Ending December 2014</td></tr></table></td></tr>
<tr onMouseover="this.className='newsart_s2'" onMouseOut="this.className='newsart'"><td width="67%" align=left valign=middle> <b>Earnings Whisper</b> <small>&#174</small>: </td><td width="33%" align=right valign=middle><b>$7.24</b> </td></tr>
<tr onMouseover="this.className='newsart_s2'" onMouseOut="this.className='newsart'"><td width="67%" align=left valign=middle> Consensus Estimate:</td><td width="33%" align=right valign=middle>$7.16 </td></tr>
<tr onMouseover="this.className='newsart_s2'" onMouseOut="this.className='newsart'"><td width="67%" align=left valign=middle> Surprise Expectation <small><sup>1</sup></small>: </td><td width="33%" align=right valign=middle> </td></tr>
<tr onMouseover="this.className='newsart_s2'" onMouseOut="this.className='newsart'"><td width="67%" align=left valign=middle> Release Date: <font color='#505050'><small>[not confirmed]</small></font></td><td width="33%" align=right valign=middle>1/29/2015 </td></tr>
<tr><td width="100%" align=right colspan="2" valign=middle>After Close </td></tr>
<tr onMouseover="this.className='newsart_s2'" onMouseOut="this.className='newsart'"><td width="67%" align=left valign=middle> Expected Time <small><sup>2</sup></small>: </td><td width="33%" align=right valign=middle>N/A </td></tr>
<tr onMouseover="this.className='newsart_s2'" onMouseOut="this.className='newsart'"><td width="67%" align=left valign=top> Conference Call: </td><td width="33%" align=right valign=top>4:30 PM ET <small><br> </small></td></tr>
</table>
</td></tr></TABLE></td></tr></TABLE>
</td>
You can interact with DOM since you created that object successfully, but you know in your case the easiest way to get the necessary value from the table above is parsing the InnerText as string, try the code below:
aTmp0 = Split(sText, "Release Date:")
If Ubound(aTmp0) = 1 Then
aTmp1 = Split(aTmp0(1), "Expected Time")
MsgBox aTmp1(0)
Else
MsgBox "Release Date not found"
End If

JavaFX hide text of column in tableview

I have a tableview and I want to show an image in the first column. My problem is I can't sort the column then. My idea is to set text in the column too and hide the text so it is only for the correct sorting set. Is there a way to do that? Or what other solutions are possible for my problem?
I think this is the perfect example what you wants to do.Still let me know if you have any issue.
Check here
I would have a look at TableColumn.setCellValueFactory() and TableColumn.setCellFactory(). The further is used to provide the actual cell value (used for sorting!), the latter is used to provide the rendering.
In other words: If you need the sort order, you must not change the content, but only the Cell rendering. The methods mentioned above let you do exactly this.
Hope that helps ...
You could do it with just CSS using text-indent. You would also need to set the image as a css background. You did not provide an code of your table, but below is some example:
HTML:
<table width="100%" border="1" cellspacing="1" cellpadding="1">
<tr>
<td class="hidetext image">Text 1</td>
<td>Some text to show</td>
</tr>
<tr>
<td class="hidetext image">Text 2</td>
<td>Some text to show</td>
</tr>
<tr>
<td class="hidetext image">Text 3</td>
<td>Some text to show</td>
</tr>
<tr>
<td class="hidetext image">Text 4</td>
<td>Some text to show</td>
</tr>
</table>
CSS:
.hidetext {text-indent:-9000px}
.image {background:url(http://www.madisoncopy.com/images/jpeg.jpg) no-repeat;}
See how in the left column the text does not show (but it is actually there just indented off the screen).
See this fiddle: http://jsfiddle.net/D297P/

Footable - client wants column width to remain constant between pages

When you have multiple pages of data in a Footable, the column width changes as you page through the data, depending on what appears in each column at any given time. This is ugly.
I think my client's request means I will not have responsive tables, but maybe there is way out of this that I don't see.
Footable handles pagination client-side. Technically, it should be possible to "lock" the column width from the first page and force it to remain the same throughout the data. I don't think Footable has this option, though.
$(function () {
$('.footable').footable();
});
This jsfiddle illustrates the issue (the jsFiddle CSS interferes with mine a bit because it has Footable classes, too).
I could specify the width of the columns in % - that seems to work even when column are hidden as the viewport shrinks.
Does anyone have another/better suggestion?
I am not able to reproduce your problem and the jsfiddle is not paging the footable.
Still, I had a similar problem with column width when I generated the table content after an AJAX call. The solution I found was to apply a class to every cell in the nTH column and then define the width = max-width min-width.
I've added a class to your subject header and defined css for this column ...
http://jsfiddle.net/bgil2012/gHsdE/
<table class="footable" data-page-size="5">
<thead>
<tr>
<th data-toggle="true">Product</th>
<th data-hide="phone">Study Id</th>
<th class="study-title" data-hide="phone">Study Title</th>
<th class="column_condition" >Condition</th>
<th>Results</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Tysabri</td>
<td>001-06-NAT</td>
<td class="study-title">ENER-G Tysabri fatigue and cognition</td>
<td class="column_condition" >Multiple Sclerosis</td>
<td>CSR Synopsis</a>
</td>
</tr>
CSS:
.study-title {
max-width: 20px;
min-width: 20px;
width: 20px;
}

Resources