Hi all
I manipulate excel with qt an all is working almost well.
Just one issue : I don't success to cpoy/move a sheet in the current workbook
I have try :
sheet->dynamicCall("Copy");
sheet->dynamicCall("Move");
but the result is a copy/move to a new workbook
HOw can I solve this?
Thanks
qint16 xl_test_start_line = 16;
qint16 sheet_number;
//Launch Excel
if (ui->check_button_excel->isChecked())
{
workbooks = excel->querySubObject( "Workbooks" );
workbook = workbooks->querySubObject( "Open(const QString&)",excel_path );
sheets = workbook->querySubObject( "Worksheets" );
if ( ui->radioButton_XLVisible->isChecked())
excel->setProperty("Visible", true);
int count = sheets->dynamicCall("Count()").toInt();
count = sheets->property("Count").toInt();
//Get sheets name list
for (int i = 1; i <= count; i++)
{
QAxObject * worksheet
= workbook
->querySubObject
("Worksheets(int)", i
);
sheets_name.push_back(worksheet->property("Name").toString());
number_of_test.push_back(0);
}
sheet = sheets->querySubObject( "Item( int )", 5 );
}
sheet->dynamicCall("Copy");
QAxObject* sheet;
QStringList sheets_name;
QAxObject* workbooks;
QAxObject* workbook;
QAxObject*sheets;
QString campaign_sheet_name;
QAxObject * excel_cell ;
QAxWidget* excel;
qint16 xl_test_start_line = 16;
qint16 sheet_number;
//Launch Excel
if (ui->check_button_excel->isChecked())
{
excel = new QAxWidget("Excel.Application");
workbooks = excel->querySubObject( "Workbooks" );
workbook = workbooks->querySubObject( "Open(const QString&)",excel_path );
sheets = workbook->querySubObject( "Worksheets" );
if ( ui->radioButton_XLVisible->isChecked())
excel->setProperty("Visible", true);
int count = sheets->dynamicCall("Count()").toInt();
count = sheets->property("Count").toInt();
//Get sheets name list
for (int i = 1; i <= count; i++)
{
QAxObject * worksheet = workbook->querySubObject("Worksheets(int)", i);
sheets_name.push_back(worksheet->property("Name").toString());
number_of_test.push_back(0);
}
sheet = sheets->querySubObject( "Item( int )", 5 );
}
sheet->dynamicCall("Copy");
To copy to clipboard, switch view to plain text mode
Bookmarks