Inserting rows and columns
This example shows how to insert rows and columns in a sheet. See result in insert.xls.#include "libxl.h"
#include <stdlib.h>
using namespace libxl;
int main()
{
Book* book = xlCreateBook();
Sheet* sheet = book->addSheet(L"Sheet1");
for(unsigned short row = 1; row < 30; ++row)
{
for(unsigned short 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;
}