unvell / ReoGrid

Fast and powerful .NET spreadsheet component, support data format, freeze, outline, formula calculation, chart, script execution and etc. Compatible with Excel 2007 (.xlsx) format and working on .NET 3.5 (or client profile), WPF and Android platform.
https://reogrid.net
MIT License
1.32k stars 390 forks source link

preserve Cell, Row and Column TAGS during Save and Load #496

Open CanadianHusky opened 1 year ago

CanadianHusky commented 1 year ago

Describe the feature

Currently worksheet.Save and .Load methods with FileFormat.ReoGridFormat save and load worksheet data in XML format. The xml contains additional data about row/column size and borders etc.

Would it be possible to include Cell, Row and Column TAG object serialization into the RGF Format and preserve all object tags during Load and Save operation ? In my scenario the tags will contain certain business objects which are not represented visually, but are needed for the functionality.

I would imagine the following options and functionality:

    Public Delegate Function TagSerializer(Of T)(input As T) As String
    Public Delegate Function TagDeSerializer(Of T)(xmlstring As String) As T

all the Grid Save/Load functions would do is check if a Tag objects exists, and if it does pass in the Object to the Serializer Delegate, get a string back and write that as an XML Attribute. What the serialized content is does not matter. The user function would be responsible for deserialization. So even a JSON String could be used which is leaner than XML

In the generated XML it could look like this

<cells>
    <cell row="0" col="0" tag="xml or json string for cell tag">Test1</cell>
 </cells>

same for rows and columns

<rows>
    <row row="4" height="52" last-height="20" auto-height="false" tag="xmlstring" />
 </rows>
  <cols>
    <col col="1" width="128" last-width="70" tag="xmlstring"/>
  </cols>

Which edition of ReoGrid is targeted

The control is brilliant and a hidden gem. Thank you for the great work and Best Regards