Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XSSFPicture.Resize method locks application execution #425

Closed
fiantsev opened this issue Oct 4, 2020 · 3 comments
Closed

XSSFPicture.Resize method locks application execution #425

fiantsev opened this issue Oct 4, 2020 · 3 comments
Labels

Comments

@fiantsev
Copy link

fiantsev commented Oct 4, 2020

Description:

I used code example from poi https://poi.apache.org/components/spreadsheet/quick-guide.html#Images - it's about inserting image into spreadsheet.

my code

public void Main()
        {
            IWorkbook workbook = GetWorkbook();
            byte[] imageByteArray = LoadImage();
            var sheet = workbook.GetSheetAt(0);

            var pictureIndex = workbook.AddPicture(imageByteArray, PictureType.JPEG);
            var drawing = sheet.CreateDrawingPatriarch();

            var anchor = workbook.GetCreationHelper().CreateClientAnchor();
            anchor.Col1 = 0;
            anchor.Row1 = 0;

            var picture = (NPOI.XSSF.UserModel.XSSFPicture)drawing.CreatePicture(anchor, pictureIndex);

            picture.Resize();//deadlock here
        }

 

Result:  

Application deadlocks on line picture.Resize();//deadlock here

Expected behaviour:

no deadlock and image autoresized

I have tried nuget packages: NPOI 2.5.1
My project has target: .Net Core 3.1
Machine: Windows 10

How to avoid deadlock/resize image correctly?

@tonyqus
Copy link
Member

tonyqus commented Oct 4, 2020

Is it possible for you to use https://www.nuget.org/packages/NPOI/ and see if this issue also exists? If so, this is a bug.

@tonyqus tonyqus added this to the NPOI 2.5.3 milestone Oct 4, 2020
@fiantsev
Copy link
Author

fiantsev commented Oct 5, 2020

@tonyqus
oh sorry for misleading info - I tried your package NPOI 2.5.1 too - result is the same - execution locks.

@tonyqus
Copy link
Member

tonyqus commented Sep 14, 2021

I used this sample and add picture.Resize(). But I cannot reproduce your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants