How to move Cell's values?

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

    Posted 28 Oct 2016 Link to this post

    For example if I have a CellSelection coordinates how can I retrieve the values from all cells and move it like a cut and paste text in another part of my export excel file? 
  2. Boby
    Boby avatar
    637 posts

    Posted 01 Nov 2016 Link to this post

    Hello Mae,

    I guess the question here is the same as in the other forum thread you started in the WPF forum here. I will post the sample code for cut/paste here also for clarity:
    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[3, 3, 5, 4].Paste(worksheetFragment, new PasteOptions(PasteType.All));

    If you do not need history, you can disable it using workbook.History.IsEnabled property and skip the using (new UpdateScope(workbook.History.BeginUndoGroup, workbook.History.EndUndoGroup)) part. This can improve your performance and memory consumption, especially if you are moving large fragments around.

    Telerik by Progress

Back to Top