rtfText Glitch with Bulleted or Numbered List?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
deeverd
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 165
Joined: Mon Jul 16, 2007 11:58 pm

rtfText Glitch with Bulleted or Numbered List?

Post by deeverd » Sat Jul 11, 2015 5:47 pm

Hello Forum,

Right up front I just want to say apologies for using this forum so much lately, it's just that I've been coding about 6 hours a day, 6 days per week this past month, which is a great way of finding out just how much I don't know.

Anyway, I just became aware of what appears to me to be a glitch when exporting a document with rtfText, which looks to be a related but somewhat different issue from what had been discussed on this forum in February 2014. Not sure if there's any scripting solution for the problem, but here's what happens:

When trying to export a formatted field using rtfText, if there happens to be either a bulleted or numbered list in that text, which was created by using the following html list elements...

Code: Select all

<ul>
<li></li>
</ul>
or

Code: Select all

<ol>
<li></li>
</ol>
...any text in the document, both including and following the bulleted or numbered list, disappears completely from the exported document.

Does anyone know if this is a known issue? I don't remember having this problem before upgrading to LC 7.06. I'm using Windows 8.1 as well.

Using htmlText doesn't seem to have this problem.

Cheers,
deeverd

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10100
Joined: Fri Feb 19, 2010 10:17 am

Re: rtfText Glitch with Bulleted or Numbered List?

Post by richmond62 » Sat Jul 11, 2015 8:07 pm

It seems a bit odd exporting html formatted text to RTF.

deeverd
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 165
Joined: Mon Jul 16, 2007 11:58 pm

Re: rtfText Glitch with Bulleted or Numbered List?

Post by deeverd » Sat Jul 11, 2015 9:12 pm

Hello Richmond62,

True, odd it is, but odd is my middle name. I once sold everything I owned, quit a great paying job, and moved to a small island in the South Pacific in order to live out my dream of being Robinson Crusoe. Another time, I did something similar by leasing a camel and riding across the Australian outback. Also, just for the fun of it, navigated a plane from California to Iceland, solely using the compass (no GPS or anything too easy like that). I can even tell you what cooked earthworms, witchetty grubs, grasshoppers and green ants taste like. I like odd.

Anyway, accomplishing the exporting of formatted text was never a problem before. Actually, I just wanted to allow anyone who wanted to download a user manual to be free to export the lengthy field as a .rtf or .html document. Their choice.

The rtfText definitely makes everything in the document disappear where the list begins, which is a mystery to me, especially considering that I can take that same exported .html file, copy the contents and paste it into an .rtf document... and everything is there.

Methinks there might be a new bug in the rtfText. I've tried it by copying everything from word 1 to -1, setting the clipboard contents to the field, etc., but when the field contains either a bulleted or numbered list, no joy.

Cheers,
Allen

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: rtfText Glitch with Bulleted or Numbered List?

Post by jacque » Sun Jul 12, 2015 7:23 pm

I'm not seeing that on OS X, but I'm not sure we're using the same methods. How are you doing the export exactly? I set the htmltext of a field to the text of an html file on disk, and then wrote the rtfText of the field to a file. Is that what you're doing?

Also, can I have your camel?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: rtfText Glitch with Bulleted or Numbered List?

Post by FourthWorld » Sun Jul 12, 2015 8:36 pm

The Dictionary notes on the rtfText property may be useful here, reminding us that not only does is represent a subset of what LiveCode fields support, but also that the RTF spec is so loose that not even OpenOffice can round-trip it.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

deeverd
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 165
Joined: Mon Jul 16, 2007 11:58 pm

Re: rtfText Glitch with Bulleted or Numbered List?

Post by deeverd » Mon Jul 13, 2015 2:53 am

Hi Jacque & Richard,

Here's a condensed version of the script I typically use for exporting a formatted field as .rtf, minus any filters or a bunch of case-switches or if-then-elses to make sure a proper file name and extension was included:

Code: Select all

on mouseUp
   
open file it
write the rtfText of field "previewField" to file it
close file it
   
end mouseUp
When the entire document quit exporting successfully, I methodically took out various types of formatting, one a time, to test if something in particular was causing the glitch.

