Hi,
What I am trying to do is to save a Word doc into a blob field and extract back to a file to read using Word. Easy ...! :shock: :arrow: :arrow:
The file resulted is corrupted:
// - Save a Word Document in a Blob File
// Update the BLOB Field (Document) in the Table
FI.OPEN(strPath); // My Word Doc File
FI.CREATEINSTREAM(NVInStream);
Document.CREATEOUTSTREAM(NVOutStream);
WHILE NOT (NVInStream.EOS()) DO BEGIN
Written := NVInStream.READ(readVar,250);
NVOutStream.WRITE(readVar,250);
END;
// I am extracting the Blob file back to the harddisk
// (Word Doc) saved previous
CALCFIELDS(Document);
FO.CREATE('C:\MyDoc.Doc');
FO.CREATEOUTSTREAM(NVOutStream);
Rec.Document.CREATEINSTREAM(NVInStream);
WHILE NOT (NVInStream.EOS()) DO BEGIN
Written := NVInStream.READ(readVar,250);
NVOutStream.WRITE(readVar,250);
END;
FO.CLOSE();
// The file resulted is corrupted - Word faills to open and the new size of the file created is greather then the original
// Something I am doing wrong but I don't know what.
Thanks,
Marcel
0
Comments
I had a case a time ago, that only few document got corrupted. The rest of the docs work fine after exporting.
btw, I'll try to find out if the guy who made that import export thingy did it the same way you did.
If it was hard to write, it should be hard to understand."
I have the same problem with excels files and bitmaps and ....
I dont know where is inserting extra characters when I save in the blob or when I save back from blob.
Thanks for your reply,
Marcel