本文整理汇总了C++中QAxObject::setProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ QAxObject::setProperty方法的具体用法?C++ QAxObject::setProperty怎么用?C++ QAxObject::setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAxObject
的用法示例。
在下文中一共展示了QAxObject::setProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mergeCells
void QEXCEL::mergeCells(const QString& cell)
{
QAxObject *range = sheet->querySubObject("Range(const QString&)", cell);
range->setProperty("VerticalAlignment", -4108);//xlCenter
range->setProperty("WrapText", true);
range->setProperty("MergeCells", true);
}
示例2: writeBody
void SportsmenReport::writeBody(const char *headers[], uint length)
{
sheet = openDocument();
for(uint i = 0; i < length; ++i)
{
QAxObject *range = sheet->querySubObject("Range(const QString&)",
QString('A'+i) + QString::number(1));
range->dynamicCall("SetValue(const QVariant&)", QObject::tr(headers[i]));
range->querySubObject("Font")->setProperty("Bold", true);
range->querySubObject("Borders")->setProperty("LineStyle", xlSingle);
}
int rowid = 2, fieldsCount = length;
while(query->next())
{
fieldsCount = query->record().count();
for(int i = 0; i < fieldsCount; ++i)
{
QAxObject *range = sheet->querySubObject("Range(const QString&)",
QString('A'+i) + QString::number(rowid));
range->dynamicCall("SetValue(const QVariant&)", QVariant(query->value(i).value<QString>()));
}
rowid++;
}
QAxObject *exported = sheet->querySubObject("Range(const QString&)",
(QString("A2:") + (QString('A'+(fieldsCount-1)) + QString::number(rowid-1))));
exported->querySubObject("Borders")->setProperty("LineStyle", xlSingle);
QAxObject *font = exported->querySubObject("Font");
font->setProperty("Name", QObject::tr("Arial"));
font->setProperty("Size", 10);
sheet->querySubObject("Columns")->dynamicCall("AutoFit()");
}
示例3: writeHeader
void ResultsReport::writeHeader(const QString &category, const QString &competition, const QDate &date)
{
uint offset = (currentPage - 1) * pageHeight + 1;
QAxObject *range = getRange(QString("A%1:K%1").arg(offset));
range->dynamicCall("Merge()");
range->dynamicCall("SetValue(const QVariant&)", QObject::tr("Протокол результатов соревнований"));
range->setProperty("HorizontalAlignment", xlCenter);
range->querySubObject("Font")->setProperty("Name", "Times New Roman");
range->querySubObject("Font")->setProperty("Size", 14);
range->querySubObject("Font")->setProperty("Bold", true);
offset++;
range = getRange(QString("A%1:K%1").arg(offset));
range->dynamicCall("Merge()");
range->dynamicCall("SetValue(const QVariant&)", competition);
range->setProperty("HorizontalAlignment", xlCenter);
range->querySubObject("Font")->setProperty("Name", "Times New Roman");
range->querySubObject("Font")->setProperty("Size", 14);
range->querySubObject("Font")->setProperty("Bold", true);
offset++;
range = getRange(QString("A%1:K%1").arg(offset));
range->dynamicCall("Merge()");
range->dynamicCall("SetValue(const QVariant&)", QObject::tr("СК «Бастион», ") + genitiveDate(date));
range->setProperty("HorizontalAlignment", xlCenter);
range->querySubObject("Font")->setProperty("Name", "Times New Roman");
range->querySubObject("Font")->setProperty("Size", 14);
range->querySubObject("Font")->setProperty("Bold", true);
offset+=2;
range = getRange(QString("A%1:K%1").arg(offset));
range->dynamicCall("Merge()");
range->dynamicCall("SetValue(const QVariant&)", QObject::tr("категория ") + category);
range->setProperty("HorizontalAlignment", xlCenter);
range->querySubObject("Font")->setProperty("Name", "Times New Roman");
range->querySubObject("Font")->setProperty("Size", 12);
range->querySubObject("Font")->setProperty("Bold", true);
offset++;
const char *headers[] = {
"№ п/п",
"ФИО",
"Год рожд.",
"Техн. квалиф. разряд",
"Область, край, республика",
"Город, населенный пункт",
"Д.С.О. Ведомство",
"СК, ДЮСШ, СДЮСШОР",
"Ф.И.О. Тренера",
"Кол-во боев/ побед",
"Занятое место",
};
for(uint i = 0; i < sizeof(headers)/sizeof(*headers); ++i)
{
QAxObject *range = getRange(QString('A' + i) + QString::number(offset));
range->dynamicCall("SetValue(const QVariant&)", QObject::tr(headers[i]));
}
}
示例4: generateSchedule
bool ItemsList::generateSchedule()
{
if (!m_actualTable.isEmpty() && mainOrderActive )
{
setAnimationVisible(true);
emit animationVisible(getAnimationVisible());
if( setPath().isEmpty() ) {
runMsg("Nie wybrano lokalizacji.");
setAnimationVisible(false);
emit animationVisible(getAnimationVisible());
return false;
}
QAxObject* excel;
QAxObject* wbooks;
QAxObject* book;
QFileInfo scheduleFile("schedule.xlsm");
QVariant excelPath;
QVariant destPath;
excelPath = QVariant(scheduleFile.absoluteFilePath().replace("/", "\\\\"));
excel = new QAxObject("Excel.Application", this);
excel->setProperty("Visible", false);
excel->setProperty("DisplayAlerts",0);
wbooks = excel->querySubObject("Workbooks");
book = wbooks->querySubObject("Open (const QString&)", excelPath);
destPath = excel->dynamicCall("Run(QVariant)", QVariant("runMacro"));
book->dynamicCall("Close()");
excel->dynamicCall("Quit()");
runMsg("Wygenerowano harmonogram",destPath.toString());
delete book;
delete wbooks;
delete excel;
setAnimationVisible(false);
emit animationVisible(getAnimationVisible());
csvFile->remove();
tableDialog->model->clear();
mainOrderActive = false;
return true;
}
else if(m_actualTable.isEmpty() || !mainOrderActive )
{
runMsg("Zamówienie jest puste.");
return false;
}
return false;
}
示例5: on_btnExport_clicked
void MainWindow::on_btnExport_clicked()
{
QDir dir(QDir::currentPath());
QDate date;
QSettings config(dir.currentPath()+"//app.ini",QSettings::IniFormat);
QString path = config.value("/SETTINGS/path").toString();
QString fileName = QFileDialog::getSaveFileName(this,tr("保存文件"),path + "/" + date.currentDate().toString("yyyy-MM-dd")+ui->cbWareH->currentText()+".xls",tr("Microsoft Office 2003(*.xls)"));
if(fileName.isEmpty()){
QMessageBox::critical(0,tr("错误"),tr("要保存的文件名为空"));
return;
}
QSqlQuery query;
query.exec(QString("execute dbo.pr_report_jxc_item;1 @as_from = '%1', @as_to = '%2', @as_branch = '%3', @as_itemcls = '%'")
.arg(date.currentDate().toString("yyyy-MM-dd"))
.arg(date.currentDate().toString("yyyy-MM-dd"))
.arg(ui->cbWareH->currentData().toString()));
QAxObject *excel = new QAxObject("Excel.Application");
if(!excel){
QMessageBox::critical(0,tr("错误"),tr("找不到Excel组件!"));
delete excel;
return;
}
excel->dynamicCall("SetVisible(bool)",false);
excel->setProperty("Visible", false);
excel->setProperty("DisplayAlerts", false);
QAxObject *workbooks = excel->querySubObject("WorkBooks");
workbooks->dynamicCall("Add");
QAxObject *workbook = excel->querySubObject("ActiveWorkBook");
QAxObject *worksheets = workbook->querySubObject("Sheets");
QAxObject *worksheet = worksheets->querySubObject("Item(int)",1);
int row = 1;
while(query.next()){
setCellValue(worksheet,row,"A","'"+query.value("cItem_C").toString());
setCellValue(worksheet,row,"B","'"+query.value("cItem_N").toString());
setCellValue(worksheet,row,"C","0");
setCellValue(worksheet,row,"D",query.value("nSettleQty"));
row ++;
};
workbook->dynamicCall("SaveAs(const QString&)",QDir::toNativeSeparators(fileName));
config.setValue("/SETTINGS/path",fileName.left(fileName.lastIndexOf("/")));
QMessageBox::information(this,tr("操作成功"),tr("保存成功!"));
workbook->dynamicCall("Close()");
worksheet->clear();
excel->dynamicCall("Quit()");
delete excel;
}
示例6: test2
void test2()
{
QAxObject* excel = new QAxObject( "Excel.Application", 0);
excel->setProperty("Visible", true);
excel->dynamicCall("Quit()");
delete excel;
}
示例7: insertSheet
void QExcel::insertSheet(QString sheetName)
{
sheets->querySubObject("Add()");
QAxObject * a = sheets->querySubObject("Item(int)", 1);
// qDebug() << sheetName;
a->setProperty("Name", sheetName);
}
示例8: setCellTextWrap
void QEXCEL::setCellTextWrap(int row, int column, bool isWrap)
{
QString cell;
cell.append(QChar(column - 1 + 'A'));
cell.append(QString::number(row));
QAxObject *range = sheet->querySubObject("Range(const QString&)", cell);
range->setProperty("WrapText", isWrap);
}
示例9: setCellTextCenter
void QEXCEL::setCellTextCenter(int row, int column)
{
QString cell;
cell.append(QChar(column - 1 + 'A'));
cell.append(QString::number(row));
QAxObject *range = sheet->querySubObject("Range(const QString&)", cell);
range->setProperty("HorizontalAlignment", -4108);//xlCenter
}
示例10: writeFooter
void DrawingReport::writeFooter(uint written)
{
for(int i = written; i < 16; ++i, ++currentRow)
{
QAxObject *range = sheet->querySubObject("Range(const QString&)", QString('A') + QString::number(currentRow));
range->dynamicCall("SetValue(const QVariant&)", QString::number(i+1));
}
QAxObject *range0 = sheet->querySubObject("Range(const QString&)",
QString('A') + QString::number(currentRow-16) + QString(":") + QString('A' + 5) + QString::number(currentRow-1));
range0->querySubObject("Borders")->setProperty("LineStyle", xlSingle);
range0->setProperty("RowHeight", 39);
range0->setProperty("WrapText", true);
QAxObject *range1 = getRange(QString("A%1:A%2").arg(currentRow - 16).arg(currentRow - 1)),
*range2 = getRange(QString("B%1:F%2").arg(currentRow - 16).arg(currentRow - 1)),
*range3 = getRange(QString("A%1:F%2").arg(currentRow - 16).arg(currentRow - 1));
range3->setProperty("WrapText", true);
range1->setProperty("HorizontalAlignment", xlRight);
range1->setProperty("VerticalAlignment", xlBottom);
QAxObject *font1 = range1->querySubObject("Font");
font1->setProperty("Name", QString("Arial Cyr"));
font1->setProperty("Size", 12);
font1->setProperty("Bold", true);
range2->setProperty("VerticalAlignment", xlTop);
QAxObject *font2 = range2->querySubObject("Font");
font2->setProperty("Name", QString("Calibri"));
font2->setProperty("Size", 10);
currentRow++;
QAxObject *judge = getRange(QString("B%1").arg(currentRow));
judge->dynamicCall("SetValue(const QVarialnt&)", QObject::tr("Гл. судья"));
QAxObject *secr = getRange(QString("D%1:E%1").arg(currentRow));
secr->dynamicCall("Merge()");
secr->dynamicCall("SetValue(const QVarialnt&)", QObject::tr("Гл. секретарь"));
QAxObject *js[] = {judge, secr};
for(uint i = 0; i < sizeof(js)/sizeof(*js); ++i)
{
js[i]->querySubObject("Borders(int)", xlEdgeBottom)->setProperty("LineStyle", xlSingle);
QAxObject *font = js[i]->querySubObject("Font");
font->setProperty("Name", "Arial Cyr");
font->setProperty("Size", 10);
font->setProperty("Bold", true);
}
currentRow += 7;
currentPage++;
}
示例11: setCellFontBold
void QEXCEL::setCellFontBold(int row, int column, bool isBold)
{
QString cell;
cell.append(QChar(column - 1 + 'A'));
cell.append(QString::number(row));
QAxObject *range = sheet->querySubObject("Range(const QString&)", cell);
range = range->querySubObject("Font");
range->setProperty("Bold", isBold);
}
示例12: setCellFontSize
void QEXCEL::setCellFontSize(int row, int column, int size)
{
QString cell;
cell.append(QChar(column - 1 + 'A'));
cell.append(QString::number(row));
QAxObject *range = sheet->querySubObject("Range(const QString&)", cell);
range = range->querySubObject("Font");
range->setProperty("Size", size);
}
示例13: setColumnWidth
void QEXCEL::setColumnWidth(int column, int width)
{
QString columnName;
columnName.append(QChar(column - 1 + 'A'));
columnName.append(":");
columnName.append(QChar(column - 1 + 'A'));
QAxObject * col = sheet->querySubObject("Columns(const QString&)", columnName);
col->setProperty("ColumnWidth", width);
}
示例14: setRowHeight
void QEXCEL::setRowHeight(int row, int height)
{
QString rowsName;
rowsName.append(QString::number(row));
rowsName.append(":");
rowsName.append(QString::number(row));
QAxObject * r = sheet->querySubObject("Rows(const QString &)", rowsName);
r->setProperty("RowHeight", height);
}
示例15: setFormula
bool Excel::setFormula(const QString& cell, const QString& szCal)
{
try {
if (!excelSheet)
return false;
QAxObject *range = excelSheet->querySubObject("Range(const QVariant&)", QVariant(cell));
if (!range)
return false;
return range->setProperty("Formula", szCal);
} catch (...) {
return false;
}
}