I am using .net 7. I originally hit it with Telerik.UI.for.Wpf.70.Xaml.2023.3.1114. I updated to Telerik.UI.for.Wpf.70.Xaml.2024.1.423 to see if it was fixed but it still appears to happen.
I have attached a sample program which shows the behavior. Original.xlsm was created in Excel and has an image embedded in cell A1. Call ImportWorkbook with the path to the original file. Then export that workbook (unchanged) to the destination file.
Workbook workbook = ImportWorkbook( originalFileName ); ExportWorkbook( workbook, destinationFileName );
private Workbook ImportWorkbook( string fileName )
{
Telerik.Windows.Documents.Spreadsheet.Model.Workbook workbook;
IWorkbookFormatProvider formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsm.XlsmFormatProvider();
using( Stream input = new FileStream( fileName, FileMode.Open ) )
{
workbook = formatProvider.Import( input );
}
return workbook;
}
private void ExportWorkbook( Workbook workbook, string fileName )
{
Telerik.Windows.Documents.Spreadsheet.FormatProviders.IWorkbookFormatProvider formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsm.XlsmFormatProvider();
using( Stream output = new FileStream( fileName, FileMode.Create ) )
{
formatProvider.Export( workbook, output );
}
}