This is a migrated thread and some comments may be shown as answers.

grid excel export cell newline

5 Answers 376 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Venelin
Top achievements
Rank 1
Venelin asked on 18 Oct 2019, 01:53 PM

Hi there,

 I want to have a newline in exported data from grid to excel. How can I do that? I tried using char(10), but it didn't work.

 Also, can I have some sort of html in the cells? I know that the documentation says that I can't, but still? :)

5 Answers, 1 is accepted

Sort by
0
Venelin
Top achievements
Rank 1
answered on 19 Oct 2019, 11:37 AM
The same question stands for the pdf export as well. How can I export a newline character?
0
Stefan
Telerik team
answered on 21 Oct 2019, 07:10 AM

Hello, Venelin,

Could you please provide more details on how this new line should look like? Is this just an empty row after the Grid data or something different.

Also, indeed an HTML cannot be added in Excel, as Excel itself does not understand HTML, and we do not have control over it.

We only have control to customize some of the styles to which Excel is giving as access as the color, the background etc:

https://www.telerik.com/kendo-react-ui/components/grid/excel-export/#toc-customizing-exported-columns

As for the PDF export, as soon as I receive more details for the desired end result,  I will provide information on how it can be done with the PDF export as well.

Regards,
Stefan
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Venelin
Top achievements
Rank 1
answered on 01 Nov 2019, 10:30 AM

Hello Stefan,

  Thank you for your reply.

  The newline is needed for some cells which have multi-line content; Say "addresses" (one-per-line) for "customer".

  I need to have the cell in excel to have newline character in it. I checked the docs for Excel, they say that to achieve that new-line character, I have to have a char(10) character in the cell. The question is how can I add that character to kendoreact excel export.

  The same for PDF. I need to have a cell with newline \r\n (or maybe \r , \n) in it.

  Hopefully this explanation clarifies the issue.

0
Venelin
Top achievements
Rank 1
answered on 01 Nov 2019, 10:33 AM

In excel itself, to get the newline in the cell, you have to press alt+enter

https://support.office.com/en-gb/article/start-a-new-line-of-text-inside-a-cell-in-excel-33e41eab-8b5e-4193-93d6-9a06ecf812b3

 

0
Stefan
Telerik team
answered on 05 Nov 2019, 07:16 AM

Hello, Venelin,

Thank you for the clarification.

This can be done by adding "\n" newline inside the text where the line break has to be placed.

Also, it requires setting the wrap property of the cell to true.

I have made an example showcasing this:

https://stackblitz.com/edit/react-36xszw?file=app/main.jsx

I hope this is helpful

Regards,
Stefan
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Venelin
Top achievements
Rank 1
Answers by
Venelin
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or