Multiline in cell

Posted by: sk.0911749090 on 10 April 2024, 6:31 pm EST

  • Posted 10 April 2024, 6:31 pm 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 11 April 2024, 8:21 pm 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 16 April 2024, 6:00 pm 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 18 April 2024, 3:51 pm 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 18 April 2024, 10:46 pm 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, 4:25 am 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

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels