أدخل صورة مرتبطة من عنوان الويب
Contents
[
Hide
]
تحتاج أحيانًا إلى إدراج صورة من الويب (http: //) في ورقة عمل. للقيام بذلك ، حدد عنوان URL للصورة وسيتم تنزيل الصورة في كل مرة يتم فيها فتح جدول البيانات في Microsoft Excel. لم يتم تضمين الصورة فعليًا في مستند Excel ، ولكنها تشير إلى مورد ويب.
إدراج صورة مرتبطة من عنوان الويب
باستخدام Microsoft إكسل
في Microsoft Excel (على سبيل المثال 2007):
- انقر علىإدراج القائمة وحددصورة.
- حدد عنوان الويب للصورة في مربع الحوار “إدراج صورة”.
تم إدراج الصورة.
باستخدام Aspose.Cells for Java
Aspose.Cells for Java يدعم اضافة صورة مرتبطة باستخدام الطريقةShapeCollection.addLinkedPicture (int upperLeftRow ، int upperLeftColumn ، int height ، int width ، java.lang.String sourceFullName).
تقوم الطريقة بإرجاع ملفصورةموضوع.
يوضح المثال التالي كيفية إضافة صورة مرتبطة من عنوان ويب إلى ورقة عمل.
بعد تشغيل الكود ، يحتوي ملف Excel الذي تم إنشاؤه على صورة مرتبطة في ورقة العمل الأولى.
ملف الإخراج
This file contains 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-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"); |