Posted 28 March 2024, 2:51 pm EST - Updated 28 March 2024, 2:56 pm EST
v 17.0.20231.0
A ‘VF’ custom function is converted into a shape for export to Excel
using (var bitMap = sheet.SaveImage(cell.Row.Index, cell.Column.Index, cell.RowSpan, cell.ColumnSpan, (int)(rect.Width * zf), (int)(rect.Height * zf), WorksheetSubType.Corner))
{
var reducedRect = new RectangleF(1, 1, bitMap.Width - 2, bitMap.Height - 2);
var bm = bitMap.Clone(reducedRect, PixelFormat.DontCare);
{
var shape = new CustomShape
{
Picture = bm,
Border = new EmptyBorder(),
Width = rect.Width-2,
Height = rect.Height-2,
ShapeOutlineColor = Color.White,
ShapeOutlineThickness = 0,
};
sheet.AddShape(shape, cell.Row.Index, cell.Column.Index, 1, 1, true);
}
..
Spread.SaveExcel(fn, ExcelSaveFlags.UseOOXMLFormat);
The shape shows nicely in Excel. But when printing with Excel the Shape is not visible.