Posted 13 June 2018, 12:42 pm EST
With TrueDBGrid it is rather easy. With flexGrid I just cant find howto save the layout of the columns (order, width, … ) the user has made and then restore it
Please help.
Forums Home / ComponentOne / WinForms Edition
Posted by: andreas.kren on 13 June 2018, 12:42 pm EST
Posted 13 June 2018, 12:42 pm EST
With TrueDBGrid it is rather easy. With flexGrid I just cant find howto save the layout of the columns (order, width, … ) the user has made and then restore it
Please help.
Posted 13 June 2018, 1:42 pm EST
Found “BuildString” and “ParseString” methods in the “cols” collection.
Not very intuitive, no mentioning in the doc… :-/
Posted 14 June 2018, 4:30 am EST
Hi,
those methods might do too much, because they contain the full column definitions. If you add new columns in the app (or change e.g. the data type), then old user settings might kill those new columns. Better don’t use those methods for layout persisting ;-).
You will have to use custom code to achieve this.
Best regards
Wolfgang
Posted 14 June 2018, 4:46 am EST
Hello!
Thanks Wolfgang.
And yes Andreas, BuildString and ParseString methods of C1FlexGrid are used to save and restore complete description of the column collection. Here are the corresponding help links :
However, please take care of the additional point mentioned by Wolfgang while using these.
Furthermore, I would like to suggest you another way to save and restore layouts (a workaround that may suit your requirements) :
c1FlexGrid1.SaveGrid(@"..\..\Layout.xml", FileFormatEnum.Excel, FileFlags.OpenXml);
c1FlexGrid1.LoadGrid(@"..\..\Layout.xml", FileFormatEnum.Excel, FileFlags.OpenXml);
c1FlexGrid1.Clear(ClearFlags.Content);
c1FlexGrid1.Clear(ClearFlags.UserData);
In case you face any issue, please let us know.
Best regards,
Meenakshi
Posted 14 June 2018, 4:56 am EST
Hi Meenakshi,
thank you for your answer.
Posted 14 June 2018, 4:57 am EST
Hallo Wolfgang, jederzeit auch gerne direkt auf Deutsch, andreas.kren@wizardsoftware.at. Du scheinst ja jede Menge Erfahrung mit C1 zu haben. Die Geschwindigkeit des Supports läßt mich als Mitteleuropäer, der , wenn überhaupt, weil Kundeneinsatz, dann jetzt, etwas braucht ein bisschen verzweifeln.
For the rest. I (most often) just need simple column layout saving (buildstring(false)) and restoring and thats working.
Thank you Wolfgang
Posted 15 June 2018, 8:08 am EST
Tja, wir haben leider keinen Platinsupport dazugekauft :-(. Aber der Support ist deutlich besser als vor ein paar Jahren, mittlerweile bekommt man innerhalb eines Tages brauchbare Hilfe ;-).
Wolfgang