Hi,
I am loading the Excel template file which contains formatted table with headers with size of 14. Viewing the same data in the XamSpreadsheet control results in oversized font in multiple worksheets.
As a workaround we tried to apply default normal styles and override this for each workbook manually:
public Workbook ApplyTo(Workbook workbook) { ApplyTo(workbook.Styles.NormalStyle); ApplyTo(workbook.Worksheets); } private void ApplyTo(WorkbookStyle style) => ApplyTo(style.StyleFormat.Font); private void ApplyTo(IWorkbookFont font) { font.Name = mFontName; font.Height = mFontHeightTwips; } private void ApplyTo(WorksheetCollection sheets) { foreach (var sheet in sheets) { sheet.DefaultRowHeight = mFontHeightTwips + FONT_HEIGHT_TO_ROW_HEIGHT_OFFSET; if (sheet.Rows.Any()) sheet.Rows[0].CellFormat.Font.Height = mFontHeightTwips; } }
However, this has a side affect which results in applying all possible worksheet columns as result manual processing of all data takes ages to process since unused columns becoming as changed and resulting in column count of 16384 when querying number:
var columnCount = mWorksheet.UsedRange.Columns.Count
How to fix the problem with applying change to real cells or use different approach to change style to reduce Font size from 14 to smaller number?
Example of oversized text in cells:
Hello and thank you for contacting Infragistics. Please attach a sample Excel file that reproduces the behavior in the Infragistics Spreadsheet.
Hi Michael,
It is a bit hard to write sample since too much code involved due XML conversion to Excel and then back again. Anyway, I found a workaround to limit apply style to only used columns since we have a fixed column count for each worksheet. However, there is a lot of the problems related to the changes to the rows causing explosion of the columns causing to change column count and slowing down processing. Another similar type problem is the Clipboard copy of row which is also very slow due taking too many columns. In all cases we need to implement every time a workaround and limit to used columns.
So it is generic question why column count is incorrect. Maybe it is wrong property where the column detection used incorrectly for such a cases?
I don't think UsedRanges is our property, its not listed in our API. tab. The Tables collection which stores each table does a Columns collection .
eg.
www.infragistics.com/.../infragisticswpf.documents.excel~infragistics.documents.excel.worksheettable~columns
You are right, my copied property comes from Excel Application. I've created simple solution reproducing problem with scrollbar.
To test it please fallow steps:
SpreadsheetStyleApplyProblem.zip
I have created a private support case for you. It has an ID of C-00229564, and you can access it after signing into your account on the Infragistics website, here: account.infragistics.com/support-cases.