Au moment où j'ai le code suivant:C++ comment exporter un tableau pour exceller
int ExportToExcel(short *data, int nof_rows, int nof_cols)
{
HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hr))
{
cout << "Failed to initialize COM library. Error code = 0x" << hex << hr << endl;
return hr;
}
Excel::_ApplicationPtr pXL;
if (FAILED(pXL.CreateInstance("Excel.Application")))
{
cout << "Failed to initialize Excel::_Application!" << endl;
return -1;
}
Excel::_WorkbookPtr workbook = pXL->Workbooks->Add(Excel::xlWorksheet);
Excel::_WorksheetPtr pSheet= pXL->ActiveSheet;
pSheet->Name = "arr_1";
Excel::RangePtr pRange = pSheet->Cells;
for(int i=1; i<=nof_rows; i++)
for(int j=1;j<=nof_cols; j++)
pRange->Item[i][j] = *data++;
pXL->Visible=true;
return 0;
}
Mais la mise en œuvre ci-dessus se trouve être très lent ..
Toute idée comment verser le tableau dans un moyen plus efficace?