QtXlsxWriter icon indicating copy to clipboard operation
QtXlsxWriter copied to clipboard

File corrupted after calling insertImage()

Open mrstecklo opened this issue 5 years ago • 8 comments

Calling insertImage() or insertChart() leads to creating corrupted file. Microsoft Excel shows warning when trying to open file: "We found a problem with some content in 'filename.xlsx'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes." Clicking 'Yes' results in an empty file. dbzhang800's code works fine, except for QList/QVector thing in xlsxzipreader.cpp.

mrstecklo avatar Jun 18 '19 13:06 mrstecklo

Very strange, we made no change to the code that handles images from the original library. Can you share a minimal example to reproduce the problem?

VSRonin avatar Jun 18 '19 22:06 VSRonin

This example shows, that insertImage() works fine with original library. But insertChart() doesn't work with both yours and dbzhang800's. qtxlsx-example.zip

mrstecklo avatar Jun 19 '19 07:06 mrstecklo

You need to actually put some "Logo.jpeg" to the build directory

mrstecklo avatar Jun 19 '19 07:06 mrstecklo

First, thanks for the lib. It's a much better solution than make my app generate a python script depending on pyExcelerator !

But ...

I have the same problem: as soon as there is an image in a generated .xlsx file, Excel complains. In a multi sheet document, pure text sheets are OK, but sheets containing image(s) are ending blank.

I can provide you with the .xlsx file, but I don't want to make it public. I could remove the sensitive information, but I don't want to alter the file. Is it possible on a private channel ?

I'm developing under Linux for a Linux colorimetry test bench. I made all my dev tests using LibreOffice under Linux, without any problem. But as soon as I tested in real conditions, which means sending the file to Windows users depending on Excel 2010, we encountered the problem.

At least, here is the "repair report" from Excel:

Réparer le résultat vers 2019.07.02-11h06m03.691--Colorimetrie--000000000000--Samsung--Galaxy Note 9 02520.zip

It's in French and it won't help a lot I'm afraid.

ChristopheBeugnetSC avatar Jul 02 '19 10:07 ChristopheBeugnetSC

Very strange, we made no change to the code that handles images from the original library. Can you share a minimal example to reproduce the problem?

I remember this bug was resolved on https://github.com/QtExcel/QXlsx you can check the code and patch on your project.

liufeijin avatar Jul 02 '19 10:07 liufeijin

That was quick, thanks !

I did not realized I was using a outdated version. I thought I was using a fork or something. Strange.

Anyway, I'm about to check https://github.com/QtExcel/QXlsx and adapt my code if necessary. I will keep you updated.

ChristopheBeugnetSC avatar Jul 02 '19 12:07 ChristopheBeugnetSC

So far, so good. Many thanks again ! API is the same, no adjustment required.

I found a lot of warnings though. I could propose a correction. But I'm not familiar with GitHub and how to push code. Is there a tutorial that explain how I can push, or send a patch or something ? (before I google that myself ... No time right now, sorry)

ChristopheBeugnetSC avatar Jul 02 '19 15:07 ChristopheBeugnetSC

https://github.com/QtExcel/QXlsx is not a fork to this project. The initial design of this library, however, makes it almost impossible to develop advanced functionality. My suggestion would be to abandon this library and move on to the one actively developed

VSRonin avatar Jul 04 '19 10:07 VSRonin