unit WPToolsEmbeddedControl;
{ Wordprozessor für Delphi
Komponente die TWPRichText und die Lineale in einem Panel erzeugt
WPTools: https://www.wpcubed.com
}
interface
uses System.Classes,
VCL.Controls,
VCL.ExtCtrls, WPCtrRich, WPRuler;
type
TDelphiWord = class(TPanel)
private
fWPRichText : TWPRichText;
fWPRuler : TWPRuler;
fWPVertRuler : TWPVertRuler;
protected
procedure Resize; override;
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
function Load(Filename : String) : Boolean;
property WPRichText : TWPRichText read fWPRichText;
end;
procedure Register;
implementation
{ TDelphiWord }
constructor TDelphiWord.Create(AOwner: TComponent);
begin
inherited;
fWPRichText := TWPRichText.Create(Self);
fWPRuler := TWPRuler.Create(Self);
fWPVertRuler := TWPVertRuler.Create(Self);
fWPRichText.WPRuler := fWPRuler;
fWPRichText.VRuler := fWPVertRuler;
fWPRichText.Align := alClient;
fWPVertRuler.Align := alLeft;
fWPRuler.Align := alTop;
fWPRuler.Options := fWPRuler.Options - [wpNoVertRulerAttached];
fWPRichText.Parent := Self;
fWPRuler.Parent := Self;
fWPVertRuler.Parent := Self;
end;
destructor TDelphiWord.Destroy;
begin
fWPRichText.Parent := nil;
fWPRuler.Parent := nil;
fWPVertRuler.Parent := nil;
fWPRichText.Free;
fWPRuler.Free;
fWPVertRuler.Free;
inherited;
end;
function TDelphiWord.Load(Filename: String): Boolean;
begin
Result := fWPRichText.LoadFromFile(Filename, true, 'AUTO');
end;
procedure TDelphiWord.Resize;
begin
inherited;
fWPRuler.VertRulerWidth := fWPVertRuler.Width;
end;
procedure Register;
begin
RegisterComponents( 'Delphi Word', [TDelphiWord]);
end;
end.