LoadFromFile(FileName: String);
LoadFromFile(FileName: String);
FileName. Path and name of the file that should be loaded into the document.
The LoadFromFile method loads the file passed by the FileName parameter into the document.
This method automatically saves the loaded file in the database before calling the IMetabaseObject.Save method.
Executing the example requires a form with the Button1 button, the Image_1.jpg file located in the root of disc C, a repository object with the IMAGE identifier.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
Doc: IDocument;
Begin
MB := MetabaseClass.Active;
Doc := MB.ItemById("IMAGE").Edit As IDocument;
Doc.LoadFromFile("C:\Image_1.jpg");
End Sub Button1OnClick;
After executing the example and clicking the button the Image_1.jpg file is loaded to the IMAGE repository object.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.KeFore;
...
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
MB: IMetabase;
Doc: IDocument;
Begin
MB := Self.Metabase;
Doc := MB.ItemById["IMAGE"].Edit() As IDocument;
Doc.LoadFromFile("C:\Image_1.jpg");
End Sub;
See also: