How to Copy the selected portion of rows from one spread to another spread

Posted by: brganesh on 8 September 2017, 1:45 pm EST

  • Posted 8 September 2017, 1:45 pm EST

    I have selected some parts of rows in the spread(say for example 5 to 55) i just want these selected rows to be saved as excel file.

    i got several examples like assigning a new spread object and assign the old grid to this newly created one and save it as excel file...

    but i just need to save the selected parts of rows to  be saved in the Excel file 

     we are using spread for windows and c# for coding,can i have some example coding... to complete this..

     

  • Replied 8 September 2017, 1:45 pm EST

    Hello,


    Here is code to take data from first Spread and put it in a hidden Spread for exporting to Excel.


    // Copy data from first Spread


    fpSpread1.Sheets[0].AddSelection(2, 5, 22, 55);


    fpSpread1.Sheets[0].ClipboardCopy();


    fpSpread1.Sheets[0].ClearSelection();


    //Create new Spread control and paste the data you want exported.


    FarPoint.Win.Spread.FpSpread ss = new FarPoint.Win.Spread.FpSpread();


    ss.Sheets.Count = 1;


    ss.ActiveSheet.ClipboardPaste();


    ss.SaveExcel(@"c:\test\test.xls");

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels