示例#1
0
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
0
文件: reports.cpp 项目: kravitz/kfais
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
0
文件: reports.cpp 项目: kravitz/kfais
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
0
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
0
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
0
void QEXCEL::mergeCells(int topLeftRow, int topLeftColumn, int bottomRightRow, int bottomRightColumn)
{
    QString cell;
    cell.append(QChar(topLeftColumn - 1 + 'A'));
    cell.append(QString::number(topLeftRow));
    cell.append(":");
    cell.append(QChar(bottomRightColumn - 1 + 'A'));
    cell.append(QString::number(bottomRightRow));

    QAxObject *range = sheet->querySubObject("Range(const QString&)", cell);
    range->setProperty("VerticalAlignment", -4108);//xlCenter
    range->setProperty("WrapText", true);
    range->setProperty("MergeCells", true);
}
示例#7
0
文件: main.cpp 项目: joonhwan/study
void test2()
{
	QAxObject* excel = new QAxObject( "Excel.Application", 0);
	excel->setProperty("Visible", true);
	excel->dynamicCall("Quit()");
	delete excel;
}
void QExcel::insertSheet(QString sheetName)
{
    sheets->querySubObject("Add()");
    QAxObject * a = sheets->querySubObject("Item(int)", 1);
//    qDebug() << sheetName;
	a->setProperty("Name", sheetName);
}
示例#9
0
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);
}
示例#10
0
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
}
示例#11
0
文件: reports.cpp 项目: kravitz/kfais
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++;
}
示例#12
0
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);
}
示例#13
0
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);
}
示例#14
0
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);
}
示例#15
0
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);
}
示例#16
0
文件: reports.cpp 项目: kravitz/kfais
void PulkaReport::writeHeader(const QString &category, const QString &competition, const QDate &date)
{
    uint offset = (currentPage - 1) * pageHeight + 1;
    QAxObject *range = getRange(QString("A%1:M%1").arg(offset));
    range->dynamicCall("Merge()");
    range->dynamicCall("SetValue(const QVariant&)", QObject::tr("Протокол хода ") + competition);
    offset++;

    range = getRange(QString("D%1:E%1").arg(offset));
    range->dynamicCall("Merge()");
    range->dynamicCall("SetValue(const QVariant&)", QObject::tr("Категория"));

    range = getRange(QString("F%1:K%1").arg(offset));
    range->dynamicCall("Merge()");
    range->dynamicCall("SetValue(const QVariant&)", category);

    range = getRange(QString("L%1").arg(offset));
    range->dynamicCall("SetValue(const QVariant&)", QObject::tr("г. Владивосток"));

    range = getRange(QString("M%1").arg(offset));
    range->dynamicCall("SetValue(const QVariant&)", date.toString("dd.MM.yyyy") + QObject::tr("г."));
    offset++;

    range = getRange(QString("A%1").arg(offset));
    range->dynamicCall("SetValue(const QVariant&)", QString::number(currentPage));
    range = getRange(QString("A%1:M%2").arg(offset-2).arg(offset));
    range->querySubObject("Font")->setProperty("Name", "Calibri");
    range->querySubObject("Font")->setProperty("Size", 11);
    offset++;
    for(int i = 0; i < 8; ++i, offset += 4)
    {
        QAxObject *range = getRange(QString("A%1:B%2").arg(offset).arg(offset + 1));
        range->dynamicCall("Merge()");
        range->querySubObject("Borders")->setProperty("LineStyle", xlSingle);
        range->setProperty("WrapText", true);

        range = getRange(QString("L%1:M%2").arg(offset).arg(offset + 1));
        range->dynamicCall("Merge()");
        range->querySubObject("Borders")->setProperty("LineStyle", xlSingle);
        range->setProperty("WrapText", true);
    }
}
示例#17
0
文件: reports.cpp 项目: kravitz/kfais
void ResultsReport::writeFooter()
{
    uint offset = currentPage * pageHeight - 15;
    QAxObject *range = getRange(QString("A%1:B%1").arg(offset - 1)),
            *range2 = getRange(QString("A%1:B%1").arg(offset));
    range->dynamicCall("Merge()");
    range2->dynamicCall("Merge()");

    range->dynamicCall("SetValue(const QVariant&)", QObject::tr("Гл. судья"));
    range2->dynamicCall("SetValue(const QVariant&)", QObject::tr("Гл. секретарь"));

    range = getRange(QString("C%1:E%1").arg(offset - 1)),
    range2 = getRange(QString("C%1:E%1").arg(offset));

    range->dynamicCall("Merge()");
    range2->dynamicCall("Merge()");

    range->dynamicCall("SetValue(const QVariant&)", QObject::tr("Григорьев Д.А."));
    range2->dynamicCall("SetValue(const QVariant&)", QObject::tr("Штаненкова Ж.Л."));
    range->querySubObject("Font")->setProperty("Name", "Times New Roman");
    range2->querySubObject("Font")->setProperty("Name", "Times New Roman");
    range->querySubObject("Font")->setProperty("Size", 12);
    range2->querySubObject("Font")->setProperty("Size", 12);

    range = getRange(QString("A%1:K%2").arg(offset - 12).arg(offset - 4));
    range->querySubObject("Borders")->setProperty("LineStyle", xlSingle);
    range->querySubObject("Font")->setProperty("Name", "Times New Roman");
    range->setProperty("WrapText", true);

    range = getRange(QString("A%1:K%2").arg(offset - 11).arg(offset - 4));
    range->querySubObject("Font")->setProperty("Size", 11);

    range = getRange(QString("A%1:K%1").arg(offset - 12));
    range->querySubObject("Font")->setProperty("Size", 10);
    range->querySubObject("Font")->setProperty("Bold", true);
    range->setProperty("HorizontalAlignment", xlCenter);

    range = getRange(QString("B%1:K%2").arg(offset - 12).arg(offset - 4));
    range->setProperty("HorizontalAlignment", xlCenter);

    currentPage++;
}
示例#18
0
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;
    }
}
示例#19
0
bool Excel::setMergeCells(const QString& cell)
{
    try {
        if (!excelSheet)
            return false;
        QAxObject *range = excelSheet->querySubObject("Range(const QVariant&)", QVariant(cell));
        if (!range)
            return false;

        range->setProperty("HorizontalAlignment", 0xFFFFEFF4);
        range->setProperty("VerticalAlignment", 0xFFFFEFF4);
        range->setProperty("WrapText", false);
        range->setProperty("Orientation", 0);
        range->setProperty("AddIndent", false);
        range->setProperty("IndentLevel", 0);
        range->setProperty("ShrinkToFit", false);
        range->setProperty("ReadingOrder", 0xFFFFEC76);
        range->setProperty("MergeCells", true);
        return true;
    } catch (...) {
        return false;
    }
}
示例#20
0
bool Excel::setBackgroundColor(const QString& cell1, const QString& cell2, int color)
{
    try {
        if (!excelSheet)
            return false;
        QAxObject *range = excelSheet->querySubObject( "Range(const QString&, const QString&)", cell1, cell2);
        if (!range)
            return false;

        range = range->querySubObject("Interior");
        if (!range) {
            return false;
        }

        return range->setProperty("ColorIndex", color);
    } catch (...) {
        return false;
    }
}
示例#21
0
bool Excel::setFontBold(const QString& cell1, const QString& cell2, bool blBold)
{
    try {
        if (!excelSheet)
            return false;
        QAxObject *range = excelSheet->querySubObject( "Range(const QString&, const QString&)", cell1, cell2);
        if (!range)
            return false;

        range = range->querySubObject("Font");
        if (!range) {
            return false;
        }

        return range->setProperty("Bold", blBold);
    } catch (...) {
        return false;
    }
}
示例#22
0
void QEXCEL::setCellTextCenter(const QString &cell)
{
    QAxObject *range = sheet->querySubObject("Range(const QString&)", cell);
    range->setProperty("HorizontalAlignment", -4108);//xlCenter
}
示例#23
0
void SongsQueryWideget::export_excel_clicked()
{
    ///建立临时表映射
    ///
    setCursor(Qt::WaitCursor);
    QSqlQueryModel *sqlquery = new QSqlQueryModel(this);
    QSqlQuery _query;
    MediaPagingQuery argu;
    getQueryCondition(argu);
    if(!_sql->queryMedia_All(argu, _query))
        return;
    sqlquery->setQuery(_query);
    int rows = sqlquery->rowCount();
    int columns = sqlquery->columnCount();
    setCursor(Qt::ArrowCursor);
    QString desktopPath = QProcessEnvironment::systemEnvironment().value("USERPROFILE")+"\\Desktop";
    QString fileName = QFileDialog::getSaveFileName(tableView_songsQuery, "保存",
                                                    //QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation),
                                                    desktopPath,
                                                    "Excel 文件(*.xls *.xlsx)");
    QProgressDialog *progress = new QProgressDialog(this);
    progress->setLabelText("正在导出表格数据……");
    progress->setRange(0, rows);
    progress->setModal(true);
    progress->setCancelButtonText("取消");
//    progress->setMinimumSize(300, 50);
    progress->setMinimumWidth(400);
    progress->setAutoClose(true);
    if (fileName!="")
    {
        QAxObject *excel = new QAxObject;
        if (excel->setControl("Excel.Application")) //连接Excel控件
        {
            excel->dynamicCall("SetVisible (bool Visible)","false");//不显示窗体
            excel->setProperty("DisplayAlerts", false);//不显示任何警告信息。如果为true那么在关闭是会出现类似“文件已修改,是否保存”的提示
            QAxObject *workbooks = excel->querySubObject("WorkBooks");//获取工作簿集合
            workbooks->dynamicCall("Add");//新建一个工作簿
            QAxObject *workbook = excel->querySubObject("ActiveWorkBook");//获取当前工作簿
            QAxObject *worksheet = workbook->querySubObject("Worksheets(int)", 1);
//            //数据区
            for(int i=0; i<rows; i++)
            {
                for (int j=0;j<columns; j++)
                {
                    QModelIndex index = sqlquery->index(i, j);
                    QString text = index.data().toString();
//                    table->item(i,j)?table->item(i,j)->text():""
                    worksheet->querySubObject("Cells(int,int)", i+1, j+1)->dynamicCall("SetValue(const QString&)", text);
                }

                QString label_text = QString("正在导出%1行……").arg(i+1);
                progress->setLabelText(label_text);
                progress->setValue(i+1);
                if(progress->wasCanceled())
                {
                    break;
                }
            }

            workbook->dynamicCall("SaveAs(const QString&)",QDir::toNativeSeparators(fileName));//保存至fileName
            workbook->dynamicCall("Close()");//关闭工作簿
            //关闭excel
            excel->dynamicCall("Quit (void)");
            delete excel;
            excel=NULL;
            QMessageBox box(QMessageBox::Question, "完成", "文件已经导出,是否现在打开?");
            box.setStandardButtons(QMessageBox::Yes|QMessageBox::No);
            box.setButtonText(QMessageBox::Yes, "确定(&Q)");
            box.setButtonText(QMessageBox::No, "取消(&C)");
            if(box.exec() == QMessageBox::Yes)
//            if (QMessageBox::question(NULL,"完成","文件已经导出,是否现在打开?",QMessageBox::Yes|QMessageBox::No)==QMessageBox::Yes)
            {
                QString local_path = QString("file:///") + fileName;
                QDesktopServices::openUrl(QUrl(local_path, QUrl::TolerantMode)); //QDir::toNativeSeparators(fileName)));

            }
        }
        else
        {
            QMessageBox::warning(NULL,"错误","未能创建 Excel 对象,请安装 Microsoft Excel。",QMessageBox::Apply);
        }
    }
//    progress->close();
}
示例#24
0
文件: reports.cpp 项目: kravitz/kfais
void DrawingReport::writeHeader(const QString& category, const QDate &date)
{
    QAxObject *feder = getRange(QString("A%1:E%1").arg(QString::number(currentRow)));
    feder->dynamicCall("Merge()");
    feder->dynamicCall("SetValue(const QVariant&)",
        QObject::tr("Федерация КУДО Приморского края"));
    feder->setProperty("HorizontalAlignment", xlCenter);

    QAxObject *pageNumber = getRange(QString("F%1").arg(QString::number(currentRow)));
    pageNumber->dynamicCall("SetValue(const QVariant&)", QString::number(currentPage));
    pageNumber->setProperty("HorizontalAlignment", xlRight);
    currentRow++;

    QAxObject *protocol = getRange(QString("A%1:E%1").arg(QString::number(currentRow)));
    protocol->dynamicCall("Merge()");
    protocol->dynamicCall("SetValue(const QVariant&)", QObject::tr("ПРОТОКОЛ"));
    protocol->setProperty("HorizontalAlignment", xlCenter);
    currentRow++;

    QAxObject *protocolName = getRange(QString("A%1:E%1").arg(QString::number(currentRow)));
    protocolName->dynamicCall("Merge()");
    protocolName->dynamicCall("SetValue(const QVariant&)", QObject::tr("Взвешивания, мандатной комиссии и жеребьёвки"));
    protocolName->setProperty("HorizontalAlignment", xlCenter);
    currentRow++;

    QString curRow = QString::number(currentRow);
    QAxObject *daten = getRange(QString("A%1").arg(curRow));
    daten->dynamicCall("SetValue(const QVariant&)", QObject::tr("Дата"));

    QAxObject *dateval = getRange(QString("B%1").arg(curRow));
    dateval->dynamicCall("SetValue(const QVariant&)", genitiveDate(date));
    dateval->querySubObject("Borders(int)", xlEdgeBottom)->setProperty("LineStyle", xlSingle);

    QAxObject *categn = getRange(QString("C%1").arg(curRow));
    categn->dynamicCall("SetValue(const QVariant&)", QObject::tr("Категория"));

    QAxObject *categval = getRange(QString("D%1:F%1").arg(curRow));
    categval->dynamicCall("Merge()");
    categval->dynamicCall("SetValue(const QVariant&)", category);
    categval->setProperty("HorizontalAlignment", xlRight);
    categval->querySubObject("Borders(int)", xlEdgeBottom)->setProperty("LineStyle", xlSingle);

    QAxObject *style1[] = {feder, protocol, protocolName};
    for(uint i = 0; i < sizeof(style1)/sizeof(*style1); ++i)
    {
        QAxObject *font = style1[i]->querySubObject("Font");
        font->setProperty("Name", QString("Arial Cyr"));
        font->setProperty("Size", 12);
        font->setProperty("Bold", true);
    }

    pageNumber->querySubObject("Font")->setProperty("Name", "Calibri");
    pageNumber->querySubObject("Font")->setProperty("Size", 11);

    QAxObject *font2 = getRange(QString("A%1:F%1").arg(curRow))->querySubObject("Font");
    font2->setProperty("Name", QString("Arial Cyr"));
    font2->setProperty("Size", 10);
    font2->setProperty("Bold", true);

    currentRow += 2;

    const char *headers[] = {
        "№ п/п",
        "ФИО",
        "Дата рожд.",
        "Команда/город",
        "Разряд\n(кю, дан)",
        "№ Жеребьёвки"
    };
    for(uint i = 0; i < sizeof(headers)/sizeof(*headers); ++i)
    {
        QAxObject *range = sheet->querySubObject("Range(const QString&)",
                                                 QString('A'+i) + QString::number(currentRow));
        range->dynamicCall("SetValue(const QVariant&)", QObject::tr(headers[i]));
        range->querySubObject("Borders")->setProperty("LineStyle", xlSingle);
    }
    QAxObject *range3 = getRange(QString("A%1:F%1").arg(QString::number(currentRow))),
              *range4 = getRange(QString("A%1:F%1").arg(QString::number(currentRow)));
    range3->setProperty("RowHeight", 26.25);
    range4->setProperty("WrapText", true);
    QAxObject *font3 = range3->querySubObject("Font");
    font3->setProperty("Name", QString("Arial Cyr"));
    font3->setProperty("Size", 10);
    font3->setProperty("Bold", true);
    getRange(QString("F%1").arg(currentRow))->setProperty("WrapText", false);
    currentRow++;
}
示例#25
0
bool MainWindow::writeSalary()
{
    QString tagFilePath = ui->lineEdit_3->text();

    if(tagFilePath.isEmpty() == true)
    {
        ui->textEdit->append(tr("2 zhaobudao"));
        return false;
    }

    //Excel应用程序包括一系列的workbooks,每个workbook又由多个sheets组成。

    QString nameStart = ui->nameEdit2->text();
    QString salaryStart = ui->salaryEdit2->text();

    if(nameStart.right(1) != salaryStart.right(1))
    {
        ui->textEdit->append(tr("qishi weizhi buyiyang"));
        return false;
    }

    QString nameChar = nameStart.left(1);
    QString salaryChar = salaryStart.left(1);
    bool isOk = false;
    int index = nameStart.right(1).toInt(&isOk);

    if(isOk == false)
    {
        ui->textEdit->append(tr("youwenti"));
        return false;
    }

    QAxObject* excel = new QAxObject( "Excel.Application" );
    excel->dynamicCall( "SetVisible(bool)", false );
    QAxObject *workbooks = excel->querySubObject( "Workbooks" ); //得到Workbooks集合的指针
    //QAxObject *workbookSrc = workbooks->querySubObject( "Open(const QString&)", "F:\\QExcelConvert\\test.xls" );
    QAxObject *workbookSrc = workbooks->querySubObject( "Open(const QString&)", tagFilePath );
    QAxObject *worksheet = workbookSrc->querySubObject("Worksheets(int)", ui->spinBox2->value());

    QMap<QString, int> mapHelp;

    int totalCount = m_map.count();
    bool result = true;
    while(1)
    {
        QString namePos = QString("Range(%1%2)").arg(nameChar).arg(index);
        QAxObject* nameAx = worksheet->querySubObject(namePos.toStdString().c_str());
        QString name = nameAx->property("Value").toString().trimmed();

        QString salaryPos = QString("Range(%1%2)").arg(salaryChar).arg(index);
        QAxObject* salaryAx = worksheet->querySubObject(salaryPos.toStdString().c_str());

        if(name.isEmpty() == true)
        {
            break;
        }

        if(mapHelp.contains(name) == true)
        {
            result = false;
            ui->textEdit->append(QString("2 mizichongfu %1").arg(mapHelp.value(name)));
            break;
        }

        if( m_map.contains(name) )
        {
            salaryAx->setProperty("Value", m_map.value(name));
            m_map.remove(name);
            ui->textEdit->append(QString("%1 %2 %3 OK").arg(index).arg(name).arg(m_map.value(name)));
        }
        else
        {
            salaryAx->clear();
        }

        mapHelp.insert(name, index);
        index++;
    }

    if(result == true)
    {
        int nowCount = m_map.count();
        ui->textEdit->append(QString("wancheng %1/%2").arg(totalCount - nowCount).arg(totalCount));

        if(nowCount > 0)
        {
            QList<QString> keys = m_map.keys();
            for(int i = 0; i < nowCount; ++i)
            {
                int j = index + 5 + i;
                QString namePos = QString("Range(%1%2)").arg(nameChar).arg(j);
                QAxObject* nameAx = worksheet->querySubObject(namePos.toStdString().c_str());
                nameAx->setProperty("Value", keys.at(i));

                QString salaryPos = QString("Range(%1%2)").arg(salaryChar).arg(j);
                QAxObject* salaryAx = worksheet->querySubObject(salaryPos.toStdString().c_str());
                salaryAx->setProperty("Value", m_map.value(keys.at(i)));
            }
        }
    }

    workbookSrc->dynamicCall("Save (void)");
    workbookSrc->dynamicCall("Close (Boolean)", false);
    excel->dynamicCall("Quit (void)");
    delete excel;
    return result;
}
示例#26
0
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)
                   media.start_volume_1 = cell_value.toString();
               else if(j == 18)
                   media.start_volume_2 = cell_value.toString();
               else if(j == 19)
                   media.prelude = cell_value.toString();
               else if(j == 20)
                   media.effect = cell_value.toString();

               else if(j == 21)
                   media.version = cell_value.toString();
               else if(j == 22)
                   media.create_time = cell_value.toString();
               else if(j == 23)
                   media.stars = cell_value.toString();
               else if(j == 24)
                   media.hot = cell_value.toString();
               else if(j == 25)
                   media.count = cell_value.toString();

               else if(j == 26)
                   media.enabled = cell_value.toString();
               else if(j == 27)
                   media.black = cell_value.toString();
               else if(j == 28)
                   media.match = cell_value.toString();
               else if(j == 29)
                   media.update_time = cell_value.toString();
               else if(j == 30)
                   media.resolution = cell_value.toString();

               else if(j == 31)
                   media.quality = cell_value.toString();
               else if(j == 32)
                   media.source = cell_value.toString();
               else if(j == 33)
                   media.rhythm = cell_value.toString();
               else if(j == 34)
                   media.pitch = cell_value.toString();
               else if(j == 35)
                   media.info = cell_value.toString();

            }


            tempSave(media);
        }
    }

    excel->dynamicCall("Quit (void)");

    this->setCursor(Qt::ArrowCursor);
}
示例#27
0
void QEXCEL::setCellTextWrap(const QString &cell, bool isWrap)
{
    QAxObject *range = sheet->querySubObject("Range(const QString&)", cell);
    range->setProperty("WrapText", isWrap);
}
示例#28
0
void QEXCEL::setCellFontBold(const QString &cell, bool isBold)
{
    QAxObject *range = sheet->querySubObject("Range(const QString&)", cell);
    range = range->querySubObject("Font");
    range->setProperty("Bold", isBold);
}
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);
            textFont = pCellRange->querySubObject("Font");
            textFont->setProperty("Bold", true);

            pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 5, 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 + 5, 2);
            pCellRange = pCell->querySubObject("Range()");
            pCellRange->dynamicCall("InsertAfter(Text)", m_dbTable.at(row).group);
            textFont = pCellRange->querySubObject("Font");
            textFont->setProperty("Bold", true);

            table_row += 6;

            for (int i = 0; i < m_answerInfo.count(); i++) {
                if (m_dbTable.at(row).id == m_answerInfo.at(i).id) {
                    pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row, 1);
                    pCellRange = pCell->querySubObject("Range()");
                    pCellRange->dynamicCall("InsertAfter(Text)", "ВОПРОС");

                    pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row, 2);
                    pCellRange = pCell->querySubObject("Range()");
                    pCellRange->dynamicCall("InsertAfter(Text)", m_answerInfo.at(i).statement);

                    pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 1, 1);
                    pCellRange = pCell->querySubObject("Range()");
                    pCellRange->dynamicCall("InsertAfter(Text)", "ВЫБРАННЫЙ ВАРИАНТ");

                    pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 1, 2);
                    pCellRange = pCell->querySubObject("Range()");
                    pCellRange->dynamicCall("InsertAfter(Text)", m_answerInfo.at(i).chosenAnswer);

                    pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 2, 1);
                    pCellRange = pCell->querySubObject("Range()");
                    pCellRange->dynamicCall("InsertAfter(Text)", "ВЕРНЫЙ ВАРИАНТ");

                    pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 2, 2);
                    pCellRange = pCell->querySubObject("Range()");

                    if (m_answerInfo.at(i).isCorrectAnswer  == 1) {
                        pCellRange->dynamicCall("InsertAfter(Text)", "Верный ответ");
                    } else {
                        pCellRange->dynamicCall("InsertAfter(Text)", "Неверный ответ");
                    }

                    pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 3, 1);
                    pCellRange = pCell->querySubObject("Range()");
                    pCellRange->dynamicCall("InsertAfter(Text)", "УВЕРЕННОСТЬ");

                    pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row + 3, 2);
                    pCellRange = pCell->querySubObject("Range()");

                    if (m_answerInfo.at(i).assurance > 0) {
                        pCellRange->dynamicCall("InsertAfter(Text)", "Уверен");
                    } else if (m_answerInfo.at(i).assurance == 0) {
                        pCellRange->dynamicCall("InsertAfter(Text)", "Не уверен");
                    } else if (m_answerInfo.at(i).assurance == -1) {
                        pCellRange->dynamicCall("InsertAfter(Text)", "Не используется");
                    }

                    table_row += 4;
                }
            }

            //empty line
            pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row, 1);
            pCellRange = pCell->querySubObject("Range()");
            pCellRange->dynamicCall("InsertAfter(Text)", "");

            pCell = pNewTable->querySubObject("Cell(Row, Column)", table_row, 2);
            pCellRange = pCell->querySubObject("Range()");
            pCellRange->dynamicCall("InsertAfter(Text)", "");
            //empty line
            table_row++;
        }
    } else {
        QMessageBox::warning(0, "Внимание", "В выбранной Вами базе нет данных.");
    }
}
示例#30
0
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);

}