Re: [dev] Re: Code for Pictures

2010-12-02 Thread Bernd Eilers





Hi Annika,

the ODF Specification requires that a "mimetype" file is stored as the
FIRST entry in the package and that it is stored uncompressed you have
to make sure that this is the case when you "zip your document back".

If you are using a "zip" command line client on Windows for example you
can use the following sequence of commands from within the directory
containing the content:

zip -0 ..\barfoo.zip mimetype
erase mimetype
zip -r -S -u ..\barfoo.zip *
move ..\barfoo.zip ..\barfoo.odt

Kind regards,
Bernd Eilers


On 01.12.2010 14:27, Annika Westerlaken wrote:

  You're right, I was doing something wrong, it was probably because I
created a new zip file like Niklas said. Tried it again and it works
just fine. Though I could have sworn I had already tried that, but I
guess not then, and I'm not complaining about finally solving this.
Sorry for inconveniencing all of you. Thanks for your input, this issue
has been solved.

-Oorspronkelijk bericht-
Van: Ariel Constenla-Haile [mailto:ariel.constenla.ha...@googlemail.com]

Verzonden: woensdag 1 december 2010 14:21
Aan: dev@openoffice.org
Onderwerp: Re: [dev] Re: Code for Pictures

Hello Annika,

On Wednesday 01 December 2010, 10:01, Annika Westerlaken wrote:
  
  
Thanks for your input. You're right about the entry being needed in
manifest.xml, that was already taken care of however. I'm sorry for

  
  not
  
  
being clear enough in my initial message.

If I were to unzip an odt file containing a picture and rename this
picture in content.xml, manifest,xml and the actual file in the

  
  Pictures
  
  
folder and rezip it, OOo will ask to repair the document when I try to
open it.

  
  
my guess is you might be doing something wrong. 
I've tried this manually and worked ok:

* unzip the odt document
* rename the picture
* change the content.xml and META-INF/manifest.xml
* zip the document back

OOo opens the modified document just fine, no warnings at all:
http://arielch.fedorapeople.org/devel/ooo/test_orig.odt
http://arielch.fedorapeople.org/devel/ooo/test_modif.odt

Regards
  



-- 


Bernd Eilers
| Software Engineer
Phone: +49 40 23 646 967 

ORACLE
Deutschland B.V. & Co. KG | Nagelsweg 55 | 20097 Hamburg
ORACLE
Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstr. 25,
D-80992 München
Registergericht: Amtsgericht München, HRA
95603

Komplementärin: ORACLE Deutschland Verwaltung
B.V.
Rijnzathe 6, 3454PV De Meern, Niederlande
Handelsregister
der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer:
Jürgen Kunz, Marcel van de Molen, Alexander van der Ven 


  

  
  
  
  
  Oracle is committed to developing
practices and products that help protect the environment
  

  









RE: [dev] Re: Code for Pictures

2010-12-01 Thread Annika Westerlaken
You're right, I was doing something wrong, it was probably because I
created a new zip file like Niklas said. Tried it again and it works
just fine. Though I could have sworn I had already tried that, but I
guess not then, and I'm not complaining about finally solving this.
Sorry for inconveniencing all of you. Thanks for your input, this issue
has been solved.

-Oorspronkelijk bericht-
Van: Ariel Constenla-Haile [mailto:ariel.constenla.ha...@googlemail.com]

Verzonden: woensdag 1 december 2010 14:21
Aan: dev@openoffice.org
Onderwerp: Re: [dev] Re: Code for Pictures

Hello Annika,

On Wednesday 01 December 2010, 10:01, Annika Westerlaken wrote:
> Thanks for your input. You're right about the entry being needed in
> manifest.xml, that was already taken care of however. I'm sorry for
not
> being clear enough in my initial message.
> 
> If I were to unzip an odt file containing a picture and rename this
> picture in content.xml, manifest,xml and the actual file in the
Pictures
> folder and rezip it, OOo will ask to repair the document when I try to
> open it.

my guess is you might be doing something wrong. 
I've tried this manually and worked ok:

* unzip the odt document
* rename the picture
* change the content.xml and META-INF/manifest.xml
* zip the document back

