本文整理汇总了C++中QAxObject::property方法的典型用法代码示例。如果您正苦于以下问题:C++ QAxObject::property方法的具体用法?C++ QAxObject::property怎么用?C++ QAxObject::property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAxObject
的用法示例。
在下文中一共展示了QAxObject::property方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getUsedRowsCount
int QEXCEL::getUsedRowsCount()
{
QAxObject *usedRange = sheet->querySubObject("UsedRange");
int topRow = usedRange->property("Row").toInt();
QAxObject *rows = usedRange->querySubObject("Rows");
int bottomRow = topRow + rows->property("Count").toInt() - 1;
return bottomRow;
}
示例2: getUsedRange
void QEXCEL::getUsedRange(int *topLeftRow, int *topLeftColumn, int *bottomRightRow, int *bottomRightColumn)
{
QAxObject *usedRange = sheet->querySubObject("UsedRange");
*topLeftRow = usedRange->property("Row").toInt();
*topLeftColumn = usedRange->property("Column").toInt();
QAxObject *rows = usedRange->querySubObject("Rows");
*bottomRightRow = *topLeftRow + rows->property("Count").toInt() - 1;
QAxObject *columns = usedRange->querySubObject("Columns");
*bottomRightColumn = *topLeftColumn + columns->property("Count").toInt() - 1;
}
示例3: getAll
QVariantList Excel::getAll(int *rows, int *cols)
{
QVariant result;
char sCell[18];
try {
getRowsCols(rows, cols);
memset(sCell, 0, 18);
if (*cols <= 26)
sprintf(sCell, "%c", 'A' + *cols - 1);
else
sprintf(sCell, "%c%c", 'A' + *cols / 26 - 1, 'A' + *cols % 26 - 1);
QString cell = sCell;
cell = cell.trimmed() + QString::number(*rows);
QString srange = "Range(\"A1\",\"" + cell + "\")";
if (excelSheet) {
QAxObject *range = excelSheet->querySubObject(srange.toLocal8Bit());
if (range) {
result = range->property("Value");
delete range;
}
}
} catch (...) {}
QVariantList list = qVariantValue<QVariantList>(result);
return list;
}
示例4: CellValue
QString QExcel::CellValue(int x, int y){
if( x < 1 || y < 1 || _sheet == NULL)
return NULL;
QAxObject* cell = _sheet->querySubObject("Cells(int,int)", y, x);
QString ret = cell->property("Value").toString();
return ret;
}
示例5: getRowsCols
void Excel::getRowsCols(int *rows, int *cols)
{
try {
if (excelSheet) {
QAxObject *ur = excelSheet->querySubObject("UsedRange()");
if (ur) {
QAxObject *cs = ur->querySubObject("columns()");
if (cs) {
*cols = cs->property("Count").toInt();
}
QAxObject *rs = ur->querySubObject("Rows()");
if (rs) {
*rows = rs->property("Count").toInt();
}
}
}
} catch (...) {
}
}
示例6: sheetName
QString Excel::sheetName(int index)
{
try {
if (!excelSheets)
return QString();
QAxObject *s = excelSheets->querySubObject("Item(int index)", index);
if (s) {
return s->property("Name").toString();
}
} catch (...) {}
return QString();
}
示例7: QRadioButton
void
CSELECT_EXCEL_TAB::
selectWorksheetTab(const int intCount)
{
m_intCount = intCount;
QVBoxLayout *vbox = new QVBoxLayout;
QAxObject * worksheet = new QAxObject;
for (int i = 1; i <= m_intCount; i++)
{
worksheet = m_workbook->querySubObject("Worksheets(int)", i);
QString tabName = worksheet->property("Name").toString();
// do not include 'change log' tab
if ( !tabName.contains("change log") &&
!tabName.contains("Change log") &&
!tabName.contains("Change Log") &&
!tabName.contains("change log") )
{
QRadioButton *button = new QRadioButton(worksheet->property("Name").toString());
vbox->addWidget(button); // add button widget
vbox->addStretch(1); // fit in the area
connect(button, SIGNAL(clicked(bool)), this, SLOT(buttonSelected(bool))); // when radio button clicked
}
}
示例8: value
QVariant Excel::value(int row, int col)
{
QVariant vValue;
try {
if (!excelSheet)
return QVariant();
QAxObject *range = excelSheet->querySubObject("Cells(int,int)", row, col);
if (!range)
return QVariant();
vValue = range->property("Value2");
delete range;
} catch (...) {}
return vValue;
}
示例9: getCellValue
QVariant QEXCEL::getCellValue(int row, int column)
{
QAxObject *range = sheet->querySubObject("Cells(int,int)", row, column);
return range->property("Value");
}
示例10: saveToDocFile
void SavingSettingsTabView::saveToDocFile()
{
fillResultStructure();
if (m_dbTable.count() > 0) {
QString file = createDocFile();
if (file.isEmpty()) {
QMessageBox::warning(0, "Внимание", "Вы не выбрали файл для выгрузки документа.");
return;
}
m_wordApp = new QAxObject("Word.Application",this);
m_wordDoc = m_wordApp->querySubObject("Documents()");
m_wordDoc->dynamicCall("Open(QVariant, QVariant, QVariant, QVariant, QVariant, QVariant, QVariant)", file, false, false, false, "", "", false); //querySubObject("Add()");
m_wordApp->setProperty("Visible", true);
//Get active document.
QAxObject* pActiveDocument = m_wordApp->querySubObject("ActiveDocument()");
//Get selection.
QAxObject *pSelection = m_wordApp->querySubObject("ActiveDocument")->querySubObject("ActiveWindow")->querySubObject("Selection");
// создание таблицы
QAxObject* pTables = pActiveDocument->querySubObject("Tables()");
int commonRowCount = (m_dbTable.count())*7 + (m_answerInfo.count())*4;
QAxObject* pNewTable = pTables->querySubObject("Add(Id, testname, firstname, secondName, surname, groupname, scorevalue, maxvalue, testtime)", pSelection->property("Range"), commonRowCount, 2, 1, 1);
//Resize table width to whole page width.
pNewTable->setProperty("PreferredWidthType", "wdPreferredWidthPercent");
pNewTable->setProperty("PreferredWidth", 110);
//Align table to center.
pNewTable->querySubObject("Rows()")->setProperty("Alignment", "wdAlignRowCenter");
//Iterate found records.
QAxObject *pCell = NULL, *pCellRange = NULL, *textFont = NULL;
int table_row = 1;
for (int row = 0; row < m_dbTable.count(); row++) {
pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row, 1);
pCellRange = pCell->querySubObject("Range()");
pCellRange->dynamicCall("InsertAfter(Text)", "НАЗВАНИЕ ТЕСТА");
textFont = pCellRange->querySubObject("Font");
textFont->setProperty("Bold", true);
pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row, 2);
pCellRange = pCell->querySubObject("Range()");
pCellRange->dynamicCall("InsertAfter(Text)", m_dbTable.at(row).testName);
textFont = pCellRange->querySubObject("Font");
textFont->setProperty("Bold", true);
pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 1, 1);
pCellRange = pCell->querySubObject("Range()");
pCellRange->dynamicCall("InsertAfter(Text)", "ФИО");
textFont = pCellRange->querySubObject("Font");
textFont->setProperty("Bold", true);
pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 1, 2);
pCellRange = pCell->querySubObject("Range()");
pCellRange->dynamicCall("InsertAfter(Text)", m_dbTable.at(row).surname
+ " " + m_dbTable.at(row).firstName.at(0)
+ ". " + m_dbTable.at(row).secondName.at(0) + ".");
textFont = pCellRange->querySubObject("Font");
textFont->setProperty("Bold", true);
pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 2, 1);
pCellRange = pCell->querySubObject("Range()");
pCellRange->dynamicCall("InsertAfter(Text)", "ВРЕМЯ");
textFont = pCellRange->querySubObject("Font");
textFont->setProperty("Bold", true);
pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 2, 2);
pCellRange = pCell->querySubObject("Range()");
pCellRange->dynamicCall("InsertAfter(Text)", m_dbTable.at(row).time);
textFont = pCellRange->querySubObject("Font");
textFont->setProperty("Bold", true);
pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 3, 1);
pCellRange = pCell->querySubObject("Range()");
pCellRange->dynamicCall("InsertAfter(Text)", "ПОЛУЧЕННЫЙ БАЛЛ");
textFont = pCellRange->querySubObject("Font");
textFont->setProperty("Bold", true);
pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 3, 2);
pCellRange = pCell->querySubObject("Range()");
pCellRange->dynamicCall("InsertAfter(Text)", m_dbTable.at(row).score);
textFont = pCellRange->querySubObject("Font");
textFont->setProperty("Bold", true);
pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 4, 1);
pCellRange = pCell->querySubObject("Range()");
pCellRange->dynamicCall("InsertAfter(Text)", "ВОЗМОЖНЫЙ МАКСИМУМ");
textFont = pCellRange->querySubObject("Font");
textFont->setProperty("Bold", true);
pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 4, 2);
pCellRange = pCell->querySubObject("Range()");
pCellRange->dynamicCall("InsertAfter(Text)", m_dbTable.at(row).maxPosibleScore);
//.........这里部分代码省略.........
示例11: object
[id(1)] BSTR text;
[id(2)] IFontDisp *font;
methods:
[id(6)] void showColumn([in] int i);
[id(3)] bool addColumn([in] BSTR t);
[id(4)] int fillList([in, out] SAFEARRAY(VARIANT) *list);
[id(5)] IDispatch *item([in] int i);
};
//! [4]
//! [5]
QAxObject object("<CLSID>");
QString text = object.property("text").toString();
object.setProperty("font", QFont("Times New Roman", 12));
connect(this, SIGNAL(clicked(int)), &object, SLOT(showColumn(int)));
bool ok = object.dynamicCall("addColumn(const QString&)", "Column 1").toBool();
QList<QVariant> varlist;
QList<QVariant> parameters;
parameters << QVariant(varlist);
int n = object.dynamicCall("fillList(QList<QVariant>&)", parameters).toInt();
QAxObject *item = object.querySubItem("item(int)", 5);
//! [5]
//! [6]
示例12: QString
void PrepodRez::on_pushButton_5_clicked()
{
QString fio;
QSqlQueryModel q;
QString ss = QString("SELECT \"FIO\" FROM \"Users\" WHERE \"id\"='%1'").arg(qq);
q.setQuery(ss);
fio = q.record(0).value(0).toString();
QAxObject *word = new QAxObject("Word.Application", this);
QAxObject *documents = word->querySubObject("Documents"); //получаем коллекцию документов
QAxObject *document = documents->querySubObject("Add()"); //добавляем свой документ в коллекцию
word->setProperty("Visible", true);
QAxObject* ActiveDocument = word->querySubObject("ActiveDocument()");
QAxObject* Range = ActiveDocument->querySubObject("Range()");
Range->querySubObject("InsertAfter(Text)",QString("Отчет \n\r по результатам тестирования "
"студента: %1 \n\r Ведущая рука: \n"
"%2 \n"
"%4 \n"
"%6 \n"
"%8 \n"
"%9 \n "
"%10 \n"
"%3 %5 %7"
""
"\n\r Не ведущая рука: \n"
"%11 \n"
"%12 \n"
"%13 \n"
"%14 \n"
"%15 \n "
"%16 \n"
"%17 %18 %19 \n\r"
"%20").arg(fio).arg(ui->label_8->text())
.arg(ui->label_17->text())
.arg(ui->label_9->text())
.arg(ui->label_18->text())
.arg(ui->label_10->text())
.arg(ui->label_19->text())
.arg(ui->label_11->text()).
arg(ui->label_12->text())
.arg(ui->label_13->text())
.arg(ui->label_21->text())
.arg(ui->label_23->text())
.arg(ui->label_25->text())
.arg(ui->label_27->text())
.arg(ui->label_29->text())
.arg(ui->label_31->text())
.arg(ui->label_33->text())
.arg(ui->label_35->text())
.arg(ui->label_37->text())
.arg(ui->label_38->text()));
QAxObject *shrift = Range->querySubObject("Font");
QString lol = shrift->property("Name").toString();
shrift->setProperty("Size", 14); //задаем размер шрифта
QTextCodec *codec = QTextCodec::codecForName("CP-1251");
QTextCodec::setCodecForLocale(codec);
}
示例13: Open
/**
*@brief 打开sXlsFile指定的excel报表
*@return true : 打开成功
* false: 打开失败
*/
bool ExcelEngine::Open(UINT nSheet, bool visible)
{
if ( bIsOpen )
{
//return bIsOpen;
Close();
}
nCurrSheet = nSheet;
bIsVisible = visible;
if ( NULL == pExcel )
{
pExcel = new QAxObject("Excel.Application");
if ( pExcel )
{
bIsValid = true;
}
else
{
bIsValid = false;
bIsOpen = false;
return bIsOpen;
}
pExcel->dynamicCall("SetVisible(bool)", bIsVisible);
}
if ( !bIsValid )
{
bIsOpen = false;
return bIsOpen;
}
if ( sXlsFile.isEmpty() )
{
bIsOpen = false;
return bIsOpen;
}
/*如果指向的文件不存在,则需要新建一个*/
qDebug() << sXlsFile;
QFile f(sXlsFile);
if (!f.exists())
{
bIsANewFile = true;
}
else
{
bIsANewFile = false;
}
if (!bIsANewFile)
{
pWorkbooks = pExcel->querySubObject("WorkBooks"); //获取工作簿
// @author 范翔 不装Office会有空指针错误[注释]
pWorkbook = pWorkbooks->querySubObject("Open(QString, QVariant)",sXlsFile,QVariant(0)); //打开xls对应的工作簿
}
else
{
pWorkbooks = pExcel->querySubObject("WorkBooks"); //获取工作簿
pWorkbooks->dynamicCall("Add"); //添加一个新的工作薄
pWorkbook = pExcel->querySubObject("ActiveWorkBook"); //新建一个xls
}
pWorksheet = pWorkbook->querySubObject("WorkSheets(int)", nCurrSheet);//打开第一个sheet
//至此已打开,开始获取相应属性
QAxObject *usedrange = pWorksheet->querySubObject("UsedRange");//获取该sheet的使用范围对象
QAxObject *rows = usedrange->querySubObject("Rows");
QAxObject *columns = usedrange->querySubObject("Columns");
//因为excel可以从任意行列填数据而不一定是从0,0开始,因此要获取首行列下标
nStartRow = usedrange->property("Row").toInt(); //第一行的起始位置
nStartColumn = usedrange->property("Column").toInt(); //第一列的起始位置
nRowCount = rows->property("Count").toInt(); //获取行数
nColumnCount = columns->property("Count").toInt(); //获取列数
bIsOpen = true;
return bIsOpen;
}
开发者ID:fanxiang090909,项目名称:Railway-Tunnel-Construction-Dlearance-Measure-LanZhou,代码行数:88,代码来源:excelengine.cpp
示例14: open
/**
*@brief 打开sXlsFile指定的excel报表
*@return true : 打开成功
* false: 打开失败
*/
bool ExcelEngine::open(UINT nSheet, bool visible)
{
if ( bIsOpen )
{
//return bIsOpen;
close();
}
if ( NULL == pExcel )
{
pExcel = new QAxObject("Excel.Application");
if ( pExcel )
{
bIsValid = true;
}
else
{
bIsValid = false;
bIsOpen = false;
return bIsOpen;
}
pExcel->dynamicCall("SetVisible(bool)", bIsVisible);
}
if ( !bIsValid )
{
bIsOpen = false;
return bIsOpen;
}
if ( sXlsFile.isEmpty() )
{
bIsOpen = false;
return bIsOpen;
}
bool ok = createXlsFile(sXlsFile);
if ( !ok )
{
bIsOpen = false;
return bIsOpen;
}
nCurrSheet = nSheet;
bIsVisible = visible;
pWorkbooks = pExcel->querySubObject("WorkBooks"); //获取工作簿
pWorkbook = pWorkbooks->querySubObject("Open(QString, QVariant)",sXlsFile,QVariant(0)); //打开xls对应的工作簿
pWorksheet = pWorkbook->querySubObject("WorkSheets(int)", nCurrSheet);//打开第一个sheet
//至此已打开,开始获取相应属性
QAxObject *usedrange = pWorksheet->querySubObject("UsedRange");//获取该sheet的使用范围对象
QAxObject *rows = usedrange->querySubObject("Rows");
QAxObject *columns = usedrange->querySubObject("Columns");
//因为excel可以从任意行列填数据而不一定是从0,0开始,因此要获取首行列下标
nStartRow = usedrange->property("Row").toInt(); //第一行的起始位置
nStartColumn = usedrange->property("Column").toInt(); //第一列的起始位置
nRowCount = rows->property("Count").toInt(); //获取行数
nColumnCount = columns->property("Count").toInt(); //获取列数
bIsOpen = true;
return bIsOpen;
}
示例15: upload
void SongsOnlineWidget::upload()
{
this->setCursor(Qt::WaitCursor);
QAxObject *excel = NULL;
QAxObject *work_books = NULL;
QAxObject *work_book = NULL;
excel = new QAxObject("Excel.Application");
if (excel->isNull()) {//网络中很多使用excel==NULL判断,是错误的
QMessageBox::critical(0, "错误信息", "没有找到EXCEL应用程序");
return;
}
excel->setProperty("Visible", false);
work_books = excel->querySubObject("WorkBooks");
QString path = lineEdit_upload->text();
if(path.isEmpty())
{
QMessageBox::warning(NULL, "提示", "批量上传路径不能为空,\n点击浏览选择批量上传文件。");
return;
}
work_books->dynamicCall("Open (const QString&)", QString(path));
QVariant title_value = excel->property("Caption"); //获取标题
qDebug()<<QString("excel title : ")<<title_value;
work_book = excel->querySubObject("ActiveWorkBook");
QAxObject *work_sheets = work_book->querySubObject("WorkSheets"); //Sheets也可换用WorkSheets
int sheet_count = work_sheets->property("Count").toInt(); //获取工作表数目
qDebug()<<QString("sheet count : ")<<sheet_count;
int newsong_wheet_index = 0;
for(int i=1; i<=sheet_count; i++)
{
QAxObject *work_sheet = work_book->querySubObject("Sheets(int)", i); //Sheets(int)也可换用Worksheets(int)
QString work_sheet_name = work_sheet->property("Name").toString(); //获取工作表名称
QString message = QString("sheet ")+QString::number(i, 10)+ QString(" name");
if(work_sheet_name.compare("新增歌曲") == 0)
{
newsong_wheet_index = i;
break;
}
qDebug()<<message<<work_sheet_name;
}
if(newsong_wheet_index != 0)
{
QAxObject *work_sheet = work_book->querySubObject("Sheets(int)", newsong_wheet_index);
QAxObject *used_range = work_sheet->querySubObject("UsedRange");
QAxObject *rows = used_range->querySubObject("Rows");
QAxObject *columns = used_range->querySubObject("Columns");
int row_start = used_range->property("Row").toInt(); //获取起始行
int column_start = used_range->property("Column").toInt(); //获取起始列
int row_count = rows->property("Count").toInt(); //获取行数
int column_count = columns->property("Count").toInt(); //获取列数
for(int i=row_start+1; i<=row_count; i++)
{
Media media;
for(int j=column_start; j<=column_count; j++)
{
QAxObject *cell = work_sheet->querySubObject("Cells(int,int)", i, j);
QAxObject *cell_01 = work_sheet->querySubObject("Cells(int)", i);
QVariant value = cell_01->property("Value");
QVariant cell_value = cell->property("Value"); //获取单元格内容
if(j == 1)
media.mid = cell_value.toString();
else if(j == 2)
media.serial_id = cell_value.toString();
else if(j == 3)
media.name = cell_value.toString();
else if(j == 4)
media.language = cell_value.toString();
else if(j == 5)
media.type = cell_value.toString();
else if(j == 6)
media.singer = cell_value.toString();
else if(j == 7)
media.artist_sid_1 = cell_value.toString();
else if(j == 8)
media.artist_sid_2 = cell_value.toString();
else if(j == 9)
media.pinyin = cell_value.toString();
else if(j == 10)
media.header = cell_value.toString();
else if(j == 11)
media.head = cell_value.toString();
else if(j == 12)
media.words = cell_value.toString();
else if(j == 13)
media.path = cell_value.toString();
else if(j == 14)
media.lyric = cell_value.toString();
else if(j == 15)
media.original_track = cell_value.toString();
else if(j == 16)
media.sound_track = cell_value.toString();
else if(j == 17)
//.........这里部分代码省略.........