
Procedure FormClose(Sender: TObject var Action: TCloseAction) Windows, SysUtils, Variants, Classes, Controls, Forms, Dialogs, StdCtrls, If you are using Microsoft Word 2010, load its type library instead of Word 2007. Then you can use this sample code to load a MS Word file, and save it as PDF using the internal PDF converter. It remains open, however, just like any open file, until you close it.First import "Microsoft Word 12 Objects" (MS Word 2007) type library into your project by using Components | Import Components menu item. When you run your project, the template is not compiled or linked into the project. The Form Template opens, and you can view it or its associated unit source code, but it is not included in your project. PAS file that corresponds to the template you want to open. ■ To open a Form Template as a separate form and unit file,ġ Choose FilelOpen File to display the Open File dialog box.Ģ Switch to the \DELPHI\GALLERY directory, and select the. You can open a Form Template, or any form in any project, as a standalone form for reference purposes only, without adding the form to your current project. Opening a Form Template for reference only To save it as part of the project, save the open unit file under a different name (FilelSave File As). If you subsequently open a project or create a new project, the open template form is not part of that project. The form's unit file then opens as a reference file (see the following section). Note With no project open, it is still possible to choose FilelNew Form and select a Form Template from the Gallery. Any modifications you make do not affect the original template. You can customize it, add components and code to it, and so on. You can now use this form the way you would any form in a project. Note Depending on which templates have been installed, modified, or deleted in your Delphi installation, your Browse Gallery window for Form Templates might differ from that shown here.įigure 3.1 Standard Delphi Form Templates in the Browse GalleryĢ On the Templates page, use the arrow keys or the mouse to select the template you want to add, and choose OK.ĭelphi adds a copy of the template form and its associated unit file to the project you have open. (If another form has been specified as the Default New Form, that option is highlighted instead.)

The Browse Gallery dialog box appears, with the Blank Form option highlighted by default. ■ To add a template form to your project,ġ With a project open, choose FilelNew Form. For more information about saving forms as templates, see "Saving a form as a template" on page 93. You can also save any form you've designed as a template that gets installed into the Gallery. You can easily add any Form Template from the Delphi Browse Gallery to your application.
