Web アドレスからリンクされた画像を挿入する
Contents
[
Hide
]
Web (http://) からワークシートに画像を挿入する必要がある場合があります。これを行うには、画像の URL を指定すると、スプレッドシートが Microsoft Excel で開かれるたびに画像がダウンロードされます。画像は Excel ドキュメントに物理的に埋め込まれていませんが、Web リソースを指しています。
Microsoft エクセルを使う
Microsoft Excel (例: 2007):
- クリック入れるメニューと選択写真.
- [画像の挿入] ダイアログで、画像の Web アドレスを指定します。
Aspose.Cells for .NET を使用
Aspose.Cells for .NET は、ShapeCollection.AddLinkedPicture(int upperLeftRow、int upperLeftColumn、int heightPixels、int widthPixels、string sourceFullName) .メソッドは写真物体。
次の例は、リンクされた画像を Web アドレスからワークシートに追加する方法を示しています。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |