Hi there,
It appears that TextAlignmentType enum in Aspose.Cells changed its values … .
Please compare values from Assembly Aspose.Cells, Version=20.6.0.0 which are:
public enum TextAlignmentType
{
Bottom = 0,
Center = 1,
…
}
with Assembly Aspose.Cells, Version=22.5.0.0 which are:
public enum TextAlignmentType
{
Bottom = 528,
Center = 1802,
…
}
This is kind of unexpected.
Is there a built in function which would map old one into new?
Yes, it looks TextAlignmentType enum members’ values are changed in newer versions. I am afraid, we don’t have such mapping function to compare or match older values to newer ones. Do you find any issue with updated values of enum members?
Well, yes, big time. We built our own “reports” module with Aspose engine and we allow users to customize report properties - like a field horizontal alignment for example. This data is then serialized to Json and saved in db. So, if a report had alignment set to “center” which used to be 1 now, after report loads becomes “left”.
I am afraid, you have to adjust older values with newer values for enum members in your code accordingly.
For defined constants of type enum, they should be used only by the defined name. We can only make sure that those names(and the combination of them if the enum is “Flags”) work in the same way for different versions. For values of the constants in enum, sometimes we need to change them according to requirements of updated models or improvements.
For your situation, we think you may keep your JSON data no change, but add one mediated layer in your application to map the int values in JSON data to defined names of enum TextAlignementType, and vice versa. This way will make your application work always no matter how this enum’s defined values have been changed.
This is what I did.
Still, it came as a surprise that enums have changed.
After all, it is a part of public interface.
Anyhow, thank you for your help.
Do you have a list of enums you changed recently?
It appears that other formatting features do not work as they used to … .
We will check if could provide you list having changed enums with their values.
Could you please elaborate it and provide sample code and template file to show the issue, we will check it soon.
Between 20.6 and 22.5, we only found another one enum whose defined constants has been changed and may influence the formatting feature:
StyleModifyFlag
Please check whether it is the root cause of your current problem. If so, please update your map accordingly.