LoadStyleSheetFromXml(pStyleSheet: IStyleSheet, Xml: String);
LoadStyleSheetFromXml(pStyleSheet: Prognoz.Platform.Interop.Drawing.StyleSheetClass, Xml: string);
pStyleSheet. Collection of table formatting styles that should be loaded.
Xml. The row in the XML format containing description of the collection of table styles.
The LoadStyleSheetFromXml method loads the collection of table styles from the row in the XML format.
To save table styles to the row in the XML format, use the ITabSheet.SaveStyleSheetToXml method.
Executing the example requires that the repository contains a regular report with the REG_REPORT_TAB identifier containing connected external styles. The file system must contain the C:\StyleSheet.xml file containing table styles in the XML format.
Add links to the Drawing, Metabase, Report, Tab, Xml system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Report: IPrxReport;
Tab: ITabSheet;
Style: IStyleSheet;
StyleXml: String;
XML: FreeThreadedDOMDocument60;
Begin
mb := MetabaseClass.Active;
// Get collection of table styles from file in the XML format
XML := New FreeThreadedDOMDocument60.Create;
XML.load("C:\StyleSheet.xml");
StyleXml := XML.xml;
// Get regular report
Report := mb.ItemById("REG_REPORT_TAB").Edit As IPrxReport;
// Get collection of table styles
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
Style := (Tab.StyleSheet As IMetabaseObject).Edit As IStyleSheet;
// Load obtained styles
Tab.LoadStyleSheetFromXml(Style, StyleXml);
// Save changes
(Report As IMetabaseObject).Save;
(Style As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the collection of table styles for the available report sheet is 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.Drawing;
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: StyleSheetClass;
StyleXml: String;
XML: FreeThreadedDOMDocument60;
Begin
mb := Params.Metabase;
// Get collection of table styles from file in the XML format
XML := New FreeThreadedDOMDocument60.Create();
XML.load("C:\StyleSheet.xml");
StyleXml := XML.xml;
// Get regular report
Report := mb.ItemById["REG_REPORT_TAB"].Edit() As IPrxReport;
// Get collection of table styles
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
Style := (Tab.StyleSheet As IMetabaseObject).Edit() As StyleSheetClass;
// Load obtained styles
Tab.LoadStyleSheetFromXml(Style, StyleXml);
// Save changes
(Report As IMetabaseObject).Save();
(Style As IMetabaseObject).Save();
End Sub;
See also: