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
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
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.
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
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