Click here to Skip to main content
14,298,167 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi guys,

I am having an issue putting multiple images into a single sheet using NPOI version 2.0

This is the code I am using, and have following instructions to only use one Patriarch in the process.

IDrawing patriarch = reportSheet.CreateDrawingPatriarch();
XSSFClientAnchor clientAnchor1 = new XSSFClientAnchor(100, 50, 1714500, 33624, 1, 1, 1, 1 + 3)
                AnchorType = (short)AnchorType.DontMoveAndResize
            XSSFPicture picture1 =
                patriarch.CreatePicture(clientAnchor1, LoadImage(Server.MapPath("/Content/logo1.png"), _reportWorkbook));
            picture1.LineStyle = LineStyle.DashDotGel;

XSSFClientAnchor clientAnchor2 = new XSSFClientAnchor(100, 50, 1714500, 33624, 1, currentRow, 1, currentRow+3)
                    AnchorType = (short) AnchorType.DontMoveAndResize
            XSSFPicture picture2 =
                patriarch.CreatePicture(clientAnchor2, LoadImage(Server.MapPath("/Content/Logo2.png"), _reportWorkbook));
            picture2.LineStyle = LineStyle.DashDotGel;

When I open the generated excel file, both of the images are the last image loaded. I have opened the file in microsofts "Open XML SDK 2.0 Productivity Tool" and I can see that there are two different images stored in the sheet.

If some one could shed some light on me I would really appreciate it.

(I have also posted on the NPOI Codeplex discussion board and if I get a solution from there I will share it here)
Member 10863262 13-Jun-14 2:46am
Hi , i am also facing the same problem please share solution
Pheonyx 13-Jun-14 4:16am

I never got a solution, it is a bug in NPOI. It has been acknowledged as a bug and I believe has been investigated. I'm not sure if it has been resolved or not yet though.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Pheonyx 19-Sep-14 4:06am
That's great news :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100