在qt5下的把excel的内容导入到sql当中MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
qDebug()<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()<<"路径"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(); //获取行
1