Requirements: A certain column in Excel is an image, and the corresponding image needs to be inserted into the column.
First, look at the renderings:
In fact, I first read the image file as byte[], then convert it to base64 and then convert it to byte[] type, in fact, you can directly read the image as byte[] and insert it into the specified location.
The CreateAnchor method is mainly used, and the parameters are as follows:
CreateAnchor(int dx1, int dy1, int dx2, int dy2, short col1, int row1, short col2, int row2)
dx1 dy1 The x,y coordinates in the starting cell.
dx2 dy2 ends the x,y coordinates in the cell
col1,row1 specifies the starting cell, and the subscript starts from 0
col2,row2 specify the cell that ends with subscript starting from 0
Finally, attach the source code:
Tourists, if you want to see the hidden content of this post, please Reply
|