XSSFSheet - Multiple images in single sheet

Jan 9, 2014 at 4:25 PM
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 =
                (XSSFPicture)
                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 =
                (XSSFPicture)
                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.
Coordinator
Jan 9, 2014 at 10:34 PM
What's your expected result?
Jan 9, 2014 at 10:38 PM
Hi tony,

I would expect two different images to be inserted into a sheet.

Logo1 should appear at the top of the sheet.
Then there is a table entry (which is working and I've just excluded from the snippet here), which increases the value of "currentRow" to the row after the table.
Logo2 should then appear beneath the table inline with logo1 at the top just further down.

So something like:

Logo1
table
logo2

Regards
Apr 16, 2014 at 9:16 AM
Hi tonyqus/nitric,

I am also facing the above issue. Do you guys have any solution?
Coordinator
May 1, 2014 at 11:30 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Marked as answer by tonyqus on 5/13/2014 at 3:42 PM