Hi Guys, I tried to modified my original slow example to use array updates (setDataArray) based on the example in the wiki. http://wiki.openoffice.org/wiki/Calc/API/Programming When I call setDataArray(arr1), the program terminates with error on screen "***Error couldn't get sheet" The relevant portion of code is pasted below. I get CellRangeData. I prepare a sequence of sequence and call cellrangedata->setDataArray(SofS) Would someone be able to point out what is wrong here? Thanks Neeraj ==================== portion of attached code giving me problems: void fillLines (Reference< XSpreadsheetDocument > myDoc) { printf("Fill the lines\n"); Reference < XSpreadsheets > xSheets = myDoc->getSheets() ; Reference < XIndexAccess > oIndexSheets ( xSheets, UNO_QUERY); Any any = oIndexSheets->getByIndex(0); Reference < XSpreadsheet > xSheet ( any, UNO_QUERY); // Reference < XCellRange > xCellRange = xSheet->getCellRangeByPosition (0, 0, X, Y); // Reference < XCellRangeData > xCellRangeData (xCellRange, UNO_QUERY); Reference< XModel > rSpreadsheetModel (myDoc, UNO_QUERY); Reference< XInterface > rInterface = rSpreadsheetModel->getCurrentSelection(); Reference< XCellRange > xCellRange(rInterface,UNO_QUERY); Reference< XCellRangeData> xCellRangeData(xCellRange, UNO_QUERY); Sequence < Sequence < Any > > arr1 (X+1); Sequence < Any > arr2 (Y+1); for (int ii=0; ii < 120; ++ii) { for (int jj=0; jj < X; ++jj) { for (int kk=0; kk < Y; ++kk) { int val = jj+kk+ii+2; arr2[kk+1] <<= val; } arr1[jj+1] = arr2; } printf("[%d] b4 set data array\n", ii); xCellRangeData->setDataArray(arr1); printf("[%d] set data array\n", ii); } //*************************************************************************** } -----Original Message----- From: Rai, Neeraj [ICG-MKTS] Sent: Friday, December 28, 2012 3:56 PM To: 'libreoffice@lists.freedesktop.org' Subject: [libreoffice-dev] - ScalcBT.cxx C++ using new uno bootsrap is slow Hi , Hope this is the right forum for the question below. If not, please point me in the right direction. I have written a new version of Scalc.java in C++, this time using UNO bootstrap mentioned in examples/DevelopersGuide/Components/CppComponents. The last version I wrote used examples/cpp/DocumentLoader and examples/java/Scalc.java. It expected soffice listening on a port and was too slow. Even this version is not as fast as I would have expected, and I would like to know what may be done to speed it up. The 500x12 cell updated 120 times in 60sec. I used gettimeofday to measure time for 3 cases writing same amount of data : A) write 5000 rows of 12 cols (~60sec) B) write 5000x12 entries to a single cell (~40sec) C) write 10 rows of 50 cols, 120 times (~60sec) If I read a file with 100,000x12 cell from disk, it takes 20 seconds - so I am hopeful that this example can be speeded up. The box is running RHEL 6.3, 2 cpu with 4 cores and 16GB of RAM. The attached files can be dropped into any cpp example dir and built. The makefile is copied from DocumentLoaded. Any pointers/googlable keywords/web links would be highly appreciated. Thanks Neeraj
Attachment:
Makefile
Description: Makefile
Attachment:
SCalcBT.cxx
Description: SCalcBT.cxx