本文整理匯總了TypeScript中exceljs.Workbook.addImage方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Workbook.addImage方法的具體用法?TypeScript Workbook.addImage怎麽用?TypeScript Workbook.addImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類exceljs.Workbook
的用法示例。
在下文中一共展示了Workbook.addImage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
}
]
};
worksheet.columns = [
{ header: 'Id', key: 'id', width: 10 },
{ header: 'Name', key: 'name', width: 32 },
{ header: 'D.O.B.', key: 'DOB', width: 10, outlineLevel: 1 }
];
worksheet.getColumn(3).outlineLevel = 1;
worksheet.getRow(3).outlineLevel = 1;
worksheet.properties.outlineLevelCol = 1;
worksheet.properties.outlineLevelRow = 1;
const imageId1 = workbook.addImage({
filename: 'path/to/image.jpg',
extension: 'jpeg',
});
const imageId2 = workbook.addImage({
buffer: fs.readFileSync('path/to.image.png'),
extension: 'png',
});
worksheet.addBackgroundImage(imageId1);
worksheet.addImage(imageId2, 'B2:D6');
worksheet.addImage(imageId2, {
tl: { col: 1.5, row: 1.5 },
br: { col: 3.5, row: 5.5 }
});
workbook.xlsx.readFile('./1.xlsx').then(() => null);
(new stream.Stream()).pipe(workbook.xlsx.createInputStream());