Page 1 of 1

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

Posted: Fri Sep 21, 2012 9:26 am
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.

Re: Fail to set Anchor as Character (Default)

Posted: Fri Sep 21, 2012 10:50 am
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)?

Re: Fail to set Anchor as Character (Default)

Posted: Fri Sep 21, 2012 3:29 pm
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

Re: Fail to set Anchor as Character (Default)

Posted: Mon Sep 24, 2012 5:11 pm
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.

Re: Fail to set Anchor as Character (Default)

Posted: Mon Sep 24, 2012 8:45 pm
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.

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

Posted: Thu Oct 04, 2012 2:26 am
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?

Re: Fail to set Anchor as Character (Default)

Posted: Thu Oct 04, 2012 8:16 am
by Hagar Delest
Can you upload the original file? Sometimes there are strange results with the un/zip operation.

Re: Fail to set Anchor as Character (Default)

Posted: Thu Oct 04, 2012 9:11 am
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):

Re: Fail to set Anchor as Character (Default)

Posted: Thu Oct 04, 2012 9:45 am
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 .

Re: Fail to set Anchor as Character (Default)

Posted: Thu Oct 04, 2012 9:48 am
by Hagar Delest
Yes, that's the problem I was thinking about. Your forum search got it right, well done.