我想生成一份带有图片的报告,但我无法将图片放在单个单元格中。我可以让这些图片在工作表中“浮动”,但我需要把它们放入一个单元格中。我该怎么做?
我想生成一份带有图片的报告,但我无法将图片放在单个单元格中。我可以让这些图片在工作表中“浮动”,但我需要把它们放入一个单元格中。我该怎么做?
当鼠标悬停时,图像将出现。 Microsoft Office 365 (2019)引入了称为“评论”的新功能,并将旧的评论重命名为“注释”。因此,在上述步骤中,应选择右键单击单元格 > 插入批注 > 在批注框外部的阴影区域上右键单击 > 格式化批注 > 颜色和线条 > 填充 > 颜色 > 填充效果 > 图片 > (浏览到图片) > 点击“确定”
新建注释
而不是插入批注
。所有其他步骤保持不变,该功能仍然存在。
有一种更快的方法 (https://www.youtube.com/watch?v=TSjEMLBAYVc):
直接打开Google文档,将以下内容作为公式粘贴进去,其中URL是指向你的图像的链接。
=image("URL", 1)
之后,从Google文档选项中,选择下载为Excel,您就可以将图像放置在单元格中。编辑:根据评论,您不需要将图片URL保留那么长时间,只需足够长以使Excel下载它即可。然后它将嵌入到文件中。
如果您有多张图片,可以一次选择并插入所有图片(如步骤4所示)。
您还可以通过选择并拖动边缘来调整图像大小。在标志或产品图像的情况下,您可能希望保持图像的纵横比。为保持纵横比不变,请使用图像的角来调整大小。
当您使用上述步骤将图像放置在单元格中时,如果您调整、筛选或隐藏单元格,则它不会与单元格粘合。如果您希望图像粘附到单元格,请将图像锁定在其所放置的单元格中。
要执行此操作,您需要按照以下附加步骤进行操作。
现在,您可以移动、筛选或隐藏单元格,图片也会随之移动/筛选/隐藏。
注意:
此答案摘自以下链接:在Excel单元格中插入图片。
Sub Button1_Click()
Dim filePathCell As Range
Dim imageLocationCell As Range
Dim filePath As String
Set filePathCell = Application.InputBox(Prompt:= _
"Please select the cell that contains the reference path to your image file", _
Title:="Specify File Path", Type:=8)
Set imageLocationCell = Application.InputBox(Prompt:= _
"Please select the cell where you would like your image to be inserted.", _
Title:="Image Cell", Type:=8)
If filePathCell Is Nothing Then
MsgBox ("Please make a selection for file path")
Exit Sub
Else
If filePathCell.Cells.Count > 1 Then
MsgBox ("Please select only a single cell that contains the file location")
Exit Sub
Else
filePath = Cells(filePathCell.Row, filePathCell.Column).Value
End If
End If
If imageLocationCell Is Nothing Then
MsgBox ("Please make a selection for image location")
Exit Sub
Else
If imageLocationCell.Cells.Count > 1 Then
MsgBox ("Please select only a single cell where you want the image to be populated")
Exit Sub
Else
InsertPic filePath, imageLocationCell
Exit Sub
End If
End If
End Sub
Private Sub InsertPic(filePath As String, ByVal insertCell As Range)
Dim xlShapes As Shapes
Dim xlPic As Shape
Dim xlWorksheet As Worksheet
If IsEmpty(filePath) Or Len(Dir(filePath)) = 0 Then
MsgBox ("File Path invalid")
Exit Sub
End If
Set xlWorksheet = ActiveSheet
Set xlPic = xlWorksheet.Shapes.AddPicture(filePath, msoFalse, msoCTrue, insertCell.Left, insertCell.Top, insertCell.Width, insertCell.Height)
xlPic.LockAspectRatio = msoCTrue
End Sub
你可以使用Google Drive(免费,无麻烦)在不到一分钟的时间内完成它
• 批量上传所有图片至imgur.com
• 将所有图像链接复制在一起,并附加 .jpg。只有imgur让您将所有图像链接一起复制,使用右上角的图像选项卡即可。
• 使用http://TextMechanic.co在每行前缀和后缀中添加以下内容:
前缀:=image("
AND
后缀:", 1)
这样看起来就像这样=image("URL", 1)
• 复制全部
• 粘贴到Google电子表格中
• 完成!
参考资料:
http://www.labnol.org/internet/images-in-google-spreadsheet/18167/
https://support.google.com/drive/bin/answer.py?hl=en&answer=87037&from=1068225&rd=1
Top
和Left
属性来将其定位到单元格上方。如果你编辑你的问题并附上你正在使用的代码,我们就更容易向你提供可能适合你的方法。 - Tim Williams