Print Object

Aug 28, 2012 at 7:54 AM

Dim bytes As Byte() = System.IO.File.ReadAllBytes(strPic)
Dim pictureIdx As Integer = nWorkBook.AddPicture((bytes),NPOI.SS.UserModel.PictureType.PNG)
Dim patriarch As XSSFDrawing = nWorkSheet.CreateDrawingPatriarch()
Dim anchor As New XSSFClientAnchor(650, 550, 0, 0, 0, 1, 2, 4) 'width,height,,,,  '(0, 0, 800, 0, 0, 1, 1, 4)   '(default put 0, default put 0, 1023,  default put 0, default put 0, start row, pic width, pic height)

Dim picture As XSSFPicture = patriarch.CreatePicture(anchor, pictureIdx)

 

I am adding the picture into the xlsx file. But why when I preview the excel, the image will not shown? I checked the picture properties and found out that the PrintObject checkbox is not checked.

 

I am using NPOI 2.0.

Feb 10, 2014 at 3:29 AM
Hi

i have same problem. do u have solution to fix this problem. Pls, tell me??

Thank.
Feb 10, 2014 at 4:01 AM
I change the code from

Dim anchor As New XSSFClientAnchor(650, 550, 0, 0, 0, 1, 2, 4)

become

Dim anchor As New HSSFClientAnchor(0, 0, 800, 0, 0, 1, 1, 4)

and problem resolved.
Feb 10, 2014 at 11:30 AM
i used C# and XSSFClientAnchor to create NPOI with image and i already change code to this ...

XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 800, 0, 4, rows, 5, rows + 1);

but is not work for me

have u other solution to resolved this problem

thank.