从网址插入链接图片

从网址插入链接图片

使用 Microsoft Excel

在 Microsoft Excel 中(例如 2007):

  1. 点击插入菜单并选择图片.

待办事项:图片_替代_文本

  1. 在“插入图片”对话框中指定图片的网址。

待办事项:图片_替代_文本

图像被插入。

待办事项:图片_替代_文本

使用 Aspose.Cells for Java

Aspose.Cells for Java 支持使用方法添加链接图片ShapeCollection.addLinkedPicture(int upperLeftRow, int upperLeftColumn, int height, int width, java.lang.String sourceFullName).

该方法返回一个图片目的。

以下示例显示如何将网址中的链接图片添加到工作表。

运行代码后,生成的 Excel 文件在第一个工作表上包含一个链接图像。

输出文件

待办事项:图片_替代_文本

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getDataDir(InsertLinkedPicturefromWebAddress.class);
// Instantiate a new Workbook.
Workbook workbook = new Workbook();
// Insert a linked picture (from Web Address) to B2 Cell.
Picture pic = (Picture) workbook.getWorksheets().get(0).getShapes().addLinkedPicture(1, 1, 100, 100,
"http://www.aspose.com/Images/aspose-logo.jpg");
// Set the source of the inserted image.
pic.setSourceFullName("http://www.aspose.com/images/aspose-logo.gif");
// Set the height and width of the inserted image.
pic.setHeightInch(1.04);
pic.setWidthInch(2.6);
// Save the Excel file.
workbook.save(dataDir + "LinkedPicture.xlsx");