#include "XlsxEntity.h"

XlsxEntity::XlsxEntity(std::string filename)
{
	xldom_.create(filename);
	sheet_ = xldom_.workbook().worksheet("Sheet1");
}

XlsxEntity::~XlsxEntity()
{
	this->close();
}

void XlsxEntity::setCell(std::string index, std::string v)
{
	sheet_.cell(XLCellReference(index)).value() = v;
}

void XlsxEntity::setCell(int row, int col, std::string v)
{
	sheet_.cell(row, col).value() = v;
}

void XlsxEntity::close()
{
	if (xldom_.isOpen())
	{
		xldom_.save();
		xldom_.close();
	}
}