本文整理汇总了C++中Sheet类的典型用法代码示例。如果您正苦于以下问题:C++ Sheet类的具体用法?C++ Sheet怎么用?C++ Sheet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sheet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: pickUiSample
void pickUiSample(Sheet& sheet, Widget& selected)
{
const string name = selected.label();
if(sheet.stripe().sequence().size() > 0)
sheet.clear();
if(name == "Dockspace")
createUiTestDockspace(sheet);
else if(name == "Window")
createUiTestWindow(sheet);
else if(name == "Filtered List")
createUiTestFilteredList(sheet);
else if(name == "Custom List")
createUiTestCustomList(sheet);
else if(name == "Text Editor")
createUiTestTextEditor(sheet);
else if(name == "Tabs")
createUiTestTabs(sheet);
else if(name == "Table")
createUiTestTable(sheet);
else if(name == "Tree")
createUiTestTree(sheet);
else if(name == "Controls")
createUiTestControls(sheet);
else if(name == "File Browser")
createUiTestFileBrowser(sheet);
else if(name == "File Tree")
createUiTestFileTree(sheet);
else if(name == "Progress Dialog")
createUiTestProgressDialog(sheet);
}
示例3: redo
void ShowSheetCommand::redo()
{
Sheet* sheet = map->findSheet(sheetName);
if (!sheet) return;
sheet->hideSheet(false);
}
示例4: undo
void ShowSheetCommand::undo()
{
Sheet* sheet = map->findSheet(sheetName);
if (!sheet) return;
sheet->hideSheet(true);
}
示例5: setDirty
QColor Color::color()
{
if(isDirty()) {
setDirty(false);
QVariant v = definition();
//qfInfo() << v.toString() << "type:" << v.typeName();
if(v.type() == QVariant::String) {
m_color.setNamedColor(v.toString());
if(!m_color.isValid()) {
Sheet *ss = rootStyleSheet();
if(ss) {
Color *pco = qobject_cast<Color*>(ss->styleObjectForName(SGColor, v.toString()));
if(pco)
m_color = pco->color();
}
}
}
else if(v.type() == QVariant::Int) {
m_color = QColor((Qt::GlobalColor)v.toInt());
}
else {
m_color = v.value<QColor>();
}
}
return m_color;
}
示例6: drawFrame
void Image::drawFrame(const Sheet& sheet, int f, int x, int y, const Transform& transform, Screen& dest)
{
dest.bindImage(*this);
dest.applyTransform(transform, x, y, sheet.getWidth(), sheet.getHeight());
drawFrameRaw(sheet, f, 0, 0, dest);
dest.unbindImage();
}
示例7: writeData
void writeData()
{
std::string defs;
fs::path defs_path = out_dir / (out_file_prepend + ".defs");
print(format("write directory = %s\n") % out_dir);
print(format("write file prefix = \"%s\"\n") % out_file_prepend);
if(!dry_run) fs::create_directories(out_dir);
for(int i = 0; i < packer.numSheets(); i++)
{
Sheet *s = packer.getSheet(i);
fs::path dst = out_dir / str(format("%s%03d.%s") % out_file_prepend % i % "png");
print(format("writing sheet to %s\n") % dst);
s->saveImage(dst);
defs += getSheetDefinitions(dst, s);
}
print(format("writing definitions to %s\n") % defs_path);
if(!dry_run)
{
fs::ofstream out(defs_path);
out << defs;
if(out.fail())
print(format("failed to write %s\n") % defs_path, VERBOSE);
}
}
示例8: renderKeyboardPreview
void NoteEntryAction::renderKeyboardPreview(QPainter& painter, const MusicCursor& cursor)
{
Staff* staff = cursor.staff();
Part* part = staff->part();
Sheet* sheet = part->sheet();
Bar* bar = sheet->bar(cursor.bar());
QPointF p = bar->position() + QPointF(0, staff->top());
Voice* voice = cursor.staff()->part()->voice(cursor.voice());
VoiceBar* vb = voice->bar(bar);
if (cursor.element() >= vb->elementCount()) {
// cursor is past last element in bar, position of cursor is
// halfway between last element and end of bar
if (vb->elementCount() == 0) {
// unless entire voicebar is still empty
p.rx() += 15.0;
} else {
VoiceElement* ve = vb->element(vb->elementCount()-1);
p.rx() += (ve->x() + bar->size()) / 2;
}
} else {
// cursor is on an element, get the position of that element
p.rx() += vb->element(cursor.element())->x();
}
p.ry() += (cursor.staff()->lineCount() - 1)* cursor.staff()->lineSpacing();
p.ry() -= cursor.staff()->lineSpacing() * cursor.line() / 2;
m_tool->shape()->renderer()->renderNote(painter, m_duration < QuarterNote ? QuarterNote : m_duration, p, 0, Qt::magenta);
}
示例9: 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;
}
示例10: switch
void GlobalsSubStreamHandler::handleBoundSheet(BoundSheetRecord* record)
{
if (!record) return;
switch (record->sheetType()) {
case BoundSheetRecord::Chart: // chartsheets are worksheets too
case BoundSheetRecord::Worksheet: {
// create a new sheet
Sheet* sheet = new Sheet(d->workbook);
sheet->setName(record->sheetName());
sheet->setVisible(record->sheetState() == BoundSheetRecord::Visible);
d->workbook->appendSheet(sheet);
if(record->sheetType() == BoundSheetRecord::Chart)
d->chartSheets << sheet;
// update bof position map
unsigned bofPos = record->bofPosition();
d->bofMap[ bofPos ] = sheet;
} break;
default:
std::cout << "GlobalsSubStreamHandler::handleBoundSheet: Unhandled type=" << record->sheetType() << std::endl;
break;
}
}
示例11: newSheet
void MainWindow::open(const QString &filename)
{
Sheet *childSheet = newSheet();
if (!childSheet->open(filename)) {
childSheet->close();
}
}
示例12: slotDefault
void ResizeColumn::slotDefault()
{
Sheet* sheet = m_selection->activeSheet();
if (!sheet)
return;
double points = sheet->map()->defaultColumnFormat()->width();
m_pWidth->setValue(m_selection->canvas()->unit().toUserValue(points));
}
示例13: onSheetPageClosed
void ApplicationUI::onSheetPageClosed()
{
Page *page = qobject_cast<Page*>(sender());
Sheet *sheet = qobject_cast<Sheet*>(page->parent());
sheet->close();
sheet->deleteLater();
Application::instance()->setMenuEnabled(true);
}
示例14: qDebug
// handles SLOT from faq item
void ApplicationUI::faqTriggered() {
Sheet *s = Application::instance()->scene()->findChild<Sheet*>("faqSheet");
if (s) {
qDebug() << "FAQ triggered and faqSheet found";
s->open();
} else {
qDebug() << "FAQ triggered, but no faqSheet found";
}
}
示例15: xlCreateBook
bool ProtoMaker::ReadExcel(std::string file_path, std::string output_path, std::string &err)
{
Book* book = xlCreateBook();
bool ret = true;
if (!book)
{
err = "lib err";
return false;
}
if (!book->load(file_path.c_str()))
{
err = "load file failed. path: ";
err.append(file_path);
book->release();
return false;
}
int sheet_index = 0;
Sheet* sheet = book->getSheet(sheet_index);
NodeList node_list;
while (sheet != nullptr)
{
if (!ReadStructDefine(sheet, node_list, err))
{
book->release();
return false;
}
if (!ReadNameDefine(sheet, node_list, err))
{
book->release();
return false;
}
sheet = book->getSheet(++sheet_index);
}
if(sheet)
{
size_t max_rows = sheet->lastRow();
size_t max_cols = sheet->lastCol();
for (size_t r=0; r<max_rows; ++r)
{
for( int c=0; c<max_cols; ++c)
{
//const wchar_t* s = sheet->readStr(r, c);
//int n = sheet->readNum(r, c);
}
}
}
book->release();
return true;
}