public void RestoreLayoutFromXML(string xmlSettings) { string generetedFileName = String.Format("xmlSettins{0}save", DateTime.Now.Ticks); string fileName = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); fileName = String.Format(@"{0}\{1}.hos", fileName, generetedFileName); System.IO.File.WriteAllText(fileName, xmlSettings); if (InfoObject == InfoObjectType.GridView) { gridView.GridControl.ForceInitialize(); //layoutGridControl.MainView.RestoreLayoutFromXml(fileName); gridView.OptionsLayout.Columns.StoreAllOptions = true; gridView.OptionsLayout.StoreAppearance = true; gridView.RestoreLayoutFromXml(fileName, OptionsLayoutBase.FullLayout); } if (InfoObject == InfoObjectType.Pivot) { pivotGrid.ForceInitialize(); //pivotGrid.OptionsLayout.Columns.StoreAllOptions = false; //pivotGrid.OptionsLayout.Columns.RemoveOldColumns = true; DevExpress.XtraPivotGrid.PivotGridOptionsLayout pivotOptions = new DevExpress.XtraPivotGrid.PivotGridOptionsLayout(); pivotOptions.StoreAllOptions = true; pivotGrid.RestoreLayoutFromXml(fileName, pivotOptions); } System.IO.File.Delete(fileName); }
public string GetXMLSettings() { string xmlInString; string generetedFileName = String.Format("xmlSettins{0}save", DateTime.Now.Ticks); string fileName = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); fileName = String.Format(@"{0}\{1}.hos", fileName, generetedFileName); FileStream fs = File.Create(fileName); DevExpress.Utils.OptionsColumnLayout optionsColumnLayout = new DevExpress.Utils.OptionsColumnLayout(); //GridView Settings if (InfoObject == InfoObjectType.GridView) { gridView.OptionsLayout.StoreAllOptions = true; gridView.OptionsLayout.Columns.StoreAllOptions = true; gridView.OptionsLayout.StoreAppearance = true; gridView.OptionsLayout.Columns.RemoveOldColumns = false; gridView.SaveLayoutToStream(fs); } if (InfoObject == InfoObjectType.Pivot) { //pivotGrid.OptionsLayout.StoreAllOptions = true; DevExpress.XtraPivotGrid.PivotGridOptionsLayout pivotOptions = new DevExpress.XtraPivotGrid.PivotGridOptionsLayout(); pivotOptions.StoreAllOptions = true; pivotGrid.SaveLayoutToStream(fs, pivotOptions); } fs.Close(); xmlInString = System.IO.File.ReadAllText(fileName); System.IO.File.Delete(fileName); return(xmlInString); }