[Solved] Fail to set Anchor as Character (Default)

Discuss the word processor
Post Reply
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

[Solved] Fail to set Anchor as Character (Default)

Post by nomnex »

http://user.services.openoffice.org/en/ ... =7&t=24871

Does not work for me on LO 3.3.4

I enclosed a sample document.



Updating the Graphics frame style has no effect. The following images I insert are always anchored to the paragraph.
Last edited by nomnex on Fri Oct 05, 2012 7:56 am, edited 4 times in total.
User avatar
Hagar Delest
Moderator
Posts: 32627
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Fail to set Anchor as Character (Default)

Post by Hagar Delest »

Have you tried to tweak the styles.xml file as indicated in the bug report (I've fixed the links, changed after the move to Apache)?
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Fail to set Anchor as Character (Default)

Post by acknak »

You can also try loading the frame style from the document in this post: http://user.services.openoffice.org/en/ ... 02#p211302

There are some instructions there too if you look down a couple of posts.

That works for me with LibO 3.5
AOO4/LO5 • Linux • Fedora 23
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

Re: Fail to set Anchor as Character (Default)

Post by nomnex »

Hagar Delest wrote:Have you tried to tweak the styles.xml file as indicated in the bug report (I've fixed the links, changed after the move to Apache)?
Actually the link to bug 19814 in both threads were pointing to a wrong direction. Glad you fixed them. It's working great now.

I had to unchecked Size optimization for ODF in the LibreOffice general option to read the file with a XML editor. Do I check it back? does it make any difference.

To edit the styles.xml, I changed the .odf in .zip, unzip, modified the styles.xml, zip, changed the extension to .odf. Is it the way to do it? It works equally without modifying the .odf extension.

As for acknack suggestion to load the frame style from the document, that's exactly what I did to propagate the change to my existing templates. Thanks to both of you.
Last edited by nomnex on Tue Sep 25, 2012 3:11 am, edited 1 time in total.
User avatar
Hagar Delest
Moderator
Posts: 32627
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Fail to set Anchor as Character (Default)

Post by Hagar Delest »

Size optimization makes no difference, it's just a matter of line carriage in the xml file.

Once you've opened the .odt with an archive manager (sometimes you indeed need to rename it to .zip), open the styles.xml file and look for the following tag:
<style:style style:name="Graphics" style:family="graphic">
Then change
text:anchor-type="paragraph"
to
text:anchor-type="as-char"
Save the change, rename it to its initial extension and it should be fine.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

Re: [Solved] Fail to set Anchor as Character (Default)

Post by nomnex »

I did not give much thought the first time, because I was glad to have a fix, but every time I edit a template styles.xml, a "file corrupted" message appears (LibreOffice 3.3).

I followed Hagar instructions:
$ unizip foo.ott
modify styles.xml
$ zip foo.ott *

This is the file after modification:


The message I get, when I open the file after modification:
LibreOffice 3.3_2012_1004_091011.png
I can select to repair the file, and all is fine, but I have some concerns, since I use it as my default template. How about this warning message?
Last edited by nomnex on Fri Oct 05, 2012 7:56 am, edited 1 time in total.
User avatar
Hagar Delest
Moderator
Posts: 32627
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Fail to set Anchor as Character (Default)

Post by Hagar Delest »

Can you upload the original file? Sometimes there are strange results with the un/zip operation.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

Re: Fail to set Anchor as Character (Default)

Post by nomnex »

I can reproduce it 100%
I re-set the default writer template.
I created a new template of it: a4_foo.ott, then I did the following:
$ unzip a4_foo.ott
Edit style.xml > "paragraph" to "as-char"
$ zip a_foo.ott *

I also tried with a .odt file, and also by changing the file extension from .ott to .zip, but not to avail.

Original:


Modified (should pop-up the "file corrupted" waring):
Last edited by nomnex on Fri Oct 05, 2012 7:57 am, edited 2 times in total.
nomnex
Posts: 180
Joined: Thu Aug 06, 2009 11:12 pm

Re: Fail to set Anchor as Character (Default)

Post by nomnex »

I guess I found my answer here: http://forum.openoffice.org/en/forum/vi ... 20&t=36628.
To my knowledge, the zip command copies recusively into dir. by default. I did not use the -r option in my commands above. This option seems to fix the problem:

Code: Select all

$ zip -r foo.ott .
User avatar
Hagar Delest
Moderator
Posts: 32627
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Fail to set Anchor as Character (Default)

Post by Hagar Delest »

Yes, that's the problem I was thinking about. Your forum search got it right, well done.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
Post Reply