Page 1 of 1

[Issue] LibO: unable to get embed picture URL

Posted: Wed Oct 30, 2024 10:58 am
by Mr.Dandy
In a sheet, I've added an annotation (comment) to a cell. Then I set the background with an image.
But I can't get the URL in LibreOffice.

Try this

Code: Select all

Sub Test
	GlobalScope.BasicLibraries.loadLibrary ("XrayTool")
	oDoc = ThisComponent
	oStorage = oDoc.DocumentStorage.getByName("Pictures")
	aElem = oStorage.getElementNames()
	for each sItem in aElem
		msgbox sItem
	next
	oSheet = oDoc.CurrentController.ActiveSheet
	oSel = oDoc.CurrentSelection
	oShape = oSel.Annotation.AnnotationShape
	oBMP = oShape.FillBitmap
	xray oBMP


End sub
DocumentStorage returns the embedded picture
But where is the jpg in oBMP?

Re: Where is the background image for an annotation?

Posted: Wed Oct 30, 2024 12:29 pm
by Lupp
The file name is "zebra.png".
But on my system I only find it in

Code: Select all

\...\Documents\libosource\e\libreoffice-6.1.1.1\extras\source\gallery\backgrounds\
once (2018-08-24) created for an old version of LibO.
Into your .ods file the image is embedded as

Code: Select all

libo_comment.ods\Pictures\1000000000000200000002001F673D806C17C97F.png
I don't know a way to find this without inspecting the (closed) file.
In your example saved as .fods it looks this way:
libo_comment.AnnotationBackground.ods
(106.88 KiB) Downloaded 17 times

Re: Where is the background image for an annotation?

Posted: Sat Nov 02, 2024 11:37 am
by Mr.Dandy
Hmm, I found OriginURL property but this is an empty string.

Re: Where is the background image for an annotation?

Posted: Sat Nov 02, 2024 6:37 pm
by Lupp
1.
As far as I can see the mentioned property OriginURL is only supported in LibO since V 6.1.
2.
The property is only set for images inserted as links.
3.
The area backgrounds for Calc annotations can't be loaded as links.
4.
Writer annotations have no Area properties.

Re: Where is the background image for an annotation?

Posted: Wed Nov 06, 2024 9:35 am
by Mr.Dandy
Lupp wrote: Sat Nov 02, 2024 6:37 pm The property is only set for images inserted as links.
So where I find the property to see the embedded picture URL? :(

Re: Where is the background image for an annotation?

Posted: Wed Nov 06, 2024 11:24 am
by Bidouille
Sadly, there is no way to get this information since LibO 6.1.x
In this bug report https://bugs.documentfoundation.org/sho ... ?id=119899
Fatal answer:
Currently you can't

Re: Where is the background image for an annotation?

Posted: Wed Nov 06, 2024 1:02 pm
by Lupp
The original report and the posts below in bug tdf#119899 are somehow misleading.
1. The effect is independent of the used programming language.
2. The property .OriginURL still contains the image's filepath if the image is inserted as link.
3. I forgot how LibO did it in very old versions. They may possibly have stored the URL even if the image was embedded. If so, the information gave some insight into the file system of the source computer if the document was delivered to somebody else. To avoid this may have been a reason to set the url = "" if the picture was embedded. Very faintly I remember a related discussion.
Just tested With LibO V3.3. The path (different property names) gave for an embedded image a cryptic internal storage (starting with vnd.star...) with many digits at the end. This is no longer supported.

Re: Where is the background image for an annotation?

Posted: Thu Nov 07, 2024 4:23 pm
by Mr.Dandy
The real sentence will be "actually, you can no longer" :evil:
I find it hard to understand why a new API reduces the possibilities.