Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Suppress an error in Tx Text Control
Message
From
07/04/2023 10:45:19
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
07/04/2023 10:28:20
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
01686463
Message ID:
01686464
Views:
61
>Hello,
>
>I am working on a utility which converts DOC files to PDF (using TxText Control 16) at the scheduled time. The problem is that it stuck at some files with an error message "Error in text filter: Unknown format. (1d01)". The utility is scheduled to run at night, no one is available to click on ok and continue the process. Is there any way to suppress the messagebox and just log the error in a file?

Rings a bell.. probably saved as .doc but actually in .docx format, so you can't trust the extension. This is what I had
	Procedure DocToPdf(toFile, tcTargetFile)
	Local loTx, lcFromFile, lnH, lcHeader, lnType, lnRet
	loTx=This.oTx
	lcFromFile=toFile.Path

* 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

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform