I have ListGrid in smartGWT populated with fields and information. Some of the columns have sentences. I was wondering if it was possible to highlight all occurrences of a specific keyword. For example: If I had a sentences "The cat was fluffy" and "The cow jumped over the moon and I wanted to find all occurrences of "the", then my columns would show: "The cat was fluffy" and "The cow jumped over the moon".
I know that you can use the editHilites() method to highlight the entire cell of the column, but I want to highlight individual words within the column. Is there an easy/feasible way to do this in smartGWT?
The text you are writing in the field is Html, so I think you can use your css...
I found a way to use setCellFormatter to create a cellFormatter to search through and find what I wanted to highlight.
Related
A very simple example can be found here: https://docs.google.com/spreadsheets/d/10qUrVMFCdj_myc33uYPKxz_mDXzGhTLC-agh3P7s4XQ/edit#gid=0
Basically, I'd like to have column A feature all of the formatted text, and column B show the HTML version of the same text. Note: we really only need to know how to display whether something is bold.
Thanks to everyone who pitches in with their 2 cents! This community is remarkable.
Looking to extract the author name from articles. Currrently using =IMPORTXML(G2,"//*[#class='author-details']")
When I do this, it creates 4 cells underneath which contain the word 'By', which I can't get rid of.
Very new to code - what am I doing wrong?
Attached example: https://docs.google.com/spreadsheets/d/1Mi1D5G1-_gNsQwVQ6I_ealDqcWixKA2p-hFqJpjlGt4/edit?usp=sharing
You can use:
=index(IMPORTXML(G2,"//*[#class='author-details']"),1,2)
This displays only the first row of the second column of what is returned. The information You are after.
Edit:
Additionally, since you highlighted that you want author name. If all the names are in that format "By FIRST LAST #TwitterHandle Affiliation" then you can use this to get just the author's name:
=trim(split(right(index(IMPORTXML(G2,"//*[#class='author-details']"),1,2),len(index(IMPORTXML(G2,"//*[#class='author-details']"),1,2))-3),"#",true,true))
Will likely look like voodoo but paste it in, it works. It removes the first 3 characters ("By "), splits the text at the "#" symbol, and then keeps only the text on the left side of it, the name.
I'm extracting text from filename cells into separate metadata field cells. So far I have done this successfully using the REGEXTRACT formula, as seen below.
=REGEXEXTRACT(A1, "TILEABLE|ROOM|MAIN|FLOORSHOT|SWATCH|ANGLED")
However some metadata fields that include multiple words require that a space or other character be placed between words. I'm trying to figure out how to use SUBSTITUTE or REPLACE in conjunction with REGEXTRACT to find a phrase and replace it with a version with something different. Ex. Replace "TOPDOWN" with "Top Down" or replace "1TO1" with "1-to-1).
Depending on your purpose one formula might be better than other. If you want to list in a column the substituted values of this string you could chain the number of phrases you want using SUBSTITUTE and REGEXTRACT.
This will return all the phrases you are looking for and substitute them to then use the formula TRANSPOSE to take this range and display it in a columns (as it normally would be displayed in a row and only a single value). This is a simple example:
=TRANSPOSE({SUBSTITUTE(REGEXEXTRACT(A1,"TOPDOWN"),"TOPDOWN","Top Down"),SUBSTITUTE(REGEXEXTRACT(A1,"SHIRTS"),"SHIRTS","Shirts1")})
try:
=SUBSTITUTE(SUBSTITUTE(REGEXEXTRACT(A1,
"TOPDOWN|1TO1|TILEABLE|ROOM|MAIN|FLOORSHOT|SWATCH|ANGLED"),
"TOPDOWN", "Top Down"),
"1TO1", "1-to-1")
I have created a google sheet to schedule appointments for a clinic. I am looking to find a method which will highlight the cell or row based on a client name? This can be based off a script or separate google sheet.
For example, I want the following names to be highlighted if they are entered.
John Smith
Susan Johnson
Ted Jones
When someone enters their name in the Column (Name), then that row or cell will be highlighted with a color.
Any help would be greatly appreciated. Thank you
Go to Format -> conditional formatting and then set the rules you want for the range of cells where you want that highlighting rule to be applied. You can highlight if the cell is blank/ not blank, or if the cell contains specific text that you will need to stipulate.
You'll also want to be sure that they spell the name correctly so that the conditional formatting actually works. If you know all the names in advance, you can even create a dropdown list using the data validation tool to prevent typos.
Data > Validation > List from a range or items
I have a table with search capability. When the user types I display matched names using NSpredicate. I want to highlight the matched letter(s). I am currently using NSAttributedString and finding all the occurrences of the user input using rangeOfString:options:range: in a while loop. I was wondering if there is an efficient way to do this.
Example user searches types e in the following list
Joe
Michel
In results all the e's should be bold
Thanks
You can use TTTRegexAttributedLabel- https://github.com/kwent/TTTRegexAttributedLabel
or TTTAttributedLabel - https://github.com/mattt/TTTAttributedLabel.
You can change your UILabel to any of the above labels and highlight your searched word or letter.