Importing from Word or HTML

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 336
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Importing from Word or HTML

Post by kaveh1000 » Fri Dec 21, 2018 10:35 pm

I have some text in a Word file. I want to import that into a field, keeping at least some formatting. I understand that both htmltext and rtftext are limited in LiveCode (for good reasons). But is there a way of simplifying an rtf file or an HTML file generated from Word, so that basic formatting is kept? Of course Word does not make it easy by using needlessly complex mark-up...

The closest I have got is to copy and paste the text which is not bad, but I wonder if there is a better way.
Kaveh

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6873
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Importing from Word or HTML

Post by FourthWorld » Fri Dec 21, 2018 11:15 pm

Is exporting RTF from Word an option?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 336
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Importing from Word or HTML

Post by kaveh1000 » Fri Dec 21, 2018 11:33 pm

I tried it. And I tried HTML export too. In both cases LiveCode gets stuck on some lines, e.g. HTML:

Code: Select all

execution error at line 474 (Chunk: error in object expression) near "<div class=WordSection1>", char 41
and RTF:

Code: Select all

stack "myStack": execution error at line 476 (Chunk: error in object expression) near "{\rtf1\adeflang1025\ansi\ansicpg10000\uc1\adeff31507\deff0... 

(truncated)

So I am looking for an HTML or RTF "simplifier", to leave just the bare essentials for LiveCode.
Last edited by kaveh1000 on Sat Dec 22, 2018 9:16 am, edited 1 time in total.
Kaveh

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6873
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Importing from Word or HTML

Post by FourthWorld » Fri Dec 21, 2018 11:36 pm

HTML is not htmlText, so the first error doesn't surprise me.

The second error may be a bug. LC may not support all RTF features, but should not throw an error. You can file a bug report here:
https://quality.livecode.com/
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2125
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Importing from Word or HTML

Post by [-hh] » Sun Dec 23, 2018 3:04 pm

Probably you want something like this (includes pdf.js!):
https://viewerjs.org

It is very easy to install and to use if and only if you use it from a (local) server AND all your docs to view (PDF or ODF) are on that server. If not you could try similar adjustments as I did with "pdf.js" for my PDFViewer
shiftLock happens

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3639
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Importing from Word or HTML

Post by richmond62 » Sun Dec 23, 2018 5:45 pm

LibreOffice seems to offer rather more amenable export formats . . .

https://www.libreoffice.org/

Post Reply

Return to “Talking LiveCode”