OOo opens the modified document just fine, no warnings at all:
http://arielch.fedorapeople.org/devel/ooo/test_orig.odt
http://arielch.fedorapeople.org/devel/ooo/test_modif.odt

Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org



Re: [dev] Re: Code for Pictures

2010-12-01 Thread Ariel Constenla-Haile
Hello Annika,

On Wednesday 01 December 2010, 10:01, Annika Westerlaken wrote:
> Thanks for your input. You're right about the entry being needed in
> manifest.xml, that was already taken care of however. I'm sorry for not
> being clear enough in my initial message.
> 
> If I were to unzip an odt file containing a picture and rename this
> picture in content.xml, manifest,xml and the actual file in the Pictures
> folder and rezip it, OOo will ask to repair the document when I try to
> open it.

my guess is you might be doing something wrong. 
I've tried this manually and worked ok:

* unzip the odt document
* rename the picture
* change the content.xml and META-INF/manifest.xml
* zip the document back

OOo opens the modified document just fine, no warnings at all:
http://arielch.fedorapeople.org/devel/ooo/test_orig.odt
http://arielch.fedorapeople.org/devel/ooo/test_modif.odt

Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina


signature.asc
Description: This is a digitally signed message part.


Re: [dev] Re: Code for Pictures

2010-12-01 Thread Niklas Nebel

On 12/01/10 14:01, Annika Westerlaken wrote:

Thanks for your input. You're right about the entry being needed in
manifest.xml, that was already taken care of however. I'm sorry for not
being clear enough in my initial message.

If I were to unzip an odt file containing a picture and rename this
picture in content.xml, manifest,xml and the actual file in the Pictures
folder and rezip it, OOo will ask to repair the document when I try to
open it.


Did you update the zip file, or create a new one? If you create a new 
file, you have to take special care of the "mimetype" entry. The repair 
dialog usually points to a problem on the zip storage level, not a 
picture that can't be found.


Niklas

-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org



Re: [dev] Re: Code for Pictures

2010-12-01 Thread Alexandro Colorado
On Wed, 01 Dec 2010 07:01:02 -0600, Annika Westerlaken   
wrote:



Thanks for your input. You're right about the entry being needed in
manifest.xml, that was already taken care of however. I'm sorry for not
being clear enough in my initial message.

If I were to unzip an odt file containing a picture and rename this
picture in content.xml, manifest,xml and the actual file in the Pictures
folder and rezip it, OOo will ask to repair the document when I try to
open it.
If I let OOo repair the document, the filename has been replaced by the
code and the image shows up.


yes OOo internally assigns a numerical filename to avoid name collisions.  
If you want to name the ODT as your image, you should catch the image name  
before you generate the ODT.


You can assign on the XML a image name but this is only valid within the  
context of the document, not the context of the document filesystem.



It is possible that there's yet another reference to the picture
somewhere that I don't know of, but I don't think so. Because when I add
references using the code OOo expects in my so called 'generator', OOo
opens the file without any warnings and shows the picture.

-Oorspronkelijk bericht-
Van: Michael Stahl [mailto:michael.x.st...@oracle.com]
Verzonden: woensdag 1 december 2010 12:44
Aan: dev@openoffice.org
Onderwerp: [dev] Re: Code for Pictures

On 01/12/2010 11:35, Annika Westerlaken wrote:

Dear Sir/Madam,

Currently I am working on a project which requires me to rewrite

Writer

documents without opening them.
The next step is to insert a picture, still without opening the
document. The problem is that when I use the original name of the
picture, the document has to be repaired. The picture has been renamed
to a 32 characters code. It seems this specific code is required to
refer to the picture.


i don't think that OOo requires picures to have a specific name.
but i could imagine that when OOo stores a document, it will not use the
original name for pictures, but simply generates a new one.

i have a more plausible explanation why OOo thinks the document is
invalid:
the ODF package contains a file META-INF/manifest.xml.
this file has an entry for every file that is contained in the package.
if there is a file in the package for which no file-entry exists in the
manifest, then OOo will complain about an invalid ODF document.
AFAIK this is a security feature added in OOo 3.2.

if you added the file to the ODF package by hand, perhaps you have
forgotten to add the manifest file entry.


