You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
43 lines
1.1 KiB
7 years ago
|
#include <iostream>
|
||
|
#include <conio.h>
|
||
|
#include "libxl.h"
|
||
|
|
||
|
using namespace libxl;
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
Book* book = xlCreateBook();
|
||
|
if(book)
|
||
|
{
|
||
|
if(book->load(L"..\\generate\\example.xls"))
|
||
|
{
|
||
|
Sheet* sheet = book->getSheet(0);
|
||
|
if(sheet)
|
||
|
{
|
||
|
const wchar_t* s = sheet->readStr(2, 1);
|
||
|
if(s) std::wcout << s << std::endl << std::endl;
|
||
|
|
||
|
std::cout << sheet->readNum(4, 1) << std::endl;
|
||
|
std::cout << sheet->readNum(5, 1) << std::endl;
|
||
|
const wchar_t* f = sheet->readFormula(6, 1);
|
||
|
if(f) std::wcout << f << std::endl << std::endl;
|
||
|
|
||
|
int year, month, day;
|
||
|
book->dateUnpack(sheet->readNum(8, 1), &year, &month, &day);
|
||
|
std::cout << year << "-" << month << "-" << day << std::endl;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
std::cout << "At first run generate !" << std::endl;
|
||
|
}
|
||
|
|
||
|
book->release();
|
||
|
}
|
||
|
|
||
|
std::cout << "\nPress any key to exit...";
|
||
|
_getch();
|
||
|
|
||
|
return 0;
|
||
|
}
|