dgaspary / fpOdf

A library to help the freepascal developer to generate and to perform modifications to ODF(OASIS OpenDocument) files.
10 stars 8 forks source link

Content from alternative directories left unsaved. #9

Open dgaspary opened 3 years ago

dgaspary commented 3 years ago

How to reproduce:

-Create a file with a picture in LibreOffice writer.

-Open using LoadFromZipFile

-Save using SaveToZipFile

Trying to open the output file with LibreOffice will result in a document with an error frame due to the image not being added to the zip file.

andresayang commented 3 years ago

Hi again,

When working with zip files, mimetype is not written inside xml file but in a separated file "mimetype". That is the reason why we have exception with TOdfDocument.SaveToZipFile (if I do not load TOdfDocument with TOdfTextDocument).

Well, I do not know how you would like to process this: Maintain an xml file containing the list of extarcted file from original zip ? Maybe I can help ...

Cheers

(Ps: I think you notice, from the file I sent you, I'm not located too far from you)

dgaspary commented 3 years ago

On Thu, Apr 1, 2021 at 10:24 PM andresayang @.***> wrote:

Hi again,

When working with zip files, mimetype is not written inside xml file but in a separated file "mimetype". That is the reason why we have exception with TOdfDocument.SaveToZipFile (if I do not load TOdfDocument with TOdfTextDocument).

Humm.. Now I understand that you're using TOdfDocument instead of TOdfTextDocument.. I Will take a look into this tomorrow.

Well, I do not know how you would like to process this: Maintain an xml file containing the list of extarcted file from original zip ? Maybe I can help ...

I took some time to work on this today, is almost done. I Believe that in a few hours I will update a solution for this issue.

At least.. a first implementation.

andresayang commented 3 years ago

Thx a lot

dgaspary commented 3 years ago

I have uploaded the changes.

It's a initial support.

I believe I will have to test a lot of use cases like:

-Open with LoadFromSingleXml and save as package.

-Create and modify on memory then save as package. (priority)

The inverse cases of above.. and some more..

You can test and try to do what you need. When you find some problem, write here.

It can be a good point to start changind what is needed.

andresayang commented 3 years ago

Thanks