The picture inserted into an excel document is resized when the default font is changed

@ahsaniqbalsidiqui
I’ve been faced with the same issue, but I’ve used the default style for the workbook and it resizes the image too even though I’ve used the AutoFitRows function before saving the file.
It only works if you set the default font size to 6. Moreover, if you set the default font name to “Segoe UI” it will break more the height of the image.

My code is:

        Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
        Aspose.Cells.WorksheetCollection worksheets = workbook.Worksheets;
        Aspose.Cells.Worksheet worksheet = worksheets.Add("My Worksheet");
        Aspose.Cells.Style workbookStyle = workbook.DefaultStyle;

        worksheet.Pictures.Add(0, 0, "sample.jpg");

        AutoFitterOptions options = new AutoFitterOptions();
        options.OnlyAuto = true;
        worksheet.AutoFitRows(options);

        workbook.Save("newWorksheet.xls");
//-------------------------------------------------------------------//
        workbook = new Aspose.Cells.Workbook();
        worksheets = workbook.Worksheets;
        worksheet = worksheets.Add("My Worksheet");

        workbookStyle = workbook.DefaultStyle;

        workbookStyle.Font.Size = 6;
        workbookStyle.Font.Name = "Calibri";
        workbook.DefaultStyle = workbookStyle;

        worksheet.Pictures.Add(0, 0, "sample.jpg");
        
        worksheet.AutoFitRows(options);

        workbook.Save("newWorksheetBrokenHeightCalibri.xls");
//-------------------------------------------------------------------//
        workbook = new Aspose.Cells.Workbook();
        worksheets = workbook.Worksheets;
        worksheet = worksheets.Add("My Worksheet");

        workbookStyle = workbook.DefaultStyle;
        
        workbookStyle.Font.Size = 6;
        workbookStyle.Font.Name = "Segoe UI";
        workbook.DefaultStyle = workbookStyle;

        worksheet.Pictures.Add(0, 0, "sample.jpg");
        
        worksheet.AutoFitRows(options);

        workbook.Save("newWorksheetBrokenHeightSegoe.xls");

Can we handle it?

Thanks!

sample.jpg (9.8 KB)

@Dmytro_Katolyk,

Please notice, I am able to reproduce the issue as you mentioned by using your sample code and image file. I found the picture inserted into an excel document is resized when the default font is changed. I have logged a separate ticket with an id “CELLSNET-48374” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

1 Like

Hello @Amjad_Sahi
I am wondering if you’ve had a chance to look into this issue.

I am looking forward to your reply.
Thanks

@Dmytro_Katolyk,
This issue is under progress and we will let you know once any ETA is available in this regard.

@Dmytro_Katolyk

This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

1 Like

@Dmytro_Katolyk
Please try the latest fix.
Aspose.Cells21.7.4 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells21.7.4 For .Net4.0.Zip (5.6 MB)
Aspose.Cells21.7.4 For .NetStandard20.Zip (5.6 MB)

@simon.zhao
Yes, it works!
Thanks a lot!

@Dmytro_Katolyk,

Good to know that your issue is sorted out by the new fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSNET-48374) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao