本文整理汇总了C++中Book::addFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ Book::addFormat方法的具体用法?C++ Book::addFormat怎么用?C++ Book::addFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Book
的用法示例。
在下文中一共展示了Book::addFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
Book* book = xlCreateBook();
if(book)
{
Font* font = book->addFont();
font->setName(L"Impact");
font->setSize(36);
Format* format = book->addFormat();
format->setAlignH(ALIGNH_CENTER);
format->setBorder(BORDERSTYLE_MEDIUMDASHDOTDOT);
format->setBorderColor(COLOR_RED);
format->setFont(font);
Sheet* sheet = book->addSheet(L"Custom");
if(sheet)
{
sheet->writeStr(2, 1, L"Format", format);
sheet->setCol(1, 1, 25);
}
if(book->save(L"format.xls"))
{
::ShellExecute(NULL, L"open", L"format.xls", NULL, NULL, SW_SHOW);
}
}
return 0;
}
示例2: main
int main()
{
Book* book = xlCreateBook();
if(book)
{
Sheet* sheet = book->addSheet("Sheet1");
if(sheet)
{
sheet->writeStr(2, 1, "Hello, World !");
sheet->writeNum(3, 1, 1000);
Format* dateFormat = book->addFormat();
dateFormat->setNumFormat(NUMFORMAT_DATE);
sheet->writeNum(4, 1, book->datePack(2008, 4, 29), dateFormat);
sheet->setCol(1, 1, 12);
}
if(book->save("example.xls")) std::cout << "\nFile example.xls has been created." << std::endl;
book->release();
}
std::cout << "\nPress any key to exit...";
_getch();
return 0;
}