Hello
I'm trying to add a picture to a spreadsheet. There is not problement to add the picture, but I'm trying to center it into a merge cell and I can't get the size.
I did the code bellow :
Private Sub addLogo(ByRef worksheet As Worksheet, ByVal columnCount As Integer, ByVal rowCellIndex As Integer, ByVal columnCellIndex As Integer) Dim image As New FloatingImage(worksheet, New CellIndex(columnCellIndex, rowCellIndex), 0, 0) Using stream As Stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(String.Concat(Assembly.GetExecutingAssembly().GetName().Name, ".MyLogo.png")) image.ImageSource = New ImageSource(stream, "png") image.LockAspectRatio = True Dim ratio As Double = worksheet.Rows(rowCellIndex).GetHeight().Value.Value / image.Height image.Height = image.Height * ratio image.Width = image.Width * ratio image.OffsetX = worksheet.Columns(columnCellIndex, columnCellIndex + columnCount - 1).GetWidth().Value.Value - image.Width End Using worksheet.Shapes.Add(image) End Subthe worksheet.Rows(rowCellIndex).Getheight().Value.Value return 20 each time, unless the row is highter
and the worksheet.Columns(columnCellIndex, columnCellIndex + columnCount - 1).GetWidth().Value.Value return 65 each time, for one or more column.
So I don't know the right command to get the height and width of my merge cell, could you help me ?
Thanks
J-Christophe
