we are working with Delphi 7, SQL server 2008 and MS word 2003. now we are planning to migrate MS word 2003 to MS word 2016.
in our application we will load the document(BLOB field) from database and save it into .tmp file and then we will open the document using TOleContainer in Delphi7.
above process is working fine for .doc and it is not working for .docx. we are able to replicate the issue with below example
- create the .docx file
- open .docx file and enter some text and save and close
- rename the .docx to .tmp
- open the .tmp file using TOleContainer(Below Delphi code)
Delphi Code:
procedure TForm1.FormShow(Sender: TObject);
begin
WordOleContainer.AllowInPlace := True;
WordOleContainer.CreateObjectFromFile('F:\WordViewerTest\docx.tmp', False);
end;
when we run the application we are getting below error.if we click on open document is getting opened in another window, not in olecontainer.
if i double click on .tmp file, it is opening with out any warning. if i use the above delphi code it is showing warning. how to make above code work?
GetClassFile
returns specific class ID even if you change the extension (even on my computer, Office 2007, FYI). – Victoria