Created attachment 50453 [details] The circle inside this drawing document. When I copy the circle from the draw document and I try to past it in a writer document I get a crash.
Eerily this bug was reported after bug 40267, which I believe are very similar. For now, mark as duplicate. *** This bug has been marked as a duplicate of bug 40267 ***
Hello, It seems there is a problem with the LineWidth property. Please, try the below code. If the line leCercle.LineWidth =50 is not commented, I get a crash. Sub InsereUnCercle oDocument = ThisComponent Dim mFileProperties(1) As New com.sun.star.beans.PropertyValue Dim leCercle as Object Dim dimensionsForme As New com.sun.star.awt.Size Dim positionForme As New com.sun.star.awt.Point mFileProperties(0).Name = "Hidden" mFileProperties(0).Value = False mFileProperties(1).Name="MacroExecutionMode" mFileProperties(1).Value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN oDesktop = createUnoService("com.sun.star.frame.Desktop") sUrl = "private:factory/sdraw" oDocumentF = oDesktop.LoadComponentFromURL(sUrl,"_blank",0,mFileProperties()) oPageF = oDocumentF.Drawpages(0) leCercle = oDocumentF.createInstance("com.sun.star.drawing.EllipseShape") dimensionsForme.Width = 5000 dimensionsForme.Height = 3000 positionForme.x =3000 positionForme.y = 5000 leCercle.Size = dimensionsForme leCercle.Position = positionForme leCercle.FillStyle = 0 Rem uncomment this following line leCercle.LineWidth =50 oPageF.add(leCercle) oDocumentF.CurrentController.Select(leCercle) ClipboardCopy(oDocumentF) ClipboardPaste(oDocument) ToucheEchap (oDocument) End Sub Sub ClipboardPaste( oDocumentFrame ) DocumentDispatch( oDocumentFrame, ".uno:Paste" ) End Sub Sub ClipboardCopy( oDocumentFrame ) DocumentDispatch( oDocumentFrame, ".uno:Copy" ) End Sub Sub ToucheEchap ( oDocumentFrame ) DocumentDispatch( oDocumentFrame, ".uno:Escape" ) End Sub Sub DocumentDispatch( ByVal oDocumentFrame As Object,_ ByVal cURL As String,_ Optional cTargetFrameName,_ Optional nSearchFlags,_ Optional aDispatchArgs ) dim oDispatchHelper If Not HasUnoInterfaces( oDocumentFrame, "com.sun.star.frame.XFrame" ) Then oDocumentFrame = GetDocumentFrame( oDocumentFrame ) EndIf If IsMissing( cTargetFrameName ) Then cTargetFrameName = "" EndIf If IsMissing( nSearchFlags ) Then nSearchFlags = 0 EndIf If IsMissing( aDispatchArgs ) Then aDispatchArgs = Array() EndIf oDispatchHelper = createUnoService( "com.sun.star.frame.DispatchHelper" ) oDispatchHelper.executeDispatch( oDocumentFrame, cURL, cTargetFrameName, nSearchFlags, aDispatchArgs ) End Sub Function GetDocumentFrame( oDoc As Object ) As Object Dim oFrame As Object Dim oCtrl As Object If oDoc.supportsService( "com.sun.star.document.OfficeDocument" ) Then oCtrl = oDoc.getCurrentController() oFrame = oCtrl.getFrame() ElseIf HasUnoInterfaces( oDoc, "com.sun.star.frame.XController" ) Then oCtrl = oDoc oFrame = oCtrl.getFrame() ElseIf HasUnoInterfaces( oDoc, "com.sun.star.frame.XFrame" ) Then oFrame = oDoc Else MsgBox( "GetDocumentFrame called with incorrect parameter." ) EndIf GetDocumentFrame() = oFrame End Function