Can Grow in Excel Output

Stimulsoft Reports.NET discussion
Post Reply
ginnifer.johnson
Posts: 24
Joined: Tue Oct 12, 2021 2:45 pm

Can Grow in Excel Output

Post by ginnifer.johnson »

Is there a way to fix this (see screenshot) in an Excel Output? Word Wrap and Can Grow are set to true. I need the cells to increase in size based on the amount of information. Sample data and report attached.
WordWrapCanGrowPic.png
WordWrapCanGrowPic.png (73.41 KiB) Viewed 425 times
Attachments
WordWrapCanGrowInExcelResults.xlsx
(6.25 KiB) Downloaded 5 times
WordWrapCanGrowInExcelOutputReport.mrt
(34.16 KiB) Downloaded 5 times
WordWrapCanGrowInExcelOutput.csv
(3.84 KiB) Downloaded 5 times
Lech Kulikowski
Posts: 7691
Joined: Tue Mar 20, 2018 5:34 am

Re: Can Grow in Excel Output

Post by Lech Kulikowski »

Hello,

Please set the GrowToHeight=true property for the text components.

Thank you.
ginnifer.johnson
Posts: 24
Joined: Tue Oct 12, 2021 2:45 pm

Re: Can Grow in Excel Output

Post by ginnifer.johnson »

I set GrowToHeight to true for all of the text boxes. It's better, but not complete.
WordWrapCanGrow2.png
WordWrapCanGrow2.png (68.65 KiB) Viewed 391 times
Lech Kulikowski
Posts: 7691
Joined: Tue Mar 20, 2018 5:34 am

Re: Can Grow in Excel Output

Post by Lech Kulikowski »

Hello,

When exporting reports to Excel in Stimulsoft Reports, you may encounter two issues.
Firstly, the line spacing for multi-line text might be larger than the spacing shown in the preview, which can cause the last line of text to be truncated.
Secondly, the text may not fit into the cell due to its width, even though it appears to fit in the preview. This can result in the last word being moved to the next line.

The reasons for these issues are as follows:

1. The rendering of the text in Excel is done there with its methods which do not match with any of the following methods:
Winforms (GDI+ (Standard, Typographic), GDI (WYSIWYG)), nor with the Wpf and nor with the JS neither.
Usually, the line spacing in Excel is about 5-15% more than in the preview, especially for the small fonts.
Unfortunately, Excel does not support any means of controlling the line spacing.

2. The rendering of the text in Excel is done there with its methods, therefore the characters' width and the words' width are different, so the text could easily not fit into the cell by the width and the last word in the cell's line will be moved to the next line, unfortunately.
And there is no way to control the text width in Excel as well.

3. The WYSIWYG function in Microsoft Office applications doesn't work properly. The width of the words can vary on a different scale, particularly for the small fonts.
As a result of the one scale the text will fit on one line, but for another scale it will not, so the last word will be moved to the next line.
The best look the document will have in the print preview.
So it is not an unusual situation when the Excel report is in the edit mode and the print preview does not match. Even more differences could be spotted if, in the edit mode, someone changes the page scale from 50% to 200%. During this exercise, the longest text on the page might be cut to different lines depending on the scale size.

So because of the above-mentioned problems, it is almost impossible to reflect the report's view in Excel.
But hopefully, there is a light at the end of the tunnel! However, the report template should be worked on to accommodate the solution to the problem. The report template should be slightly modified as per the following suggestions:

Line width:
1. Try to select different fonts. For each font try to use different values for the TextQuality property. And the best result will be achieved for the line in the preview that looks the longest. So the combinations of TextQuality and the Font for that line should be used in the report.
2. Set the right margin for the textbox. Excel does not have margins for its cells, so there will be some reserve of space for the text.

Line height:
The best solution at this moment is to change the Line Spacing (by default it's 1). In the preview, the line height will be larger which will make the cell in Excel larger. The line space in Excel will be the same as before.
The Line Spacing should be different for different fonts. It could be from 1.1 to 1.25.

Thank you.
Post Reply