I am not sure how and where you are trying to do this, but something like this should work :
==============================
CREATE(WordApp);
WordApp.Visible(TRUE);
FileName := 'Path to the file';
WordDoc := WordApp.Documents.Open(FileName);
WordDoc := WordApp.ActiveDocument;
WordApp.PrintOut(); // If you want to print it directly after
===============================
I have the same problem.
I want to create one command button 'Open File'.
When I click on that it should display the attachment directly without exporting it to hdd.
Can i do the same? if yes then how? I dont have the file path. i have only File name, file size, file data, content type. It can have any type of file.
So on export of the blob you can store the BLOB in environ('Temp') + '\' + YourFilename + '.' + FilenameExtension.
To know the File Extension you can save this extension in a separate field when you import the file.
For example:
FileDialog.DialogTitle := 'FilePath...';
FileDialog.Filter := '';
FileDialog.InitDir('C:\');
FileDialog.Filter('All (*.*)|*.*');
FileDialog.ShowOpen();
FileDialog.CancelError(FALSE);
IF (FileDialog.FileName <> '') THEN BEGIN
"Document Template".IMPORT(FileDialog.FileName,FALSE);
i := STRLEN(FileDialog.FileName);
WHILE FileDialog.FileName[i] <> '.' DO
i -= 1;
"File Extension" := COPYSTR(FileDialog.FileName,i,STRLEN(FileDialog.FileName)-i+1);
y := i;
WHILE FileDialog.FileName[i] <> '\' DO
i -= 1;
Description := COPYSTR(FileDialog.FileName,i+1,y-i-1);
CurrForm.SAVERECORD;
END;
Comments
==============================
CREATE(WordApp);
WordApp.Visible(TRUE);
FileName := 'Path to the file';
WordDoc := WordApp.Documents.Open(FileName);
WordDoc := WordApp.ActiveDocument;
WordApp.PrintOut(); // If you want to print it directly after
===============================
Good luck
Steeve Le Provost
http://www.steeve-leprovost.fr.cx
http://www.steeve-leprovost.fr.cx
I have the same problem.
I want to create one command button 'Open File'.
When I click on that it should display the attachment directly without exporting it to hdd.
Can i do the same? if yes then how? I dont have the file path. i have only File name, file size, file data, content type. It can have any type of file.
Please help me out.
Ahmedabad, Gujarat, India
E Mail : ravi.thakkar@hotmail.com
So on export of the blob you can store the BLOB in environ('Temp') + '\' + YourFilename + '.' + FilenameExtension.
To know the File Extension you can save this extension in a separate field when you import the file.
For example:
Regards
Thanks for your replies.
Recentaly I found one forum
viewtopic.php?f=23&t=3344
which solved my problem and the exact requirement.
Thanks to all.
Ahmedabad, Gujarat, India
E Mail : ravi.thakkar@hotmail.com