Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RTF to HTML converter
Message
De
31/12/2013 12:07:43
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01591091
Message ID:
01591180
Vues:
55
>Thank you, Dragan. Most probably, I'll go with the Tx Control, even though it seems like an overkill for what I need. I was hoping for a no UI, straight RTF to HTML converter that I could invoke and execute behind the scenes. I'll look more into the Tx control; perhaps I could make better use of its editing functionality, as well.

I'm using it without any GUI for this conversion. I have added it to a form, though, for other cases when I may use it (but then didn't), and I of course had to subclass it, but beyond that point it's rather simple.

Here's the extract from the code:
* check for docx
	lnH=Fopen(lcFromFile,10)
	lcHeader=Fread(lnH, 2)
	Fclose(lnH)
* signature of Phil Katz means this is a zip, i.e. a zipped directory structure of xml files, i.e. a docx

*!*	Constant  Description
*!*	1 - ANSI text  Text in Windows ANSI format (an end of a paragraph is marked with the control characters 13 and 10).
*!*	2 - TX text  Text in ANSI format (an end of a paragraph is marked only with the control character 10).
*!*	3 - TX  Text including formatting attributes in the internal Text Control format. Text is stored in ANSI.
*!*	4 - HTML  HTML format (Hypertext Markup Language).
*!*	5 - RTF  RTF format (Rich Text Format).
*!*	6 - Unicode text  Text in Windows Unicode format (an end of a paragraph is marked with the control characters 13 and 10).
*!*	7 - TX text  Text in Unicode format (an end of a paragraph is marked only with the control character 10).
*!*	8 - TX  Text including formatting attributes in the internal Text Control format. Text is stored in Unicode.
*!*	9 - Microsoft Word 97-2003  Microsoft Word 97-2003 format (*.doc).
*!*	10 - XML  XML format (Extensible Markup Language).
*!*	11 - CSS  CSS format (Cascading Style Sheet).
*!*	12 - Adobe PDF
*!*	13 - Microsoft Word  Microsoft Word format (*.docx).

	lnType=Icase(lcHeader="PK", 13, 9)

	loTx.Load(lcFromFile, 0, lnType)
	lnRet=loTx.Save(tcTargetFile, 0, 12)
	This.nDocCnt = This.nDocCnt + 1
	If lnRet=0
		This.oLog.Log("PDF maker reports error ")
	Endif
	loTx.ResetContents()
	Return lnRet>0
You'd have different last parameters in .save() and .load(), but that's it.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform