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

RadSpreadProcessing move/cut range of cells

3 Answers 143 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
MAE
Top achievements
Rank 1
MAE asked on 27 Oct 2016, 03:19 AM

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

3 Answers, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 31 Oct 2016, 02:53 PM
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!
0
MAE
Top achievements
Rank 1
answered on 01 Nov 2016, 06:38 PM
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
0
Boby
Telerik team
answered on 04 Nov 2016, 11:40 AM
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!
Tags
General Discussions
Asked by
MAE
Top achievements
Rank 1
Answers by
Boby
Telerik team
MAE
Top achievements
Rank 1
Share this question
or