当前位置: 首页>>代码示例>>C++>>正文


C++ QAxObject类代码示例

本文整理汇总了C++中QAxObject的典型用法代码示例。如果您正苦于以下问题:C++ QAxObject类的具体用法?C++ QAxObject怎么用?C++ QAxObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QAxObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: memset

bool Excel::writeRow(int row, QVariantList &list)
{
    try {
        char sCell[18];
        memset(sCell, 0, 18);
        int col = list.count();
        if (col <= 26)
            sprintf(sCell, " %c", 'A' + col - 1);
        else
            sprintf(sCell, "%c%c", 'A' + col / 26 - 1, 'A' + col % 26 - 1);

        QString cell = sCell;
        columnName = columnName.toUpper() > cell.toUpper() ? columnName : cell;
        cell = cell.trimmed() + QString::number(row);
        QString srange = "Range(\"A" + QString::number(row) + "\",\"" + cell + "\")";
        if (!excelSheet)
            return false;
        QAxObject *range = excelSheet->querySubObject(srange.toLocal8Bit());
        if (!range)
            return false;

        range->dynamicCall("SetValue2(const QVariantList&)", QVariant(list));
        delete range;

        return true;
    } catch (...) {
        return false;
    }
}
开发者ID:Decryptortuning,项目名称:HEXplorer,代码行数:29,代码来源:excel.cpp

示例2: recupererDerniereCelluleNonVidePremiereColonne

QAxObject * ExcelOnglet::recupererPremiereCelluleVidePremiereColonne()
{
   QAxObject * derniereCellulePleinePremiereColonne =
      recupererDerniereCelluleNonVidePremiereColonne();
   return (QAxObject *)
          derniereCellulePleinePremiereColonne->querySubObject( "Offset(int, int)", 1, 0 );
}
开发者ID:feydriva,项目名称:Depistage,代码行数:7,代码来源:ExcelOnglet.cpp

示例3: getRowsCols

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;
}
开发者ID:Decryptortuning,项目名称:HEXplorer,代码行数:29,代码来源:excel.cpp

示例4: 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);
}
开发者ID:khalilluo,项目名称:excelsets,代码行数:7,代码来源:qexcel.cpp

示例5: test2

void test2()
{
	QAxObject* excel = new QAxObject( "Excel.Application", 0);
	excel->setProperty("Visible", true);
	excel->dynamicCall("Quit()");
	delete excel;
}
开发者ID:joonhwan,项目名称:study,代码行数:7,代码来源:main.cpp

示例6: qDebug

/**
* @brief Create Excel File
* @param file [QString]  the name of the opened file
* @return 0:success   -1:failed
*/
bool QEXCEL::CreateExcel(QString file)
{
    QDir  dTemp;

    if(dTemp.exists(file))
    {
        qDebug()<<" QExcel::CreateExcel: exist file"<<file;
        return false;
    }

    qDebug()<<" QExcel::CreateExcel: succes";

    /**< create new excel sheet file.*/
    QAxObject * workSheet = excel->querySubObject("WorkBooks");
    workSheet->dynamicCall("Add");

    /**< save Excel.*/
    QAxObject * workExcel= excel->querySubObject("ActiveWorkBook");
    excel->setProperty("DisplayAlerts", 0);
    workExcel->dynamicCall("SaveAs (const QString&,int,const QString&,const QString&,bool,bool)",file,56,QString(""),QString(""),false,false);
    excel->setProperty("DisplayAlerts", 1);
    workExcel->dynamicCall("Close (Boolean)", false);

    /**< exit Excel.*/
    //excel->dynamicCall("Quit (void)");

    return true;
}
开发者ID:khalilluo,项目名称:excelsets,代码行数:33,代码来源:qexcel.cpp

示例7: insertSheet

void QExcel::insertSheet(QString sheetName)
{
    sheets->querySubObject("Add()");
    QAxObject * a = sheets->querySubObject("Item(int)", 1);
//    qDebug() << sheetName;
	a->setProperty("Name", sheetName);
}
开发者ID:Finalcheat,项目名称:SQLiteDatabaseManage,代码行数:7,代码来源:qexcel.cpp

示例8: getRange

void TechnicalReport::writeHeader()
{
    QAxObject *range = getRange(QString("A%1:B%1").arg(currentRow));
    range->dynamicCall("Merge()");
    range->dynamicCall("SetValue(const QVariant&)",
        QObject::tr("Категория ") + query->value(1).value<QString>());
    currentRow++;
}
开发者ID:kravitz,项目名称:kfais,代码行数:8,代码来源:reports.cpp

示例9: 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;
}
开发者ID:khalilluo,项目名称:excelsets,代码行数:8,代码来源:qexcel.cpp

示例10: 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;
}
开发者ID:shuheilocale,项目名称:sandbox,代码行数:9,代码来源:qexcel.cpp

示例11: clearCell

void QEXCEL::clearCell(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->dynamicCall("ClearContents()");
}
开发者ID:khalilluo,项目名称:excelsets,代码行数:9,代码来源:qexcel.cpp

示例12: 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
}
开发者ID:khalilluo,项目名称:excelsets,代码行数:9,代码来源:qexcel.cpp

示例13: 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);
}
开发者ID:khalilluo,项目名称:excelsets,代码行数:9,代码来源:qexcel.cpp

示例14: setAnimationVisible

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;

}
开发者ID:RStravinsky,项目名称:MedicalTables,代码行数:56,代码来源:itemslist.cpp

示例15: 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);
}
开发者ID:khalilluo,项目名称:excelsets,代码行数:10,代码来源:qexcel.cpp


注:本文中的QAxObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。