Workbook.CloseAccessCache

Workbook.CloseAccessCache method

Closes the session that uses caches to access data.

public void CloseAccessCache(AccessCacheOptions opts)
ParameterTypeDescription
optsAccessCacheOptionsoptions of data access

Examples

// Called: wb.CloseAccessCache(AccessCacheOptions.ConditionalFormatting);
private void Workbook_Method_CloseAccessCache(Workbook wb)
        {
            wb.StartAccessCache(AccessCacheOptions.ConditionalFormatting);
            Cells cells = wb.Worksheets[0].Cells;
            for (int i = 0; i < 128; i++)
            {
                for (int j = 0; j < 16; j++)
                {
                    Cell cell = cells[i, j];
                    if (cell.StringValue[0] == 'D')
                    {
                        if (cell.GetDisplayStyle().Font.Size != 16)
                        {
                            StringBuilder sb = new StringBuilder();
                            sb.Append(cell.Name);
                            sb.Append(": should be formatted by conditional formatting but was not.\nPLEASE CHECK ");
                            sb.Append(Constants.destPath);
                            sb.Append("example.xlsx");
                            wb.Save(Constants.destPath + "example.xlsx");
                            Assert.Fail(sb.ToString());
                        }
                    }
                    else if (cell.GetDisplayStyle().Font.Size == 16)
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append(cell.Name);
                        sb.Append("example.xlsx");
                        sb.Append(Constants.destPath);
                        sb.Append("example.xlsx");
                        Assert.Fail(sb.ToString());
                    }
                }
            }
            wb.CloseAccessCache(AccessCacheOptions.ConditionalFormatting);
        }

See Also