SaveToFile(FileName: String);
FileName is a path and name of the file in which the saving is implemented. If the file already exists, it will be overwritten.
The SaveToFile method saves the document contents into the file on the disk. Path and name of the saving file is passed by the FileName parameter.
Executing the example requires the Document object with the Document_1 identifier in repository.
Sub Main;
Var
MB: IMetabase;
Doc: IDocument;
s, Name: String;
i: Integer;
Begin
MB := MetabaseClass.Active;
Doc := MB.ItemById("Document_1").Bind As IDocument;
s := Doc.FileName;
i := s.LastIndexOf("\");
Name := s.SubString(i + 1, s.Length - i);
Doc.SaveToFile("c:\" + Name);
End Sub Main;
After executing this example the file contained in the Document_1 document is saved in the root of disk C.
See also: