
#include "../include/outline.h"
#include "../include/file_path.h"
#include <oosxl.hxx>

#include <iostream>


using namespace oo;

void outline()
{
    Document* doc = create_document();
    Workbook* wb = doc->get_workbook();
    Worksheet* ws = wb->add_worksheet("row outline");

    // Create an outline of rows
    ws->group_rows(1, 10);
    ws->group_rows(1, 10);
    ws->group_rows(1, 10);
    ws->group_rows(20, 30);
    ws->group_rows(5, 25);
    ws->group_rows(7, 37);
    ws->group_rows(20, 37);

    // Ungroup rows
    ws->ungroup_rows(10, 22);
    ws->ungroup_rows(30, 37);

    // Ungroup all rows
    //ws->delete_row_outline();

    auto path = target_file("outline.xlsx");
    if (!doc->save(path.string().c_str()))
        std::cout << "Error saving file: " << run_msg() << std::endl;

    doc->release();
}
