Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generic Way of Exporting General Field Contents to Files

Status
Not open for further replies.

albertdc

Programmer
Feb 10, 2004
38
PH
Our FPT file for the general field has already reach the 2GB limit of VFP.

We now need to dump these contents into free standing files and just have a memo field that would point to these files.

Note that types of the contents can be any of the ff:

Popular image format (BMP, JPG, GIF, PCX, TIFF)
PDF
DOC
HTM/HTML

How can this be done for each file type?

I read something about the "ghostscript approach" from another thread, but, I still haven't got a response whether that approach can handle the file types mentioned above.

We would really appreciate it if you can lend your expertise on this scenario.

Thank you very much for your help!
 
scottjlewis

...the "ghostscript approach"...

Ghostscript is a postscript interpreter and will output a postscript file created either by a postscript driver or programmatic means to variety of image file formats or .pdf file format.

DOC files would have to become a bitmap of your choice and thus become useless.

You would need a specialist ps2html conversion program to convert the postscript files to HTML, and the results will be inconsistent and unreliable.

HTML will work visually even with incorrectly paired tags but such errors creates nightmares for other programs to resolve.


FAQ184-2483 - answering getting answered.​
Chris [pc2]
 
Chris,

I think we want to lean towards having the output as PDF instead of BMP. As long as these contents can be dump into files, we'll go with that approach. Besides, we really don't normally edit the DOC file's contents once it is attached to the table, so its good to have those docs converted into a static format.

Thanks,

scottjlewis
 
Since the formats are:
Popular image format (BMP, JPG, GIF, PCX, TIFF)
PDF
DOC
HTM/HTML,
I'd opt to use the tools already availble to view them with.

[tt]
i.e. pdf - acrobat or olecontrol
htm - explorer or olecontrol
doc - word or rtf olecontrol
images - picture, ie, paint, or someother
[/tt]
You can view them all initiated by VFP and avoid
converting them into another format.

As far as getting them back out of the general fields,
you can either pull it from the fpt directly or
you can execute a saveas() command against a document
contained in an oleboundcontrol.

I have a general fpt dump program I'm currently finishing
which I'll post when done.

Here's an example of getting a MSWord document out of
a general field called temp.genfld. I haven't tried this
for all of the various file types but I assume it will
work for most.

It'll be a little slow, but it'll work.

Simple step through the table and output the
files to the appropriate locations with the
appropriate names.

Darrell

[tt]
o = CREATEOBJECT("clsSaveDoc")
o.oleDoc.SAVEAS(ADDBS(SYS(2023))+"ExportedFile.doc")

DEFINE CLASS clsSaveDoc AS FORM
* Form doesn't need to show
* we just need it for a container
* of the oleboundcontrol

ADD OBJECT oleDoc AS OLEBOUNDCONTROL WITH ;
CONTROLSOURCE = "temp.genfld"

ENDDEFINE
[/tt]


 
If you programaticly:

SCAN
MODIFY GENERAL FieldName
COPY
ACTIVATE EXPLORER
PASTE
ENDSCAN

Certain documents, such as PDF come out ready to go. Word Docs come out as a 'scrap' file, but a shellexecute() correctly launches them with word and you should be able to do a saveas. JPGs seem to be saved as BMPs... not sure what the behavior of other files might be, but it might be worth exploring.

Brian
 
Thank you guys for all your inputs!

darrellblackhawk, I still look forward in seeing that "general fpt dump program" of yours.

Again, thanks!
 
Still working on it. I need it myself.

So far, the code can parse a fpt file and pull all
of the memo, binary, and general field data out.

One of the problems is how VFP tags linked OLE objects
or just the actual file data, but I've figured it out
for a few formats.

Straight memo data is a piece of cake.

I've determined so far the differential for PDF's and a
number of image formats, but as would be expected, Word
might be a hassle. Plus, I'm a little concerned about the
legal ramifications of disclosing the internal structure of
proprietary data formats.

This started out as a general repair program for tables
and fpt files and has grown to include all types of other
functionality.

Currently, I'm rewriting the previous code base as abstract
class interfaces so it can be sub-classed for use in
multiple applications (basically an engine.)

Any ideas on features that would be nice?

Darrell
 
I have no idea to add so far. You've got most of 'em covered, it seems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top