Please tell me, how make copy and past row, like in MS Excel with save collection Cells.
thanks
Currently you can create a range based on a row and use Range.Copy method to copy them. I will consider to add a more elegant method to copy row and column.
@popov_mikhail,
Aspose.Cells has replaced Aspose.Excel that is discontinued and no more available now. You can copy/paste rows and columns along with a variety of paste options using Aspose.Cells. Here is a sample code that can be used to copy and paste data in Excel file.
// Load sample excel file
Workbook wb = new Workbook(sourceDir + "sampleChangeChartDataSource.xlsx");
// Access the first sheet which contains chart
Worksheet source = wb.Worksheets[0];
// Add another sheet named DestSheet
Worksheet destination = wb.Worksheets.Add("DestSheet");
// Set CopyOptions.ReferToDestinationSheet to true
CopyOptions options = new CopyOptions();
options.ReferToDestinationSheet = true;
// Set PasteOptions
PasteOptions pasteOptions = new PasteOptions();
pasteOptions.PasteType = PasteType.Values;
pasteOptions.OnlyVisibleCells = true;
// Copy all the rows of source worksheet to destination worksheet which includes chart as well
// The chart data source will now refer to DestSheet
destination.Cells.CopyRows(source.Cells, 0, 0, source.Cells.MaxDisplayRange.RowCount, options, pasteOptions);
// Save workbook in xlsx format
wb.Save(outputDir + "outputChangeChartDataSource.xlsx", SaveFormat.Xlsx);
Refer to the following article to get more information about copying rows and columns.
Copying rows and columns
To run this sample code download the latest version of Aspose.Cells for .NET here:
Aspose.Cells for .NET (Latest Version)
You can test different features of this new product by downloading an executable solution here.