I have a system that integrates with MS-Word I can do almost everything in it, just can not open the document and leave it as read-only so that the user can not make modifications. Currently my code looks like this:
//Cria objeto principal de controle
try
with OleContainer do
begin
if OleObjectInterface <> Nil then
begin
DestroyObject;
end;
//Nome do arquivo usado para abrir o arquivo de entrevista
vNomeArquivo := DM.tbParamPASTA_BD.AsString+'\MODELOS\'+DM2.qryConsultasMODELO.AsString;
try
OleContainer.CreateObjectFromFile(vNomeArquivo, OF_READ);
OleContainer.DoVerb(ovShow);
Perform(WM_LBUTTONDBLCLK, MK_LBUTTON, 0);
except
//Fechar o arquivo
DestroyObject;
end;
end;
finally
Screen.Cursor := crDefault;
OleContainer.TabStop := False;
end;
PS: I do not want to open a document that has the ReadOnly attribute I want to prevent the user from changing the document type Protected mode Unrestricted