Description: You can add a picture to a form using com.sun.star.drawing.GraphicObjectShape, but the picture will fill the whole area, and I want to be able to display square images centered in a 16:9 rectangle. com.sun.star.drawing.RectangleShape seems to be able to do it, but when I set its FillBitmap property, no image is shown. Here is the full code: Steps to Reproduce: oGraphicsShape=ThisComponent.createInstance("com.sun.star.drawing.RectangleShape") aSize=CreateUnoStruct("com.sun.star.awt.Size") ratio=50706/1917 aSize.Width=222*ratio aSize.Height=125*ratio oGraphicsShape.setSize(aSize) aPoint=CreateUnoStruct("com.sun.star.awt.Point") aPoint.X=0 aPoint.Y=0 oGraphicsShape.setPosition(aPoint) oGraphicsShape.FillStyle=com.sun.star.drawing.FillStyle.BITMAP oGraphicsShape.FillBitmapLogicalSize=true oGraphicsShape.FillBitmapSizeX=100 oGraphicsShape.FillBitmapSizeY=100 url="file:///C:/Users/fodor/OneDrive/Documents/LibreOffice Bugs/testimage222x125.jpg" oProvider=createUnoService("com.sun.star.graphic.GraphicProvider") Dim args(0) as new com.sun.star.beans.PropertyValue args(0).Name = "URL" args(0).Value = url oGraphicsShape.FillBitmap = oProvider.queryGraphic(args()) oGraphicsShape.AnchorType=com.sun.star.text.TextContentAnchorType.AT_PAGE ThisComponent.DrawPage.add(oGraphicsShape) '------------------------------- oGraphicsShape=ThisComponent.createInstance("com.sun.star.drawing.GraphicObjectShape") oGraphicsShape.setSize(aSize) aPoint.Y=125 * ratio oGraphicsShape.setPosition(aPoint) oGraphicsShape.Graphic = oProvider.queryGraphic(args()) oGraphicsShape.AnchorType=com.sun.star.text.TextContentAnchorType.AT_PAGE ThisComponent.DrawPage.add(oGraphicsShape) Actual Results: On the top left corner of the page a blue rectangle is displayed, while below the actual picture. Expected Results: Two picture being displayed. Reproducible: Always User Profile Reset: Yes Additional Info:
Created attachment 153837 [details] Testimage.zip You need to change the URL of the picture in the code.
Wouldn't be linked to this change in the API, by any chance ? http://document-foundation-mail-archive.969070.n3.nabble.com/API-CHANGE-dropping-string-properties-which-use-vnd-sun-star-GraphicObject-URL-td4235349.html
Most certainly. Just like the other bug I reported, 127025.
@Tomaž : comments ? if the old way is deprecated, how is this kind of thing supposed to be done now ?
FWIW, I get a crash of LO6304 (with proposed recovery of crashed document) after running this macro in a blank Writer document. However, I can confirm that the blue shape appears in the top left hand corner of the page. The actual picture I tried to insert isn't displayed however, merely, an image placeholder beneath that blue shape. Then I get the crash.
For me, the error message before the crash is : Erreur d'exécution BASIC. Une exception s'est produite : Type: com.sun.star.lang.IllegalArgumentException Message: .
I get that error and the crash, if the URL of the picture is incorrect.
Indeed, I suspect the crash is due to a space in my path to the image file, which for some reason causes LO to baulk, even though it is surrounded by double quotation marks. Probably, a separate issue.
Changing component to Writer, as you only need a Writer document with the provided macro code to be able to reproduce the problem.
Marking as regression, but awaiting Tomaž' input.
It doesn't crash for me in Version: 6.4.0.0.alpha0+ Build ID: e8b3df5b9b0eb0a93c25b6dc2e445ae44a7e3f78 CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US Calc: threaded nor in Versión: 6.3.0.3 (x86) Id. de compilación: c75130c129d9c5e43b76e4f26881b3db8bdb5c91 Subprocs. CPU: 1; SO: Windows 6.1; Repres. IU: predet.; VCL: win; Configuración regional: es-ES (es_ES); Idioma de IU: es-ES Calc: threaded @Alex Thurgood, Does it crash with a clean profile ?
(In reply to Xisco Faulí from comment #11) > > @Alex Thurgood, Does it crash with a clean profile ? @Xisco : the crash is a red herring, I think, with regard to this bug report, due to the space in the path to my image ("Macintosh HD" on Mac). I intend to report that as a separate bug. The issue is, as Balint points out : "com.sun.star.drawing.RectangleShape seems to be able to do it, but when I set its FillBitmap property, no image is shown"
(In reply to Alex Thurgood from comment #12) > (In reply to Xisco Faulí from comment #11) > > > > > @Alex Thurgood, Does it crash with a clean profile ? > > @Xisco : the crash is a red herring, I think, with regard to this bug > report, due to the space in the path to my image ("Macintosh HD" on Mac). I > intend to report that as a separate bug. > > The issue is, as Balint points out : > > "com.sun.star.drawing.RectangleShape seems to be able to do it, but when I > set its FillBitmap property, no image is shown" I seee, then please fill the crash in a separate issue. Regarding the RectangleShape issue, if I remember well, the code must be adapted, I remember a similar issue about it. @Raal, do you remember? Lowering severity anyway...
I can also repeat the initially reported behaviour with : Version: 6.0.7.3 Build ID: 1:6.0.7-0ubuntu0.18.04.9 Threads CPU : 4; OS : Linux 4.4; UI Render : par défaut; VCL: gtk3; Locale : fr-FR (fr_FR.UTF-8); Calc: group Blue background rectangle displayed in top left hand corner. Image displayed underneath blue rectangle.
And also reproduced with : Version: 6.3.0.4 Build ID: libreoffice-6.3.0.4-snap1 Threads CPU : 4; OS : Linux 4.4; UI Render : par défaut; VCL: gtk3; Locale : fr-FR (fr_FR.UTF-8); Langue IHM : fr-FR Calc: threaded
The problem seems to be linked to anchoring of the object : Process 10694 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x00000001842dfa4b libswlo.dylib`SwFEShell::ShouldObjectBeSelected(this=0x00000001803f9f40, rPt=0x00007ffeefbfe8b8) at feshview.cxx:1361:83 1358 { 1359 if ( pObj->GetLayer() == rIDDMA.GetHellId() ) 1360 { -> 1361 const SwAnchoredObject* pAnchoredObj = ::GetUserCall( pObj )->GetAnchoredObj( pObj ); 1362 const SwFrameFormat& rFormat = pAnchoredObj->GetFrameFormat(); 1363 const SwFormatSurround& rSurround = rFormat.GetSurround(); 1364 if ( rSurround.GetSurround() == css::text::WrapTextMode_THROUGH ) Target 0: (soffice) stopped.
(In reply to Alex Thurgood from comment #16) Sorry, wrong bug, apols.
Created attachment 161694 [details] Image inserted Inserting the image works for me. Not sure, if the result is as the reporter intended, so attaching this screenshot Steps: 1. Unzip attachment 153837 [details] and open .odb 2. Modify the included macro to correct the path of the image 3. Double-click Form1 to open it 4. Click the button Please everyone re-test. Arch Linux 64-bit Version: 7.1.0.0.alpha0+ Build ID: 2bccbd2ba6c90d5e02285629c2b079c35260c08b CPU threads: 8; OS: Linux 5.6; UI render: default; VCL: kf5 Locale: fi-FI (fi_FI.UTF-8); UI: en-US Calc: threaded Built on 3 June 2020
(In reply to Buovjaga from comment #18) > Arch Linux 64-bit > Version: 7.1.0.0.alpha0+ > Build ID: 2bccbd2ba6c90d5e02285629c2b079c35260c08b > CPU threads: 8; OS: Linux 5.6; UI render: default; VCL: kf5 > Locale: fi-FI (fi_FI.UTF-8); UI: en-US > Calc: threaded > Built on 3 June 2020 Sorry, this was actually with stable Arch Linux 64-bit Version: 6.4.4.2 Build ID: 6.4.4-1 CPU threads: 8; OS: Linux 5.6; UI render: default; VCL: kf5; Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US Calc: threaded
Dear Balint Fodor, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
Re-test requested in 2020, no reaction, so let's set this to needinfo.