I adapted the example "CreateModifyExport" in xaml-sdk to create a workbook then export it via XlsxFormatProvider. This works fine except that when I open the exported file in Excel 2013 (64 bit) there are no gridlines visible. Maybe I missed something but there is no code where gridlines are enabled/disabled.
Second issue is that AutoFitWidth is not working correctly, the column width does not fit the text.
7 Answers, 1 is accepted
Thank you for contacting us.
As you may see on this link to the SDK example the normal style of the workbook is modified as a solid fill is applied to it. This way the default style of the cells will have this fill applied. As the fills layer is above the layer this results in hiding the .
If you want to have both cell background and border lines you can set some borders to the normal style. As the borders layer is above the fills layer the borders will be visible above the . The following code snippet shows how you can achieve that:
As for the AutoFitWidth issue - this issue is fixed in the current version of RadSpreadProcessing. If you upgrade to the latest SP version the AutoFitWidth method should be working as expected.
I hope this is helpful. If you have any other questions or concerns please do not hesitate to contact us again.
the Telerik team
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop , hybrid and native mobile apps.
The AutoFitWidth issue I will check later.
[quote]As for the AutoFitWidth issue - this issue is fixed in the current version of RadSpreadProcessing. If you upgrade to the latest SP version the AutoFitWidth method should be working as expected.[/quote]
Is it really fixed? I use version 2016.2.606.45 and I have to manually increase the width after the call to AutoFitWidht. Otherwise, the column is to small to fit the content. Tested with Excel 2016
We are not aware of any issues related to the AutoFitWidth method.
Could you share with us what is the text in the cells where you observe the issue related to AutoFitWidth? Also, could you share all properties which you set to the cell? This will help us reproduce the issue and fix it.
Telerik by Progress
The issue is easy to reproduce, I made you a simplified example.
The problem is worst when the content is larger.
Code without the line numbers... I wanted to edit the other one but it seems it is not possible :(
I believe this issue is related to the way Excel renders the text inside the cells. In the following paragraphs, I will try to explain in more details how the values for the column width should be calculated.
The width of the columns in XLSX file is stored as a value whose measurement unit is the number of characters that can fit the column. In the document format specification, there is a formula used for calculating the width of a character. The width of a single character is the maximal width of the digits from 0 to 9 measured with the settings of the normal style (like font family, font size, etc.).
For example, one character has 8 pixels width in the default Normal style in Excel 2016. If we have text which is 80 pixels wide, its width in Excel units will be around 10.
In other words, the column width is strongly coupled with the text length. If you do not change the font properties of the Normal style, this width will have the same visual representation no matter the scale factor for instance. If you scale the text which is 80 pixels to 200%, it will become 160 pixels wide, but also the width of one character will be 20 pixels and the width in Excel units will be still 10.
Knowing how the column widths are measured we can make an experiment using Excel. We set "This value is really really large!" value to cell A1 and "test" value to cell B1. Double clicking the column A1 border auto fits the column width. After that, we change the scale factor. As a result of the changed scale factor, the text in the first cell changes its size relatively to the column size and at 80% scale factor it gets clipped by cell B1. This means that in some cases Excel does not render the text with the right size.
RadSpreadsheet uses the RadSpreadProcessing as its model and you can see the document generated by your code. I have compared the text width in Excel 2016 and in RadSpreadsheet at different scale factors and they are different most of the time. But at 80% scale factor, the difference is about 4 pixels.
I have attached the video from my tests with Excel where you can see that its auto fit causes the cell content to be clipped.
Telerik by Progress