It would be beneficial for the clients if every cell has this "cached value" even if the formula can't be evaluated for some reason with the SpreadProcessing - no need for recalculation, just reading the value. It should read the last values while the document was being saved at the originator.
Getting a method like "GetCachedValueString ..." , ideal with the same formatting used for the cell and localization, would be helpful.
string fileName = "file.xlsm";
Telerik.Windows.Documents.Spreadsheet.Model.Workbook workbook;
IWorkbookFormatProvider formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsm.XlsmFormatProvider();
using (Stream input = new FileStream(fileName, FileMode.Open))
{
workbook = formatProvider.Import(input);
}
Incorrect calculation of UsedCellRange when conditional formatting is applied to a large cell range.
Workaround:
var usedCellRange = workbook.ActiveWorksheet.GetUsedCellRange(
CellPropertyDefinitions.AllPropertyDefinitions
.Except(
CellPropertyDefinitions.AllPropertyDefinitions.Where(p => p.Name == "DataValidationRule" || p.Name == "ConditionalFormatting")));
ArgumentException at Telerik.Windows.Documents.FormatProviders.OpenXml.Model.Elements.Theme.SystemColorElement.GetColor(IOpenXmlImportContext context)
The problematic value is val="windowText"
When an xlsm file is imported and then exported, a new ThisWorkbook object is created in the VBA browser. This creates issues when making VBA functions that have to be executed upon opening of the file.
Applying text format to a column also sets the format to the next column.
This happens when the columns have a size different from the default and two consecutive columns with different format also have the same size. This can be worked around with a slight change in the column sizes:
int columnCount = worksheet.UsedCellRange.ColumnCount;
for(int i = 1; i < columnCount; i++)
{
ColumnWidth colWidth = worksheet.Columns[i].GetWidth().Value;
if(colWidth.Value != SpreadsheetDefaultValues.DefaultColumnWidth)
{
ColumnWidth previousColWidth = worksheet.Columns[i - 1].GetWidth().Value;
if(colWidth.Equals(previousColWidth))
{
worksheet.Columns[i].SetWidth(new ColumnWidth(colWidth.Value + 1, colWidth.IsCustom));
}
}
}