Q&A

  • ms-word 파일을 델파이에서 열어보려면요?
단순히 MS Word 문서 (.DOC)를 열어보는 방법을 알고 싶습니다.

excel 파일은 되는데 word능 어떻게 열어보나요?

어디가면 source를 볼수 있나요?
1  COMMENTS
  • Profile
    이광철 2003.09.03 19:10


    delphi 7입니다.

    open하는 방법
    procedure TForm1.Button1Click(Sender: TObject);
    var
      aFileName, aConfirmConversions, aReadOnly, aAddToRecentFiles, aPasswordDocument,
      aPasswordTemplate, aRevert, aWritePasswordDocument, aWritePasswordTemplate,
      aFormat, aEncoding, aVisible: OleVariant;

    begin
      WordApplication1.Visible := true;
      WordApplication1.Connect;

      aFileName := ExtractFilePath(Application.ExeName)+'실험문서.doc';
      aConfirmConversions := true;
      aReadOnly := false;
      aAddToRecentFiles := true;
      aRevert := true;
      aFormat := wdOpenFormatAuto;
      aPasswordDocument      := '';
      aPasswordTemplate      := '';
      aWritePasswordDocument := '';
      aWritePasswordTemplate := '';
      aEncoding := false;
      aVisible := true;

      WordDocument1.ConnectTo(
        WordApplication1.Documents.Open(aFileName,
                                        aConfirmConversions,
                                        aReadOnly,
                                        aAddToRecentFiles,
                                        aPasswordDocument,
                                        aPasswordTemplate,
                                        aRevert,
                                        aWritePasswordDocument,
                                        aWritePasswordTemplate,
                                        aFormat,
                                        aEncoding,
                                        aVisible));
    end;

    close하는 방법

    procedure TForm1.Button2Click(Sender: TObject);
    var
      aSaveChanges, aOriginalFormat, aRouteDocument : OleVariant;

    begin
      aSaveChanges    := False;
      aOriginalFormat := EmptyParam;
      aRouteDocument  := EmptyParam;
      WordApplication1.ActiveDocument.Close(aSaveChanges,
                                            aOriginalFormat,
                                            aRouteDocument);

      WordApplication1.Disconnect;
      WordApplication1.Quit;
    end;