hutelihut
asked on
Showing af Word-document
How do I show a Word-document in a form, without running the word-exe - in delphi3?
(maybe delphi 4 - but it would be better for me to now how to do it in delphi3).
(maybe delphi 4 - but it would be better for me to now how to do it in delphi3).
ASKER
shocking...
I thought it would be easy - like showing it in a OLE-container. I tried to do that, but only the first page was visible...
I thought it would be easy - like showing it in a OLE-container. I tried to do that, but only the first page was visible...
Showing an OLE-Container means starting Word in the background, so i thought that was not an option.
I think ultimately word/word viewer is required unless doc is saved in another format.
Just in case this helps with the OleContainer method you tried. I get all the doc's pages with this type of thing.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, Menus, StdCtrls, OleServer, Excel2000, OleCtnrs;
type
TForm1 = class(TForm)
Button1: TButton;
OleContainer1: TOleContainer;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
OleContainer1.AllowInPlace := True;
OleContainer1.AutoActivate := aaGetFocus;
OleContainer1.CreateObject FromFile(' c:\test.do c', False);
end;
procedure TForm1.Button1Click(Sender : TObject);
begin
OleContainer1.SaveAsDocume nt('c:\tes t.doc');
end;
end.
Regards,
Steve
Just in case this helps with the OleContainer method you tried. I get all the doc's pages with this type of thing.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, Menus, StdCtrls, OleServer, Excel2000, OleCtnrs;
type
TForm1 = class(TForm)
Button1: TButton;
OleContainer1: TOleContainer;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
OleContainer1.AllowInPlace
OleContainer1.AutoActivate
OleContainer1.CreateObject
end;
procedure TForm1.Button1Click(Sender
begin
OleContainer1.SaveAsDocume
end;
end.
Regards,
Steve
ASKER
SteveWaite:
The only problem is, that only the first page is visible in a tOleContainer, otherwise a tOleContainer would be usefull.
The only problem is, that only the first page is visible in a tOleContainer, otherwise a tOleContainer would be usefull.
hutelihut,
I tried the program that was suggested above by Steve. What you get on the first opener is text of black letters on a delphi olecontainer form colored background. What you need to know is to advance to other pages is to rightclick of the mouse on the olecontainer so that you get another very small menu. Click to open the 'open' choice. Now with changed view you can edit the document and save it as Steve's program directs with the button one click.
I did change this line in Steve's program above:
OleContainer1.SaveAsDocume nt('c:\Myt est.doc');
Delphi3
I tried the program that was suggested above by Steve. What you get on the first opener is text of black letters on a delphi olecontainer form colored background. What you need to know is to advance to other pages is to rightclick of the mouse on the olecontainer so that you get another very small menu. Click to open the 'open' choice. Now with changed view you can edit the document and save it as Steve's program directs with the button one click.
I did change this line in Steve's program above:
OleContainer1.SaveAsDocume
Delphi3
ASKER
When you click at the "Open"-choice, the container "starts" word, and alle the word-menues, and word-buttons and stuff shows up. That is not a great thing, but it can be done by the DoVerb-method.
The program I am making has to show a word-document on a projektor (I am not sure about what it's called in english, but you may ask), so it has be "clean".
The program I am making has to show a word-document on a projektor (I am not sure about what it's called in english, but you may ask), so it has be "clean".
ASKER
alle=all
sorry
sorry
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
listening
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept answer from Delphi3
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Paul (pnh73)
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Accept answer from Delphi3
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Paul (pnh73)
EE Cleanup Volunteer
Showing a Word document needs interpreting the Word file format which is not completely documented.