Home Documentation Writing Reading Pictures1 Pictures2 Formulas DateTime SheetByName
Merging Grouping InsertRowCol NumFormats Formats Fonts Buffer1 Buffer2 Copying TopNFilter
Sorting StringFilter NumberFilter FilterByValues Protection Replacing RichString BeginWith
ColorScale OpRule AltRows
Merging Grouping InsertRowCol NumFormats Formats Fonts Buffer1 Buffer2 Copying TopNFilter
Sorting StringFilter NumberFilter FilterByValues Protection Replacing RichString BeginWith
ColorScale OpRule AltRows
Inserting rows and columns
This example shows how to insert rows and columns in a sheet. See the result in the insert.xls file.#include "libxl.h"
#include <stdlib.h>
using namespace libxl;
int main()
{
Book* book = xlCreateBook();
Sheet* sheet = book->addSheet(L"Sheet1");
for(int row = 1; row < 30; ++row)
{
for(int col = 0; col < 10; ++col)
{
sheet->writeNum(row, col, rand() % 10);
}
}
sheet->insertRow(5, 10);
sheet->insertRow(20, 22);
sheet->insertCol(4, 5);
sheet->insertCol(8, 8);
book->save(L"insert.xls");
book->release();
return 0;
}