RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomLocateFileService.GetTemplateStream Method

Returns a stream from which to read a template file.

Pascal
function GetTemplateStream(AComponent: TComponent; AFileName: string; out AOwned: Boolean): TStream;
C++
__fastcall TStream GetTemplateStream(TComponent * AComponent, AnsiString AFileName, Boolean AOwned);

Producer components call GetTemplateStream to read the contents of the template files they use to generate their content. GetTemplateStream locates the specified template file (which can be a logical rather than a physical file name), and returns a stream from which the caller can read the file contents. 

GetTemplateStream calls the ImplGetTemplateStream method, which generates first an OnFindStream event, and, if OnFindStream is unsuccessful, an OnFindTemplateFile event. 

AComponent is the object that uses or is associated with the requested template. Typically, this is a content producer. 

AFileName is the logical name of the file to locate. 

AOwned indicates whether the caller should free the stream after reading the file contents. When AOwned returns true, the caller should free the stream object. When AOwned returns false, the caller should not free the stream object. 

GetTemplateStream returns a stream from which to read the requested file, or, if it could not locate the file, nil (Delphi) or NULL (C++). 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!