To see how this code is being determined/generated, I have tried
searching the source code. Unfortunately, I have no idea where to

look.

So I was hoping if someone could either point me in the right

direction,

or answer my question directly.

Many thanks in advance for your assistance in this.

Sincerely,

Annika





--
Alexandro Colorado

-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org



RE: [dev] Re: Code for Pictures

2010-12-01 Thread Annika Westerlaken
Thanks for your input. You're right about the entry being needed in
manifest.xml, that was already taken care of however. I'm sorry for not
being clear enough in my initial message.

If I were to unzip an odt file containing a picture and rename this
picture in content.xml, manifest,xml and the actual file in the Pictures
folder and rezip it, OOo will ask to repair the document when I try to
open it.
If I let OOo repair the document, the filename has been replaced by the
code and the image shows up.
It is possible that there's yet another reference to the picture
somewhere that I don't know of, but I don't think so. Because when I add
references using the code OOo expects in my so called 'generator', OOo
opens the file without any warnings and shows the picture.

-Oorspronkelijk bericht-
Van: Michael Stahl [mailto:michael.x.st...@oracle.com] 
Verzonden: woensdag 1 december 2010 12:44
Aan: dev@openoffice.org
Onderwerp: [dev] Re: Code for Pictures

On 01/12/2010 11:35, Annika Westerlaken wrote:
> Dear Sir/Madam,
> 
> Currently I am working on a project which requires me to rewrite
Writer
> documents without opening them.
> The next step is to insert a picture, still without opening the
> document. The problem is that when I use the original name of the
> picture, the document has to be repaired. The picture has been renamed
> to a 32 characters code. It seems this specific code is required to
> refer to the picture.

i don't think that OOo requires picures to have a specific name.
but i could imagine that when OOo stores a document, it will not use the
original name for pictures, but simply generates a new one.

i have a more plausible explanation why OOo thinks the document is
invalid:
the ODF package contains a file META-INF/manifest.xml.
this file has an entry for every file that is contained in the package.
if there is a file in the package for which no file-entry exists in the
manifest, then OOo will complain about an invalid ODF document.
AFAIK this is a security feature added in OOo 3.2.

if you added the file to the ODF package by hand, perhaps you have
forgotten to add the manifest file entry.

> To see how this code is being determined/generated, I have tried
> searching the source code. Unfortunately, I have no idea where to
look.
> So I was hoping if someone could either point me in the right
direction,
> or answer my question directly.
> 
> Many thanks in advance for your assistance in this.
> 
> Sincerely,
> 
> Annika

-- 
"Reality is that which, when you stop believing in it, doesn't go away."
 -- Philip K. Dick


-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org


-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org



[dev] Re: Code for Pictures

2010-12-01 Thread Michael Stahl
On 01/12/2010 11:35, Annika Westerlaken wrote:
> Dear Sir/Madam,
> 
> Currently I am working on a project which requires me to rewrite Writer
> documents without opening them.
> The next step is to insert a picture, still without opening the
> document. The problem is that when I use the original name of the
> picture, the document has to be repaired. The picture has been renamed
> to a 32 characters code. It seems this specific code is required to
> refer to the picture.

i don't think that OOo requires picures to have a specific name.
but i could imagine that when OOo stores a document, it will not use the
original name for pictures, but simply generates a new one.

i have a more plausible explanation why OOo thinks the document is invalid:
the ODF package contains a file META-INF/manifest.xml.
this file has an entry for every file that is contained in the package.
if there is a file in the package for which no file-entry exists in the
manifest, then OOo will complain about an invalid ODF document.
AFAIK this is a security feature added in OOo 3.2.

if you added the file to the ODF package by hand, perhaps you have
forgotten to add the manifest file entry.

> To see how this code is being determined/generated, I have tried
> searching the source code. Unfortunately, I have no idea where to look.
> So I was hoping if someone could either point me in the right direction,
> or answer my question directly.
> 
> Many thanks in advance for your assistance in this.
> 
> Sincerely,
> 
> Annika

-- 
"Reality is that which, when you stop believing in it, doesn't go away."
 -- Philip K. Dick


-
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org