5
Some time ago I created a system that integrates the MS Word with the Delphi, only that the button of Save Word gets disabled.
It would be important that this button was enabled, because it is already saved in the place where the file was created. I’ll put the code of how I open the document.
procedure TfrmConsultas.btnCaregarClick(Sender: TObject);
var
OleContainer: TOleContainer;
begin
try
with OleContainer do
begin
if OleObjectInterface <> Nil then
begin
DestroyObject;
end;
//Nome do arquivo usado para abrir o arquivo de entrvista de Consulta
vNomeArquivo := 'Nome do Arquivo';
// Cria o Arquivo a partir do conteúdo de um arquivo de modelo.
try
// Código que deve ser tratado caso haja uma exceção
OleContainer.CreateObjectFromFile(vNomeArquivo, False);
OleContainer.DoVerb(ovPrimary);
OleContainer.DoVerb(ovShow);
OleContainer.DoVerb(ovUIActivate);
OleContainer.DoVerb(ovInPlaceActivate);
Perform(WM_LBUTTONDBLCLK, MK_LBUTTON, 0);
if (DM.tbConsultas.State in [dsInsert]) or
((DM.tbConsultasMODELO_ARQUIVO.AsString <> '') and
(cbbModelos.Text <> '')) or ((cbbModelos.Text <> '') and
(DM.tbConsultasMODELO_ARQUIVO.AsString = '')) then
FindAndReplace;
except
// Fechar o arquivo
DestroyObject;
end;
end;
finally
Screen.Cursor := crDefault;
end;
end;
After modifying the content I saved.
OleContainer.OleObject.SaveAs (FileName, wdFormatDocument, EmptyParam, EmptyParam, False);
- I want to know if you can activate this button
Already tried to check if you can there in toolbar customization?
– ProsTecnologia
You can save it with the command
WordDocument1.SaveAs(docdestino);
put on the exit button so the user already leaves saving.– Pr051573m
tried on startup of the program already direct this button as enabled? I don’t know your system anymore in Form.create put all the properties you want in the standard form enabled or not. I think it’s just that a successful hug.
– user113557
@user113557 the button of the image that is in question was not created by me it is word I have no way to enable you by putting
botao.doWord.enable := True
if you notice the image it is from the system.– Edu Mendonça
there is a
TOleContainer
that I bring the word screen.– Edu Mendonça