[Issue] LibO: unable to get embed picture URL

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
Mr.Dandy
Posts: 451
Joined: Tue Dec 11, 2012 4:22 pm

[Issue] LibO: unable to get embed picture URL

Post 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?
Attachments
libo_comment.ods
(41.87 KiB) Downloaded 15 times
Last edited by Mr.Dandy on Thu Nov 07, 2024 4:25 pm, edited 1 time in total.
OpenOffice 4.1.12 - Windows 10
User avatar
Lupp
Volunteer
Posts: 3620
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Where is the background image for an annotation?

Post 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
On Windows 10: LibreOffice 24.8.3 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Mr.Dandy
Posts: 451
Joined: Tue Dec 11, 2012 4:22 pm

Re: Where is the background image for an annotation?

Post by Mr.Dandy »

Hmm, I found OriginURL property but this is an empty string.
OpenOffice 4.1.12 - Windows 10
User avatar
Lupp
Volunteer
Posts: 3620
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Where is the background image for an annotation?

Post 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.
On Windows 10: LibreOffice 24.8.3 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Mr.Dandy
Posts: 451
Joined: Tue Dec 11, 2012 4:22 pm

Re: Where is the background image for an annotation?

Post 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? :(
OpenOffice 4.1.12 - Windows 10
Bidouille
Volunteer
Posts: 599
Joined: Mon Nov 19, 2007 10:58 am
Location: France

Re: Where is the background image for an annotation?

Post 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
User avatar
Lupp
Volunteer
Posts: 3620
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Where is the background image for an annotation?

Post 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.
On Windows 10: LibreOffice 24.8.3 and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Mr.Dandy
Posts: 451
Joined: Tue Dec 11, 2012 4:22 pm

Re: Where is the background image for an annotation?

Post 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.
OpenOffice 4.1.12 - Windows 10
Post Reply