HOSTING ONLY - FpSpread DataSource Font Case Not Preserved

349 Views Asked by At

.NET Framework 4.5.2

OS: Windows Server 2012 RS Standard

IIS: 6.2

Application Pool: .NET CLR Version v.4.0.30319

Managed Pipeline Mode: Integrated

Spread.NET Version: 11.45.20183.0

NOTES: The problem below ONLY occurs when hosted in IIS from our web-server. It does NOT occur when hosted through IIS Express (v.10.0.18362.1) on my local machine. I'm able to debug this problem while attaching to the running IIS process ID from Visual Studio on the web-server.

ISSUE: We have some logic that checks for changes in the Datasource which has been bound to the FpSpread control. If changes are detected we then pull out the cell values where a delta exists. There are no problems with the code detecting changes; however, there is a problem with the result returned.

Example Code:

public static DataTable getUpdatedGrid(FpSpread FpExcel, DataTable beforeDt)
{
    FpExcel.SaveChanges();
    if (FpExcel.Columns.Count == beforeDt.Columns.Count)
    {
        // No added headers. HasChanges does not track added headers.
        if (((DataSet)FpExcel.DataSource).HasChanges())
        {
            DataTable changes = ((DataSet)FpExcel.DataSource).GetChanges().Tables[0];

        etc...

The code above works as expected, it detects the change and makes it to the "DataTable changes" statement. The only problem is the value doesn't reflect the change the user made if that change involved changing the case. For example if the user tries to change a cell from "Click" to "click" the "HasChanges" condition will evaluate to "true"; however, the value remains "Click."

Below is a screenshot where the user attempted to change a cell value from "False" to "false". As you can see the case was preserved and not altered.

Again this only happens when the user tries to change the case of the cell value. Changing the value to something completely new works as expected.

enter image description here

As mentioned prior this only happens when hosted in IIS. Also the dataset bound to the control has "CaseSensitive" set to "true", as noted in the screenshot below:

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

We found the cause and a solution. After looking at additional instances of published code it turns out that this issue is somewhat intermittent, but it seemed to be fairly consistent when cell values equal True or False.

In our solution we are doing a lot of cell formatting prior to binding. Part of this logic involved setting the CellType for all columns to TextCellType, example below.

TextCellType txt = new TextCellType();
txt.AllowWrap = false;
txt.Multiline = true;
FpExcel.Columns[0, FpExcel.Columns.Count - 1].CellType = txt;

This code works but it gave us the false assumption that this "type" wouldn't be overridden by any other logic.

Apparently this assumption turned out to be somewhat incorrect as it seems like cells with a certain value intermittently have their changes suppressed, as mentioned above with True/False. This lead us to the DataAutoCellTypes method, which by default is True. By setting DataAutoCellTypes to False, using the statement below, our issue disappeared.

FpExcel.Sheets[0].DataAutoCellTypes = false;