SaveToXml: String;
SaveToXml(): string;
The SaveToXml saves table cell style to the row in the XML format.
To load the table cell style from the row in the XML format, use the ITabCellStyle.LoadFromXml method.
Executing the example requires that the repository contains a regular report with the REG_REPORT_TAB identifier.
Add links to the Metabase, Report, Tab, Xml system assemblies.
Sub UserProc;
Var
mb: IMetabase;
Report: IPrxReport;
Tab: ITabSheet;
Range: ITabRange;
Style: ITabCellStyle;
StyleXml: String;
XML: FreeThreadedDOMDocument60;
Begin
mb := MetabaseClass.Active;
// Get regular report
Report := mb.ItemById("REG_REPORT_TAB").Bind As IPrxReport;
// Get cell style
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
Range := Tab.Cell(0, 0);
Style := Range.Style;
// Save cell style to file in the XML format
StyleXml := Style.SaveToXml;
XML := New FreeThreadedDOMDocument60.Create;
XML.loadXML(StyleXml);
XML.save("C:\Style.xml");
End Sub UserProc;
After executing the example the first cell style on the available report sheet is unloaded to the C:\Style.xml file in the |XML format.
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;
Range: ITabRange;
Style: ITabCellStyle;
StyleXml: String;
XML: FreeThreadedDOMDocument60;
Begin
mb := Params.Metabase;
// Get regular report
Report := mb.ItemById["REG_REPORT_TAB"].Bind() As IPrxReport;
// Get cell style
Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
Range := Tab.Cell[0, 0];
Style := Range.Style;
// Save cell style to file in the XML format
StyleXml := Style.SaveToXml();
XML := New FreeThreadedDOMDocument60.Create();
XML.loadXML(StyleXml);
XML.save("C:\Style.xml");
End Sub;
See also: