Is it possible to display an in-line image? - textbox

Article http://runrev.com/newsletter/june/issue135/newsletter4.php shows how to display a table in a text field. Is it as well possible to display in-line images?

You'll have to mess with the htmltext of the field in order to insert the online images, but it can be done. Put the htmltext of the field into a variable, then insert a line of html, as in
put "<img src=" & quote & "http://www.site.com/image.png" & quote & ">" after line x of tHtmlText
and then set the htmltext of the field back to tHtmlText

If the image is in your stack, you can use
put "%" into fld 1
set the imageSource of char 1 of fld 1 to 1014
Where % is an arbitrary character and 1014 is the image id of an arbitrary image. You can set the imageSource of any character in a field.

Related

Want file in CSV. I need a Regex to change a space to a comma on each line EXCEPT the Description Field which should remain with a space

Goal:
I want a CSV file as my result. I want to change the space char to a comma on each line of data. BUT, I also need the data for the 3rd field (Description) to remain as is with original space chars. Each line of data is terminated with a newline char.
Flipping spaces to commas on every line is easy with regex. But how do 'bookend' the string of text which will then become the 3rd/Description field and preserve its spaces? Currently I manually change commas back to spaces just in that text string. Painful.
Example of Final result needed (including column names)
Transaction Date,Posting Date,Description,Reference Number,Account Number,Amount
12/23,12/24,GOOGLE*DOMAINS SUPPORT.GOOGLCA,7811,8550,12.00
My sample data:
12/23 12/24 GOOGLE*DOMAINS SUPPORT.GOOGLCA 7811 8550 12.00
01/02 01/04 CREPEVINE - OAKLAND OAKLAND 234567 CA 1087 8220 16.32
01/06 01/07 AB* ABEBOOKS.CO J6YDBX HTTPSWWW.ABEBWA 6289 85332 6.98
01/20 01/21 SQ *BAGEL STREET CAFE Oakland CA 2313 44444 24.43
A few of My Regex attempts
This cmd changes spaces to commas over all 5 lines by combining it with Join cmd. Easy.
And just fyi: "\n" would not work for some reason so I do the <Ctrl+Enter> keys to inject a newline char, ie the two lines. For now it orks fine.
=regexreplace(join("
",A1:A5)," ",",")
RESULT:
12/23,12/24,GOOGLE*DOMAINS,SUPPORT.GOOGLCA,7811,8550,12.00
...
01/02,01/04,CREPEVINE,-,OAKLAND,OAKLAND,CA,1087,8550,16.32
...
Here is my poor attemp to bookend the description field, then flip commas back to spaces, but no luck either.
=REGEXREPLACE(A1,"(,[A-Z]+[A-Z],)"," ")
How do I craft a regex to do this?
cheers,
Damon
Using Regex101 to reverse learn how you did it
Can you try:
=index(if(len(A:A),regexreplace(A:A,"(?U)(.*) (.*) (.*) (\d[^A-Za-z]*) (\d.*) (\d.*)","$1,$2,$3,$4,$5,$6"),))

string manipulation in Dart / flutter

I am parsing an RSS feed that
returns has the title in this format:
<title>Some Data with spaces / Bahnofstrasse 22</title>
so the first thing I did is to replace the spaces with a +
String result = _items[index].title.replaceAll(new RegExp(r"\s+\b|\b\s"), "+");
however, what I need to do is to select only the text after the / so in this case Bahnofstrasse 22, remove the spaces and add a city (e.g. Zurich) before the address so the desired results would be
Zürich,Bahnofstrasse,22
so essentially select all text after /, add Zurich and replace spaces with ,
If you know that the data will always be separated by a /, you could look at the second element of the split. For example,
final result = "Zürich," +
_items[index].title
.split("/")[1]
.replaceFirst("<", "")
.trim()
.replaceAll(" ", ",");
Regular expressions would only really be useful if, for example, the format of the data were variable.

How to delete non text characters, new line, tab, etc, from params of JSON string

I have JSON strings that may contain \n, \t, which I don't want to save into database. strip_tags helps only with simple strings. I am using gsub(/(\\n)|(\\t)/, "").
I wonder if there is another Rails helper method or a better way to achieve this.
e.g
"[{\"type\":\"checkbox-group\",\"label\":\"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nFill in\\nthe Gap (Please\\nfill in the blank box with correct wor\",\"name\":\"checkbox-group-1527245153706\",\"values\":[{\"label\":\"Option 1\",\"value\":\"option-1\",\"selected\":true}]},{\"type\":\"text\",\"label\":\"\\n\\t\\t\\n\\t\\n\\t\\n\\t\\t\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\t\\tWhat are the unique features of\\ne-commerce, digital markets, and\\ndigital goods? \\n\\t\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t\\n\\t\\t\",\"className\":\"form-control\",\"name\":\"text-1527245426509\",\"subtype\":\"text\"}]"
You can make use of squish or squish!
" Some text \n\n and a tab \t\t with new line \n\n ".squish
#=> "Some text and a tab with new line"
Squish removes all the whitespace chars on both ends and grouping remaining whitespace chars (\n, \t, space) in one space
I think this one may help you,
JSON.parse(string).map{ |a| a['label'] = a['label'].squish; a}

Whole text not exported in pdf using aspose word template

I have a scenatio to export a 25000 characters text , which is does not have any space break between character. it mean single word with 250000 length . but realtime a word length cannot be more then 25. Anyhow the text should have exported into pdf using Aspose word template. but it doesnot export 25000 length , instead export 4578 characters into pdf , remaining are discarded in pdf. but i could get the 25000 length character in my code before calling that pdf export method using aspose.
But the text are properly exported into pdf , if you give positive scenario text upto any characters length .
Let me know, is there any solution why the text are discarded , if gives contineous text without break?
Please use CompatibilityOptions.GrowAutofit property as shown below to get the desired output.
Document doc = new Document(MyDir + "SupervisionReportTemplate - Copy.docx");
DataTable table = new DataTable("SupervisorComment");
table.Columns.Add("GeneralVisitComment", typeof(string));
var newRow = table.NewRow();
newRow["GeneralVisitComment"] = File.ReadAllText(MyDir + "25000 contineous character length.txt", Encoding.Unicode);
table.Rows.Add(newRow);
doc.MailMerge.ExecuteWithRegions(table);
doc.CompatibilityOptions.GrowAutofit = true;
doc.Save(MyDir + "18.4.docx");
I work with Aspose as Developer Evangelist.

Remove all non alpha characters from a string including & or any & code

Given a string like "Whatup <b>whatever<b> \n", i need to turn that into "Whatup whatever".
I'm pretty close with my below method, but I can't find a good way to remove dynamic & and type codes. I don't want to gsub each out (like i'm doing with the comma) -- There are hundreds of thousands of rows and many different codes in them...blah
Any pointers are welcome.
def self.clean_string(st)
return strip_tags(st).force_encoding("UTF-8").gsub(",","").squish if st and st != ""
end
For the HTML entities, add this regex replacement:
.gsub(/&[^;]+;/, '')
It will remove any &-style entity from the text.

Resources