Insert Image Anchor As Character

No matter how I change the styles.xml file in the for LibreOffice writer, the default anchor type for any image is always “To Character.” Ideally, I’d want it to be “As Character” but I can’t change it at all to any other anchor type. How can I fix this? When I apply this styles.xml fix to OpenOffice Writer it works, but for LibreOffice it doesn’t. Please I’m desperate.

You may be interested in bug report / enhancement request tdf#32484 - Allow anchor settings in frame styles, which I understand as: “I can’t be changed” (but may be I did not fully understand the report, so take your own conclusion).

See also tdf#99646 - Make default type of anchoring optional

For our questioner who seems to be capable of reworking the wrapped-in styles.xml of a Writer template, it should be rather simple, to write a little macro for importing images: use filepicker service, insertTextContent()… and to apply the suitable frame style and the anchor type by the macro. The rest is just to customize the macro into a menu and/or a toolbar. The insertion of the image iztself can even be done by the lines of a recorded macro, and also the change of the anchor type works though the recorded macro comments it out. (Just remove the “rem”.)
Of course it should be preferrable to get the choice via frame styles / templates / default m,enus, but I don’t know if there are problems with the ODF specification…

I, too, would like inserted images to default to “as character” anchor. I can’t tell from the discussion whether there is an answer here, as I’m not sure what a “frame style” is vs. just the default setting for inserting an image. I did find another possible answer in this old, closed thread, but the styles.xml file for my default style does not have a style named “Graphics” (or “graphics”). Is there an available solution for this?

The problem comes from the fact that a frame style definition does not record the anchor type.

I probably have a different workflow with Writer (or a biased understanding on how it should be used) and I never came to an acceptable explanation.

The absence of the anchor in frame style Type tab looks like a contradiction for me. This tab allows to set the position parameters but these parameters are nonsense if you don’t specify the reference (the anchor).

Apparently, you can apply the same frame style to any “object” (frame, drawing, picture, …) no matter how it is anchored. But, the position parameters do not apply if the anchor is As character because they belong in a different set.

Note also the contradiction (as emphasized in one of the mentioned bug reports) in the built-in styles which include a non user-changeable anchor and user styles where this can’t be set (or rather is To paragraph and needs to be overridden with direct-formatting when applied).

There is however an ugly workaround. It requires you are familiar with styles.

Frame styles Formula and Labels have anchor As character whereas the others are To paragraph and To page for Watermark.

Create your own frame style right-clicking on Formula or Labels and New. The new style will inherit all its initial attributes from Formula/Labels, notably the anchor mode. Adjust all parameters to your needs.

Apply your user style to the inserted object. It becomes a “super-character” in the paragraph. If you apply this style to an existing object, it will not be positioned where you want it. Since you can’t apparently drag and drop it, move the surrounding text instead before or after it.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

I had placed a comment, but removed it again, because a relevant detail was wrong.
I coludn’t verify what you described, but my own “research results” were inconsistent on the level I could reach. Just wasted time?
Having tried with a virgin user profile, the situation was unchanged.
Even if the Graphics style has set AnchorType = 1 (“As Character”) by user code, a newly inserted image shows this type as the applied one, but has nonetheless settings not conforming with it. In specific the .AnchorType is “To Character”, but also size settings are ignored. I need (e.g.) to apply a different frame style, and then Graphics again, to get what I want.
It seems as if on insertion of an image a built in styling is applied which cannot be changed by applying the shown style again. “Change to final OR change and change again” is my way then.
Funny? A mess!

@Lupp: I noticed this strange behaviour and when I change frame style properties, I apply another style and reapply the intended one. Unfortunately this is not practical for “margin icons” I use to flag “important” paragraphs: there are too many for them to be restyled by hand. I think this is a bug but the mentioned bug reports show there are many issues in frame styles. Shame because this limits seriously the formatting power and versatility of frame styles.

PS: One of the bug reports says that many attributes are “direct applied” (quote from the report). This could be the cause because direct formatting has precedence over style settings.

Yes. Might it help to make Ctrl+M applicable to framed objects? Too radical?

I don’t know. Parameter update seems to be problematic only with position. From quick experiment, other parameters changed in the style are immediately forwarded to all instances.

IMHO, the real fix is to make all parameters style-standard, i.e. non direct-applied, so that we have the “traditional” hierarchy direct format > frame style > application defaults (which in case of frames?)