Web アドレスからリンクされた画像を挿入する

Web アドレスからリンクされた画像を挿入する

Microsoft エクセルを使う

Microsoft Excel (例: 2007):

  1. クリック入れるメニューと選択写真.

todo:画像_代替_文章

  1. [画像の挿入] ダイアログで、画像の Web アドレスを指定します。

todo:画像_代替_文章

画像が挿入されます。

todo:画像_代替_文章

Aspose.Cells for Java を使用

Aspose.Cells for Java は、メソッドを使用したリンクされた画像の追加をサポートしていますShapeCollection.addLinkedPicture(int upperLeftRow, int upperLeftColumn, int 高さ, int 幅, java.lang.String sourceFullName).

メソッドは写真物体。

次の例は、リンクされた画像を Web アドレスからワークシートに追加する方法を示しています。

コードを実行すると、生成された Excel ファイルの最初のワークシートにリンクされた画像が含まれます。

出力ファイル

todo:画像_代替_文章

// 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");