QT5的SQL数据导入exceldemo

时间:2020-09-23 15:21:40
【文件属性】:

文件名称:QT5的SQL数据导入exceldemo

文件大小:7KB

文件格式:RAR

更新时间:2020-09-23 15:21:40

qt5 sql excel

在qt5下的把excel的内容导入到sql当中MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); qDebug()<setIcon(icon); openAction->setShortcut(QKeySequence(tr("ctrl+O"))); ui->menu->addAction(openAction) ; oid MainWindow::open_file_func()//从excel中导入到sql中//存入到对应表时,要写相应的表明 { QString filePath =QFileDialog::getOpenFileName(this,"open","../","excel(*.xlsx *.xls)"); if(filePath.isEmpty()==false) { qDebug()<<"路径"<dynamicCall("Open (const QString&)", filePath); QAxObject *work_book = excel.querySubObject("ActiveWorkBook"); QAxObject *work_sheets = work_book->querySubObject("Sheets"); //Sheets也可换用WorkSheets int sheet_count = work_sheets->property("Count").toInt(); //获取工作表数目 if(sheet_count > 0) { QAxObject *work_sheet = work_book->querySubObject("Sheets(int)", 1); QAxObject *used_range = work_sheet->querySubObject("UsedRange"); QAxObject *rows = used_range->querySubObject("Rows"); QAxObject *columns = used_range->querySubObject("Columns"); int row_count = rows->property("Count").toInt(); //获取行


【文件预览】:
sql_excel_sqlite_1
----mainwindow.ui(2KB)
----mainwindow.cpp(8KB)
----sql_excel_sqlite.pro.user(63KB)
----说明.txt(209B)
----main.cpp(183B)
----mainwindow.h(395B)
----sql_excel_sqlite.pro(405B)

网友评论

  • 导入功能?