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

Microsoft Excel の使用

Microsoft Excel(たとえば2007)で:

  1. 挿入メニューをクリックし、画像を選択します。
  2. 挿入画像ダイアログで画像のWebアドレスを指定します。

Aspose.Cells for .NETを使用する

Aspose.Cells for .NETは、ShapeCollection.AddLinkedPicture(int upperLeftRow, int upperLeftColumn, int heightPixels, int widthPixels, string sourceFullName)を使用してリンクされた画像を追加する機能をサポートします。このメソッドはPictureオブジェクトを返します。

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

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Instantiate a new Workbook.
Workbook workbook = new Workbook();
// Insert a linked picture (from Web Address) to B2 Cell.
Aspose.Cells.Drawing.Picture pic = workbook.Worksheets[0].Shapes.AddLinkedPicture(1, 1, 100, 100, "http:// Www.aspose.com/Images/aspose-logo.jpg");
// Set the height and width of the inserted image.
pic.HeightInch = 1.04;
pic.WidthInch = 2.6;
// Save the Excel file.
workbook.Save(dataDir+ "outLinkedPicture.out.xlsx");