Bug 111731 - changing properties of inserted graphic-objects via macro (Basic) causes file store error
Summary: changing properties of inserted graphic-objects via macro (Basic) causes file...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: needsDevAdvice
Depends on:
Reported: 2017-08-12 15:51 UTC by Thomas Krumbein
Modified: 2019-04-30 08:41 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

error message during storing prozess (120.35 KB, image/png)
2017-08-12 15:51 UTC, Thomas Krumbein
testfile with macro (69.99 KB, application/vnd.oasis.opendocument.text)
2017-08-12 15:52 UTC, Thomas Krumbein

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Krumbein 2017-08-12 15:51:09 UTC
Created attachment 135491 [details]
error message during storing prozess


You do have a writer document and insert a picture/graphic via UI (Icon or menu insert-> picture). 
- store that file.  

Everything is ok.

Now you manipulate the properties of ths graphic object via API - in ths case with basic macros. 

- I checked size, position and some others.

- works fine during processing and visible on screen (UI).

Try to store document afterwards it will cause a error message, that the "content.xml" can not be written. (see attaches pic 1).

You cannot store document - not even with "store as".

You can kill the document.... or delete the manipulated graphic. this takes away the error. 

Attached is a sample-file to show the behaviour:
Store the file on a local drive. Open it. accept Macros.

add same text or something. store the file  -> ok

select the graphic, run the macro. Pic ist reduced in size. 

now try to store the doc again.....

Included small macro just for test:

Sub ChangeBildSize

  oDoc = thisComponent

  sName = oDoc.CurrentController.ViewCursor.textframe.name
'msgbox sName

  oObj = oDoc.GraphicObjects.getbyName(sName) 
REM Change size
  oSize = oObj.getSize()
  oSize.Height = oSize.Height/2
  oSize.Width = oSize.Width/2

End Sub
Comment 1 Thomas Krumbein 2017-08-12 15:52:30 UTC
Created attachment 135492 [details]
testfile with macro
Comment 2 Thomas Krumbein 2017-08-12 16:46:54 UTC
Some more information:

problem causes in this line:

  sName = oDoc.CurrentController.ViewCursor.textframe.name

I do not know why, but this line removes the supported service "com.sun.star.text.TextGraphicObject" out of the graphic-object - and couses in the descripted problems.

Just removing this line and pass the name of the pic manually 

sName = "Bild1"

and all manipulations works fine inclusive storing. 

so, maybe it helps you?
Comment 3 Regina Henschel 2017-08-12 22:53:44 UTC
If the document is in this state it hangs in a loop while automatic saving and process needs to be killed.
Comment 4 Xisco Faulí 2018-10-19 12:17:35 UTC
Hi Thomas,
Some changes have been done to image handling in 6.1 version
Could you please try to reproduce it with the latest version of LibreOffice
from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' if the bug is still present in the latest version.
Comment 5 Thomas Krumbein 2018-10-25 06:11:31 UTC
Just tested with LibreOffice (x64) on Windows 10 : 

Still the same behaviour. No change.

Status is set to UNCONFIRMED
Comment 6 Xisco Faulí 2019-04-30 08:41:59 UTC
Reproduced in

Build ID: f45f8d0c6eb1d5d28a92399b82d13c2894f06069
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

in previous versions

Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e

LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-

it crashes at export time...

@Miklos, I thought you might be interested in this issue...