nissl-lab / npoi

a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop.
Apache License 2.0
5.74k stars 1.43k forks source link

Remove picture... #1396

Closed FlauzerOriginal closed 2 weeks ago

FlauzerOriginal commented 3 months ago

NPOI Version

2.7.0

File Type

Issue Description

Actually, simply I'm trying to erase n rows from an excel sheet. In one column there are images. Ideally, I call: removeRow(...) and ShiftRows (...)

Reproduce Steps

for our example, much more simply, after getShapes we can delete the first image... if you need the whole code I'll send it... Basically it is

var drawing = _sheet.DrawingPatriarch as XSSFDrawing;
   foreach (var picture in RemovePictureList)

          var bres = drawing.GetShapes().Remove(picture as XSSFShape);

This method, Remove, always returns false.

most likely I'm doing something wrong, do you have any suggestions because I'm running out of ideas... Is it possible to check? Thanks.

tonyqus commented 2 months ago

drawing.GetShapes().Remove method definitely won't work.

You can reference this post. https://stackoverflow.com/questions/54769854/how-to-remove-an-image-from-an-excel-sheet-xssf-in-java

FlauzerOriginal commented 2 months ago

Thank you very much for this info Tony…

Da: Tony Qu @.> Inviato: lunedì 16 settembre 2024 19:57 A: nissl-lab/npoi @.> Cc: FlauzerOriginal @.>; Mention @.> Oggetto: Re: [nissl-lab/npoi] Remove picture... (Issue #1396)

drawing.GetShapes().Remove method definitely won't work.

You can reference this post. https://stackoverflow.com/questions/54769854/how-to-remove-an-image-from-an-excel-sheet-xssf-in-java

— Reply to this email directly, view it on GitHub https://github.com/nissl-lab/npoi/issues/1396#issuecomment-2353557765 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AEI5QWZ7BOJ52SOMTALLWI3ZW4LWTAVCNFSM6AAAAABMAHSAA2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJTGU2TONZWGU . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AEI5QW5VBMWW2XPCTZWH5UDZW4LWTA5CNFSM6AAAAABMAHSAA2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUMJBYQK.gif Message ID: @. @.> >