AutoFill Range of Excel File with C++
Contents
[
Hide
]
Perform an Autofill in the Specified Range in Excel
In Excel, select a range, move the mouse to the right-bottom corner, and drag the “+” to autofill data.
Auto Fill Ranges with Aspose.Cells
The following example shows how to perform an AutoFill operation on a Range. Here is the sample file which can be downloaded for testing this feature:
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Create a Workbook
Workbook workbook(u"range_autofill.xlsx");
// Get Cells
Worksheet worksheet = workbook.GetWorksheets().Get(0);
Cells cells = worksheet.GetCells();
// Create Range
Range src = cells.CreateRange(u"C3:C4");
Range dest = cells.CreateRange(u"C5:C10");
// AutoFill
src.AutoFill(dest, AutoFillType::Series);
// Save the Workbook
workbook.Save(u"range_autofill_result.xlsx");
std::cout << "Range auto-filled successfully!" << std::endl;
Aspose::Cells::Cleanup();
}