Page 1 of 1
Importing from Word or HTML
Posted: Fri Dec 21, 2018 10:35 pm
by kaveh1000
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.
Re: Importing from Word or HTML
Posted: Fri Dec 21, 2018 11:15 pm
by FourthWorld
Is exporting RTF from Word an option?
Re: Importing from Word or HTML
Posted: Fri Dec 21, 2018 11:33 pm
by kaveh1000
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.
Re: Importing from Word or HTML
Posted: Fri Dec 21, 2018 11:36 pm
by FourthWorld
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/
Re: Importing from Word or HTML
Posted: Sun Dec 23, 2018 3:04 pm
by [-hh]
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
Re: Importing from Word or HTML
Posted: Sun Dec 23, 2018 5:45 pm
by richmond62
LibreOffice seems to offer rather more amenable export formats . . .
https://www.libreoffice.org/