إدراج صورة مرتبطة من عنوان الويب باستخدام Node.js عبر C++
Contents
[
Hide
]
في بعض الأحيان تحتاج إلى إدراج صورة من الويب (http://) في ورقة عمل. للقيام بذلك، حدد عنوان URL للصورة، وسيتم تنزيل الصورة في كل مرة يتم فيها فتح جدول البيانات في إكسل. الصورة غير مضمنة فعليًا في مستند إكسل، ولكنها تشير إلى مصدر ويب.
استخدام Microsoft Excel
في Microsoft Excel (على سبيل المثال 2007):
- انقر فوق قائمة إدراج وحدد صورة.
- حدد عنوان الويب للصورة في مربع حوار إدراج صورة.
** باستخدام Aspose.Cells for Node.js via C++**
يدعم Aspose.Cells for Node.js via C++ إضافة صورة مرتبطة باستخدام ShapeCollection.addLinkedPicture(upperLeftRow, upperLeftColumn, heightPixels, widthPixels, sourceFullName). تعيد الطريقة كائن Picture.
يظهر المثال التالي كيفية إضافة صورة مرتبطة من عنوان ويب إلى ورقة عمل.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Instantiate a new Workbook.
const workbook = new AsposeCells.Workbook();
// Insert a linked picture (from Web Address) to B2 Cell.
const pic = workbook.getWorksheets().get(0).getShapes().addLinkedPicture(1, 1, 100, 100, "http://www.aspose.com/Images/aspose-logo.jpg");
// Set the height and width of the inserted image.
pic.setHeightInch(1.04);
pic.setWidthInch(2.6);
// Save the Excel file.
workbook.save(path.join(dataDir, "outLinkedPicture.out.xlsx"));