A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ClosedXML/ClosedXML/issues/1896 below:

Pictures' and Shapes' display order is not respected after save · Issue #1896 · ClosedXML/ClosedXML · GitHub

Do you want to request a feature or report a bug?

Did you test against the latest CI build?

Version of ClosedXML

0.97.0

What is the current behavior?

When saving a workbook containing stacked pictures and shapes, the assets display order is scrambled. Pictures always get in front of shapes.

What is the expected behavior or new feature?

Images and shapes should keep the disposition they had in opened file.

Is this a regression from the previous version?

This is not a regression. Bug was present in 0.92.0 already.

Reproducibility

Code to reproduce problem:

public void Main()
{
    // Code standards:
    // - Fully runnable. I should be able to copy and paste this code into a 
    //   console application and run it without having to edit it much.
    // - Declare all your variables (this follows from the previous point)
    // - The code should be a minimal code sample to illustrate issue. The code 
    //   samples on the wiki are good examples of the terseness that I want. Don't
    //   post your full application.
	var filePath = "C:\Tests\Images-Shapes.xlsx"
	var workbook = new XLWorkbook(filePath);
	workbook.SaveAs(filePath + ".test.xlsx");
}

I found a possible cause and fix for this issue in ClosedXML.Excel.XLWorkbook.AddPictureAnchor method.
This comes from the position the new OpenXml elements describing the picture are inserted in WorksheetDrawing part.
Since they are appended, they seem to be drawn last. Because other types of graphics (i.e. shapes) are ignored, these end-up being sent to back.
By keeping track of the original part's ordering, this issue can be resolved.

Images-Shapes.xlsx


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4