Apache OpenOffice (AOO) Bugzilla – Issue 115745
OO crashes when repeatedly triggering API commands
Last modified: 2017-05-20 11:27:43 UTC
When creating a document programmatically using the open office API, we need to insert occasional sleep statements to make it work halfway stable. Removing the these statements in code such as the following, makes OO crash. for (int i = 2; i < 3000; i++) { String sCellName = "A" + (i-1); XText cellText = (XText)xTextTable.getCellByName (sCellName); XTextCursor cursor = cellText.createTextCursor(); XTextViewCursor viewCursor = cursorSup.getViewCursor(); viewCursor.gotoRange(cursor, false); XDispatchHelper xDispatchHelper = (XDispatchHelper)multiServiceFactory.createInstance( "com.sun.star.frame.DispatchHelper"); PropertyValue[] tableArgs = new unoidl.com.sun.star.beans.PropertyValue[0]; xDispatchHelper.executeDispatch((XDispatchProvider)frame, ".uno:InsertRows", "", 0, tableArgs); xTextTable.getCellByName ("A" + i).setValue (22.5); System.Threading.Thread.Sleep(5); xTextTable.getCellByName ("B" + i).setValue (5615.3); System.Threading.Thread.Sleep(5); xTextTable.getCellByName ("C" + i).setValue (-2315.7); System.Threading.Thread.Sleep(5); xTextTable.getCellByName ("D" + i).setValue (-315.7); System.Threading.Thread.Sleep(5); if (i%100==0) { Console.WriteLine("Row: " + i); System.Threading.Thread.Sleep(50); } } Is this a known issue? Please fix it!!!
jsc -> nn: seems to be one for calc
change prio to P3
It's about Writer tables, not Calc.
.
mattraffic: why do you use the dispatch? did you try using only API calls? I think this is more for dev@api.openoffice.org than for an issue.
arielch: Yes, we tried using only the API before, but had the same problem. This code will crash OO Writer as well: for (int i = 2; i < 3000; i++) { { String sCellName = "A" + (i - 1); XText cellText = (XText)xTextTable.getCellByName(sCellName); cellText.setString("value" + i); } { String sCellName = "B" + (i - 1); XText cellText = (XText)xTextTable.getCellByName(sCellName); cellText.setString("value" + i); } { String sCellName = "C" + (i - 1); XText cellText = (XText)xTextTable.getCellByName(sCellName); cellText.setString("value" + i); } { String sCellName = "D" + (i - 1); XText cellText = (XText)xTextTable.getCellByName(sCellName); cellText.setString("value" + i); } if (i % 100 == 0) { Console.WriteLine("Row: " + i); } }
Created attachment 75209 [details] NetBeans project showing how it works
arielch->mattraffic: please http://www.openoffice.org/nonav/issues/showattachment.cgi/75209/TableSample.zip Using pure API calls, it works with a 3000 row text table, in less than one minute when the document is HIDDEN. When the document is visible, it takes longer, but it does not crash. Using the Dispatch API here is a no-go. arielch->os: I think this can be closed as invalid.
OK, it seems your sample is working... We should have mentioned in the first place that we are doing all this using the C# API. Sorry for the misunderstanding. Maybe you can have another look?
arielch->mattraffic: sorry, I know nothing about C#. But OOo API is basically the same in all the language bindings it supports. It should be easy for you to translate the Java example to C#. Also you could attach your code to this issue, so that someone in the know of C# stuff can take a closer look.
Reset assigne to the default "issues@openoffice.apache.org".