Posted 11 April 2024, 3:31 am EST
Hello, is it possible to have a multiline text in a cell? It means to break the line after a desired word. I know there is a Wrap functionality available, but it does not fit our requirements.
Thanks!
Forums Home / Spread / Spread for WPF/Silverlight
Posted by: sk.0911749090 on 11 April 2024, 3:31 am EST
Posted 11 April 2024, 3:31 am EST
Hello, is it possible to have a multiline text in a cell? It means to break the line after a desired word. I know there is a Wrap functionality available, but it does not fit our requirements.
Thanks!
Posted 12 April 2024, 5:21 am EST
Hi Jose,
If you want to add a new line after a particular word in code-behind, you can simply add ‘\n’ or ‘\r’ in the cell value string. See the following code snippet:
gcSpreadSheet.ActiveSheet.Cells[1,1].Value = "Line1R\rLine2RN\nLine3N";
Kindly refer to the attached sample for implementation. See MultiLineSpread.zip
You can use “Alt+Enter” key combination, if you want to add a new line in a cell during runtime. [similar to MS Excel]
Please let us know if you have further concerns related to this.
Thanks & Regards,
Aastha
Posted 17 April 2024, 3:00 am EST
Thanks for the prompt answer. Yes, I know about the \r and \n but to be more concrete, our users are used to copy/paste a multiline text (e.g. from Notepad) into a cell. In MS Excel it works, all the lines are there, but when pasting to Spreadsheet only the top line is displayed. How can I achieve this behavior?
Posted 19 April 2024, 12:51 am EST
Hi Jose,
In MS Excel, pasting a multiline text directly on a cell shows each line in a different row. However, we can paste multiline text in a single cell, when we paste it the formula bar. See ExcelBehavior.zip for reference.
Since GcSpreadSheet control does not contain the formula bar, we consider that you are working with SpreadSheetDesigner. Pasting multiline text in the formula bar of SpreadSheetDesigner, displays only the single line. This behavior does not align with MS Excel and therefore we have escalated this to our developers. [Internal Tracking ID: SPNET-37825]
We will update you on this as soon as we hear back from them.
In case your requirement differs from our understanding we request you provide some details along with the videos of the behavior on your end. Additionally, please provide your environment details.
Thanks & Regards,
Aastha
Posted 19 April 2024, 7:46 am EST
Hello,
yes, but in MS Excel in edit mode (F2 or double-click) the clipboarded lines are pasted all into the cell. We are using the GcSpreadSheet control (not the Spread designer) with enhanced custom functionality, mainly taken from your “Spread WPF Explorer” sample app.
To summarize, what we want to achieve is within a cell (edit mode), to be able to paste a multiline text. The lines should appear all inside the cell, as in MS Excel and no formula bar was used here. Is it possible to escalate also this to your developers?
Can I check the ExcelBehavior.zip sample?
Used version: 15.45.20223.0
Thanks!
Posted 22 April 2024, 1:25 pm EST
Hi Jose,
Thanks for providing a detailed explanation of your use-case.
We could replicate the issue with the latest build (v17.0.20231.0) as well. We have escalated this issue to our developers for further investigation. We will update you soon on this.
Meanwhile we have attached ExcelBehavior.zip for your reference.
Thanks & Regards,
Aastha
Posted 29 May 2024, 2:48 am EST
Hello guys, some updates until now? Thanks!
Posted 30 May 2024, 12:53 am EST
Hi Jose,
The developers have identified this issue as a bug. However, we do not have an ETA for the fix of this issue yet.
We will keep you informed as soon as we get further details from the developer.
Thanks & Regards,
Aastha
Posted 19 November 2024, 4:24 am EST
Hello guys,
some update now after long months?
Posted 19 November 2024, 7:43 am EST - Updated 19 November 2024, 7:49 am EST
Hi Jose,
This issue has been fixed in the latest release V17.2.0. Kindly refer to the following GIF to see the behavior with the latest version of the product.
Here is the link to the latest version of Spread.NET installer: https://developer.mescius.com/spreadnet/download
Hope this helps!
Thanks & Regards,
Aastha
Posted 20 November 2024, 7:43 am EST - Updated 20 November 2024, 10:21 am EST
Thanks for the prompt answer. Is there a way to turn this function on/off?
Something like:
worksheet.Cells[1, 1].MultLine = false;
worksheet.Cells[1, 1].MultLine = true;
Or is it by default ‘on’ and not changeable?
Posted 21 November 2024, 8:28 am EST
Hi Jose,
You can create GcTextBoxCellType type cells to enable the Multiline feature for these cells. Here is the code snippet for the same:
GcTextBoxCellType textBoxCell = new GcTextBoxCellType();
textBoxCell.Multiline = true;
fpSpread1.ActiveSheet.Cells[0, 0, rowCount - 1, colCount - 1].CellType = textBoxCell;
fpSpread1.ActiveSheet.Cells[1, 1].Value = "Line1R\rLine2RN\r\nLine3N\n";
Kindly refer to the attached sample for full implementation. See MultiLineDemo.zip.
Thanks & Regards,
Aastha
Posted 21 November 2024, 9:04 am EST
Come on guys! Check the section, it is about WPF, not WinForm.
Posted 22 November 2024, 6:40 am EST
Hi Jose,
We apologize for the confusion.
We are currently discussing this requirement with our developers. [Internal Tracking ID: SGFW-563] We will update you once we hear back from them.
Thanks & Regards,
Aastha