To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=50263
                  Issue #:|50263
                  Summary:|setDataArray on large arrays completely locks OOo and
                          |windows
                Component:|Spreadsheet
                  Version:|current
                 Platform:|PC
                      URL:|
               OS/Version:|All
                   Status:|UNCONFIRMED
        Status whiteboard:|
                 Keywords:|
               Resolution:|
               Issue type:|DEFECT
                 Priority:|P3
             Subcomponent:|programming
              Assigned to:|spreadsheet
              Reported by:|marinus





------- Additional comments from [EMAIL PROTECTED] Thu Jun  2 18:52:55 -0700 
2005 -------
Sirs,

setDataArray and getDataArray on large arrays lock not only OOo but effectively
shuts down Windows XP.
Trying to access the Windows XP taskmanager takes about 30 seconds on a P4 2800
with 256 MB.

This simple basic demonstrates what happens when trying to get/set with
setDataArray pointing to a whole Calc sheet.

Somehow it would be useful, if this in inherent to this function, to have some
sort of API protection when trying to access such large arrays.

Sample code:

sub Main
   oDoc = ThisComponent
   oSheets = oDoc.getSheets()

   oSheet1 = oSheets.getByName("Sheet1")
   oSheet2 = oSheets.getByName("Sheet2")

   ' If you want the whole sheet just set (in OOo 2.0)..
   
   nColumn = 1

   nTimer1 = Timer()
   'for nRow = 1 to 65536
   '   if nRow / 256 = nColumn then nColumn = nColumn + 1
   '   if nColumn > 256 then exit for
   '   oCell = oSheet1.getCellByPosition(nColumn - 1, nRow - 1).setValue(nRow)
   'next
   nTimer2 = Timer()
   
   ' 0 seconds
   sCellRangeName = "A1:IV10"
   ' 2 seconds on P4 2800
   sCellRangeName = "A1:IV1000"
   ' 19 seconds on P4 2800
   sCellRangeName = "A1:IV10000"
   ' kills it
   ' sCellRangeName = "A1:IV65536"
  
   oCopyCellRange = oSheet1.getCellRangeByName(sCellRangeName)
   
   oPasteCellRange = oSheet2.getCellRangeByName(sCellRangeName)
   
   
   ' and copy/paste all cells 
   oPasteCellRange.setDataArray(oCopyCellRange.getDataArray)
   nTimer3 = Timer()




   'assuming midnight not passed
   nTotalWriteSeconds = nTimer2 - nTimer1
   nWriteMinutes = Fix(nTotalWriteSeconds / 60)
   nWriteSecondsLeft = nTotalWriteSeconds - nWriteMinutes * 60
   
   nTotalCopyPasteSeconds = nTimer3 - nTimer2
   nCopyPasteMinutes = Fix(nTotalCopyPasteSeconds / 60)
   nCopyPasteSecondsLeft = nTotalCopyPasteSeconds - nCopyPasteMinutes * 60

   nTotalSeconds = nTimer3 - nTimer1
   nTotalMinutes = Fix(nTotalSeconds / 60)
   nTotalSecondsLeft = nTotalSeconds - nTotalMinutes * 60

   sWrite = "Writing took " + nWriteMinutes + " minutes and " +
nWriteSecondsLeft + " seconds."
   sCopy = "Copy/paste took " + nCopyPasteMinutes + " minutes and " +
nCopyPasteSecondsLeft + " seconds."
   sTotal = "Total operation took " + nTotalMinutes + " minutes and " +
nTotalSecondsLeft + " seconds."
   msgbox sWrite + Chr(13) + sCopy + Chr(13) + sTotal
   
end sub

Sample spreadsheet with macro attached.

Hope this helps,

Marinus.

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to