Line breaks not reserved when copying from gridview to excel

6 posts, 0 answers
  1. yijie
    yijie avatar
    14 posts
    Member since:
    Jul 2011

    Posted 21 Jan 2013 Link to this post

    Hi,

    When I tried to copy mulitple rows and cells from RadGridView to MS Excel I found out that the line breaks in cell seemed removed. All statements in the cell present in one single line after pasting into MS Excel cell. Is there a solution to reserve the line breaks in the cell after copy/paste ?

    BTW Last time I got confirmation that the copy of RadGridView will only contains plain text and the font size and font family will not be copied at all. Is that supported in latest version ?

    Thanks,
    Alex
  2. Yoan
    Admin
    Yoan avatar
    1182 posts

    Posted 24 Jan 2013 Link to this post

    Hi Alex,

    I'm afraid you can not have exact pasted copy of RadGridView, because it will store in the clipboard raw data only.

    Regards,
    Yoan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. yijie
    yijie avatar
    14 posts
    Member since:
    Jul 2011

    Posted 24 Jan 2013 Link to this post

    Hi Yoan,

    Thanks for you reply. So it means if I have to preserve the link breaks ( \r\n ) I need to consturct the raw data myself or convert the text data in cells from RadGridView into RTF or HTML formart right ?

    Regards,
    Alex 
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 29 Jan 2013 Link to this post

    Hi Alex,

    I have a test project and a column with CellEditTemplate defined like so:

    <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}">
        <telerik:GridViewDataColumn.CellEditTemplate>
            <DataTemplate>
                <TextBox Text="{Binding Name}" AcceptsReturn="True"/>
            </DataTemplate>
        </telerik:GridViewDataColumn.CellEditTemplate>
    </telerik:GridViewDataColumn>

    Then I edit the name, so that there are some line breaks: \r\n. Then I select the content and copy it (Ctrl + C). Then I paste it (Ctrl + P) into another cell from the same column and into an Excel file. In both the cases the line breaks were preserved (if the width of the cell in Excel is at least the one we need for the pasted content).

    Regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. yijie
    yijie avatar
    14 posts
    Member since:
    Jul 2011

    Posted 29 Jan 2013 Link to this post

    Hi Didie,

    Thank you very much for your workaround solution. However as we noticed if applying celledittemplate to RadGridView there will be a serious performace issue due to the real data is quite large. Anyway I will give it a try and wish it could be in use.

    Thanks
    Alex
  6. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 30 Jan 2013 Link to this post

    Hi Alex,

    I am glad to hear that, hopefully you could indeed use it. 

    Kind regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top