umya-spreadsheet icon indicating copy to clipboard operation
umya-spreadsheet copied to clipboard

Saving spreadsheet with images result in errors - does not round-trip

Open schungx opened this issue 1 year ago • 11 comments

Read a spreadsheet file with embedded images, then writing it back out as a new file.

The new file contains errors (Excel pops up warnings). Images are missing.

Attached is the test file test.xlsx and the output file output.xlsx.

schungx avatar May 26 '24 13:05 schungx

@schungx Thank you for your report. We will investigate the cause.

MathNya avatar May 27 '24 09:05 MathNya

Anything I can do to help diagnose this problem? It seems to only happen when there are embedded images.

Most images ended up disappearing, but some are intact.

schungx avatar May 28 '24 01:05 schungx

@schungx Thank you very much. By analyzing the file you submitted, we were able to determine the cause of the error. We have corrected the program. Please obtain the latest version and check it.

MathNya avatar May 28 '24 05:05 MathNya

Will do and revert.

schungx avatar May 29 '24 04:05 schungx

I confirm that your fix solved the problems with the test file.

However, with a real file with hundreds of images, it comes back with errors:

image

with the log:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog
	xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
	<logFileName>error545240_01.xml</logFileName>
	<summary>Errors were detected in file 'C:\Git\holycrown\xyz.xlsx'</summary>
	<repairedRecords>
		<repairedRecord>Repaired Records: Drawing from /xl/drawings/drawing1.xml part (Drawing shape)</repairedRecord>
		<repairedRecord>Repaired Records: Drawing from /xl/drawings/drawing2.xml part (Drawing shape)</repairedRecord>
	</repairedRecords>
</recoveryLog>

The most annoying thing is... it sometimes swap images with some other images, but not all the time.

I'll try to make another test file for you.

schungx avatar May 29 '24 05:05 schungx

Here is another test file with the output. You'll find that:

  1. There are errors when opening output.xlsx saying that some drawings have been fixed

  2. Many images are swapped to something entirely different

  3. Some images are not found

test2.xlsx

output.xlsx

schungx avatar May 29 '24 05:05 schungx

@schungx Hmmm, looks like it needs a little more renovation. We will continue to address this issue.

MathNya avatar May 29 '24 05:05 MathNya

Reopening this issue since I've found more cases where there are still problems with round-tripping.

xxx.xlsx

output.xlsx

xxx.xlsx is the source file. output.xlsx is the file saved.

As you can see, output.xlsx contains two errors that Excel complains about when you try to load it.

schungx avatar Jul 08 '24 13:07 schungx

@schungx Thank you for your report. We will respond to this as well.

MathNya avatar Jul 09 '24 09:07 MathNya

image

Trying to remove a column and a row from a spreadsheet results in errors.

I believe some offsets are still not properly adjusted... In particular, I believe merged cells and shared formulas are not properly adjusted when rows/columns are added/removed.

schungx avatar Jul 10 '24 12:07 schungx

The latest version has been released. Please check to see if any problems have been resolved.

MathNya avatar Aug 04 '24 07:08 MathNya