Using the technique in video below, you can create a dynamic picture frame by referencing a cell (directly or through a Index/Match formula). The attached Excel file shows this example. Change cell G2 in the attached file to “Image 2” to see the working example.
The challenge we’re having is it doesn’t seem that Aspose updates the picture object when the formulas are calculated. We notice this because our task is to calculate the formulas and then save a copy of the image from the picture box using the code below. When we do this we see that the picture box doesn’t update.
After an initial test, I am able to reproduce the issue as you mentioned by using your template Excel file and following sample code. I found dynamic images don’t refresh properly in the output PDF/image file.
Workbook workbook = new Workbook("e:\\test2\\DynamicLogo.xlsx");
Worksheet worksheet = workbook.Worksheets["Images"];
workbook.Save("e:\\test2\\out1.pdf");//Ok
worksheet.Cells["G2"].PutValue("Image 2");
workbook.CalculateFormula();
workbook.Worksheets.SortNames();
workbook.Save("e:\\test2\\out1.xlsx");//Ok
workbook.Save("e:\\test2\\out1.pdf");//Not Ok
We require thorough evaluation and investigation of the issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-55840
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Yes, please make sure you are using 24.x to test your scenario/case. We tested using recent versions with suggested code segment after adding line of code: ‘worksheet.Shapes.UpdateSelectedValue();’ and it works fine. You may print the Aspose.Cells version in code so you should judge which version is being used for your case.
I was having inconsistent results with your example and have finally figured out why. It turns out that if you Delete a worksheet before performing the Cell update and Shapes.UpdatedSelectedValue, then the shapes do not update properly.
Using the attached workbook and the example below. Commenting the Worksheets.RemoveAt will show the correct behavior, uncommenting the line will show the incorrect behavior. The DeleteMe worksheet is blank and has no involvement in the images or formulas.
[Test]
public void foo46()
{
var filename = @"C:\Data\Systems\Demo\Reports\Support\DynamicLogo.xlsx";
var imagePath = @"C:\Data\Temp\out.png";
var workbook = new Workbook(filename);
Worksheet worksheet = workbook.Worksheets["Images"];
workbook.Worksheets.RemoveAt("DeleteMe"); // Comment this line to make work
worksheet.Cells["G2"].PutValue("Image 2");
workbook.CalculateFormula();
worksheet.Shapes.UpdateSelectedValue();
worksheet.Pictures.First(x => x.Name == "DynamicLogo").ToImage(imagePath, new ImageOrPrintOptions()
{
ImageType = ImageType.Png,
Transparent = true
});
}
Thank you for providing the sample file and the information.
Upon conducting an initial test, I was able to replicate the issue you mentioned using your template Excel file. It appears that dynamic images do not refresh properly when a worksheet is removed before performing the cell update and Shapes.UpdatedSelectedValue.
We require thorough evaluation of the issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-55981
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
The issue (logged earlier as “CELLSNET-55981”) has not been resolved yet. Hopefully, we will schedule it soon. Once we have an update on it, we will let you know here.
This is to inform you that your issue (Ticket ID: “CELLSNET-55981”) has been resolved. The fix will be included in an upcoming release (Aspose.Cells v24.9) that we plan to release in the first half of September 2024. You will be notified when the next version is released.
The issues you have found earlier (filed as CELLSNET-55981) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi