SaveToXml(Element: Variant);
SaveToXml(Element: object);
Element. Object to which calendar parameters are saved as XML code.
The SaveToXml method loads calendar parameters to XML code.
Use the ICalendarSetup.LoadFromXml method to upload parameters from XML code.
Executing the example requires calendar dictionary with the CALENDARSETUP identifier. Add links to the Dimensions, Metabase and Xml system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Calendar: ICalendarDimension;
CalendDimInst: IDimInstance;
DynamicCalendInst: IDynamicCalendarInstance;
Setup: ICalendarSetup;
Node: IXmlDomElement;
DestXML: FreeThreadedDOMDocument60;
Begin
mb := MetabaseClass.Active;
Calendar := mb.ItemById("CALENDARSETUP").Bind As ICalendarDimension;
CalendDimInst := Calendar.OpenAs(CalendarOpenType.Flat);
DynamicCalendInst := CalendDimInst As IDynamicCalendarInstance;
Setup := DynamicCalendInst.NewSetup;
DestXML := New FreeThreadedDOMDocument60.Create;
Node := DestXML.createElement("Root");
DestXML.appendChild(Node);
Setup.SaveToXml(Node);
DestXML.save("C:\CalendarSetup.xml");
End Sub UserProc;
After executing the example default settings of the CALENDARSETUP dictionary are saved to the XML document C:\CalendarSetup.xml.
Executing the example requires calendar dictionary with the CALENDARSETUP identifier.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.MsXml2;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Calendar: ICalendarDimension;
CalendDimInst: IDimInstance;
DynamicCalendInst: IDynamicCalendarInstance;
Setup: ICalendarSetup;
Node: IXmlDomElement;
DestXML: FreeThreadedDOMDocument60;
Begin
mb := Params.Metabase;
Calendar := mb.ItemById["CALENDARSETUP"].Bind() As ICalendarDimension;
CalendDimInst := Calendar.OpenAs(CalendarOpenType.caoptyFlat);
DynamicCalendInst := CalendDimInst As IDynamicCalendarInstance;
Setup := DynamicCalendInst.NewSetup();
DestXML := New FreeThreadedDOMDocument60.Create();
Node := DestXML.createElement("Root");
DestXML.appendChild(Node);
Setup.SaveToXml(Node);
DestXML.save("C:\CalendarSetup.xml");
End Sub;
After executing the example default settings of the CALENDARSETUP dictionary are saved to the XML document C:\CalendarSetup.xml.
See also: