Interface: IFRangeSheetDrawingMixin
Extended by
Methods
insertCellImageAsync()
insertCellImageAsync(file): Promise<boolean>Inserts an image into the current cell.
Parameters
| Parameter | Type | Description |
|---|---|---|
file | string | File | File or URL string |
Returns
Promise<boolean>
True if the image is inserted successfully, otherwise false
Example
const fWorkbook = univerAPI.getActiveWorkbook();
const fWorksheet = fWorkbook.getActiveSheet();
// Insert an image into the cell A10
const fRange = fWorksheet.getRange('A10');
const result = await fRange.insertCellImageAsync('https://avatars.githubusercontent.com/u/61444807?s=48&v=4');
console.log(result);saveCellImagesAsync()
saveCellImagesAsync(options?): Promise<boolean>Save all cell images in this range to the file system. This method will open a directory picker dialog and save all images to the selected directory.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | ISaveCellImagesOptions | Options for saving images |
Returns
Promise<boolean>
True if images are saved successfully, otherwise false
Example
const fWorkbook = univerAPI.getActiveWorkbook();
const fWorksheet = fWorkbook.getActiveSheet();
// Save all cell images in range A1:D10
const fRange = fWorksheet.getRange('A1:D10');
// Save with default options (using cell address as file name)
await fRange.saveCellImagesAsync();
// Save with custom options
await fRange.saveCellImagesAsync({
useCellAddress: true,
useColumnIndex: 0, // Use values from column A for file names
});