It turned out that only bulleted or numbered lists were a problem, and when using them, nothing from that point onward would be in the document. Every other type of formatting seems to pose no such problem.

Since Windows 8.1 and the new MS Office, I've found that .rtf in general seems to be biased against. Trying to open an .rtf document caused my Word program to crash so many times, I finally gave up on MS Word for much of my word processing and have been happily using an excellent office compatible product from Europe instead called Textmaker. No problems using .rtf with it.

The reason for the combination of .html and exporting an .rtf is that part of the program is a previewer that allows people to see the web page they've created in a simple .html editor, and I just wanted to let them export it in a variety of ways. As long as they're not using lists, they can export it via .rtf.

Anyway, thanks for looking into it. My main reason for bringing this up on the forum was simply the fact that I may have pinpointed where one of the main problems of using .rtf might be. Hope that helps.

Cheers,
Allen

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: rtfText Glitch with Bulleted or Numbered List?

Post by jacque » Mon Jul 13, 2015 5:39 pm

That's very close to what I did. If you want to post a sample rtf file we can see if it opens correctly on a Mac. If so, that would narrow down the problem to a Windows 8 glitch. I'm wondering if the issue is more related to the receiving app than to the export itself.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

deeverd
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 165
Joined: Mon Jul 16, 2007 11:58 pm

Re: rtfText Glitch with Bulleted or Numbered List?

Post by deeverd » Mon Jul 13, 2015 6:46 pm

Hi Jacque,

I've placed an attachment with this post that contains the following 3 items:

1) Sample of the exported .rtf document, showing where it cuts the text out at the place where the line elements would be located.

2) Document exported as .html, which shows all the text in the sample. However, it doesn't appear that exporting as .html preserves all the correct font sizes when using headings 1-5, <h1>, etc.

3) A copy of the LC card that shows you the preview field and has the actual rtf export on the copy, so you can try it and see how it doesn't export correctly.

Sorry that the copy you'll be looking at is an advertisement for one of my books. Not trying to unashamedly promote a product here. It's just that this is the actual sample card that won't export correctly in .rtf.

What's even more interesting is that not only does it not export correctly, but even when using the clipboard, it cuts off all text at and beyond the list elements.

In fact, even pressing [ctrl] + [a] to highlight everything by hand and then [ctrl] + [c] to copy and paste it into an empty open .rtf document still causes me to lose everything from the list elements down.

BTW, I also have this same problem when trying to copy and paste it into a MS Word document, yet if I paste that same data that's in my clipboard into a .txt document, all the text and lists are there (sans formatting of course).

Definitely a mystery.

Thanks for looking at this.
Cheers,
Allen
Attachments
RTF Test.zip
(5.68 KiB) Downloaded 222 times
Last edited by deeverd on Mon Jul 13, 2015 7:15 pm, edited 1 time in total.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: rtfText Glitch with Bulleted or Numbered List?

Post by jacque » Mon Jul 13, 2015 7:09 pm

I take back what I said, I screwed up my first test with an incorrect test file. My revised test doesn't open correctly in Mac either, I get the same cut-off as your example file. I also tested in LC 6.6.5 and the same problem occurs, so it isn't due to the new unicode support. I suspect a small bug somewhere in the output, since I do see list entries in your sample RTF, like this:
\par \pard \tx0\ls2\ilvl0\listtext\tab\u8226.\tab} Creative differences between pen & paper vs. keyboard
So if you report the problem and include your test stack it will probably get fixed pretty quickly.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

deeverd
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 165
Joined: Mon Jul 16, 2007 11:58 pm

Re: rtfText Glitch with Bulleted or Numbered List?

Post by deeverd » Mon Jul 13, 2015 7:22 pm

Hi Jacque,

Glad to know it wasn't just an example of insanity on my part. (I really should quit putting too much stock into my wife's assessment of my mental stability.) :shock:

I'll definitely submit a bug report today as soon as I get a chance.

Cheers,
Allen

deeverd
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 165
Joined: Mon Jul 16, 2007 11:58 pm

Re: rtfText Glitch with Bulleted or Numbered List?

Post by deeverd » Mon Jul 13, 2015 8:06 pm

Bug 15597 has now been reported.

Post Reply