LoadFromXml(Xml: String);
LoadFromXml(Xml: string);
Xml. The row in the XML format containing description of table styles.
The LoadFromXml method loads table styles from the row in the XML format.
To save table styles to the row in the XML format, use the ITabTableStyles.SaveToXml method.
Executing the example requires that the repository contains a regular report with the REG_REPORT_TAB identifier containing table styles. The file system must contain the C:\TableStyles.xml file containing table styles in the XML format.
Add links to the Metabase, Report, Tab, Xml system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Report: IPrxReport;
Tab: ITabSheet;
Style: ITabTableStyles;
StyleXml: String;
XML: FreeThreadedDOMDocument60;
Begin
mb := MetabaseClass.Active;
// Get table styles from file in the XML format
XML := New FreeThreadedDOMDocument60.Create;
XML.load("C:\TableStyles.xml");
StyleXml := XML.xml;
// Get regular report
Report := mb.ItemById("REG_REPORT_TAB").Edit As IPrxReport;
// Get table styles
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
Style := Tab.TableStyles;
// Load obtained styles
Style.LoadFromXml(StyleXml);
// Save changes
(Report As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the table styles for available report sheet are loaded from the C:\TableStyles.xml file.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.MsXml2;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
Report: IPrxReport;
Tab: ITabSheet;
Style: ITabTableStyles;
StyleXml: String;
XML: FreeThreadedDOMDocument60;
Begin
mb := Params.Metabase;
// Get table styles from file in the XML format
XML := New FreeThreadedDOMDocument60.Create();
XML.load("C:\TableStyles.xml");
StyleXml := XML.xml;
// Get regular report
Report := mb.ItemById["REG_REPORT_TAB"].Edit() As IPrxReport;
// Get table styles
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
Style := Tab.TableStyles;
// Load obtained styles
Style.LoadFromXml(StyleXml);
// Save changes
(Report As IMetabaseObject).Save();
End Sub;
See also: