RadSpreadProcessing move/cut range of cells

4 posts, 0 answers
  1. MAE
    MAE avatar
    6 posts
    Member since:
    Oct 2016

    Posted 26 Oct Link to this post

    Hi , I'm doing a WPF project in which I'm exporting the RadGridView data to a workbook , once there I figure it out the lenght of the row and columns (including the headers) then with that information I wanted to shift move cut offset the information to another location in the cell my problem right now is that I can't yet find any method which helps me in this task do you know what exactly do I have to do in order to CUT and paste the information? 

     

    PS: I'm using RadSpreadProcessing Library

  2. Boby
    Admin
    Boby avatar
    595 posts

    Posted 31 Oct Link to this post

    Hi Mae,

    RadGridView has built-in support for export to XLSX, which internally uses RadSpreadProcessing. Then you can move the content around by using the Clipboard-like API of the model, for example:
    using (new UpdateScope(workbook.History.BeginUndoGroup, workbook.History.EndUndoGroup))
    {
        CellRange copiedCellRange = new CellRange(0, 0, 2, 1);
        WorksheetFragment worksheetFragment = worksheet.Cells[copiedCellRange].Copy();
        worksheet.Cells[copiedCellRange].Clear(ClearType.All);
     
        worksheet.Cells[3, 3, 5, 4].Paste(worksheetFragment, new PasteOptions(PasteType.All));
    }


    Regards,
    Boby
    Telerik by Progress
    Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
  3. UI for WPF is Visual Studio 2017 Ready
  4. MAE
    MAE avatar
    6 posts
    Member since:
    Oct 2016

    Posted 01 Nov in reply to Boby Link to this post

    Hi and Thanks for the replying , I wanted to ask if this http://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/working-with-rows-and-columns/insert-and-remove#insert-columns is better than the Clipboard API cause I saw that in two lines of code I can do what I wanted to do , also can You explain exactly how it work? I meanthe URL I shared :-) thanks in advance
  5. Boby
    Admin
    Boby avatar
    595 posts

    Posted 04 Nov Link to this post

    Hi Mae,

    You can use code similar to the one in the Insert and Remove Rows and Columns help article if it's suitable for your case. Though we've not profiled both approaches one against the other, I think that inserting columns could be slightly faster.

    The API for inserting columns works as follows: it inserts new columns over all columns in the current column selection. The existing columns are shifted right. This mimics the behavior of the UI.

    Regards,
    Boby
    Telerik by Progress
    Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
Back to Top