Free Support Forum -

Problem with workSheet.Cells.GetColumnWidthPixel method


I am using Aspose.Cell 7.3.2 and having issue with workSheet.Cells.GetColumnWidthPixel method. The issue is that this method retuning higher value compare to Aspose.Cell 6.0.0 with the same excel file and that’s causing problem with the word table I am creating from the excel table using Aspose.Word in my application. Since I am using Aspose.Word in my application as well before I was thinking this is Aspose.Word issue so I posted this table issue here in Aspose.Word section but I narrow down the issue and it’s happening because of this workSheet.Cells.GetColumnWidthPixel method which is retuning different value.

Try this sample code with attached excel file with 6.0.0 and 7.3.2 Aspose.Cells versions :

const string excelFile = @“C:\Users\meetp\Desktop\NewProspectiveUnlockingTable.xlsx”;

var wb = new Workbook(excelFile);
var displaySheet = wb.Worksheets[“Display”];
var cell= displaySheet.Cells[“M5”];
var columnWidth = displaySheet.Cells.GetColumnWidthPixel(12);

you will notice that column width is different with both versions.

I am more looking for temporary solution of this issue for now since we can’t change aspose version in our application near soon.



I have tested your case with our latest version / fix, i.e., v7.3.5.x, it works fine. I can see MS Excel does show the column width (in pixels) equal to 12 (see the screen shot attached here). Aspose.Cells for .NET v7.3.5.x also gives 12 for it, so it works the same as MS Excel.

So, we recommend you to kindly download and try our latest fix/version: e.g Aspose.Cells for .NET v7.3.5.2 it works absolutely fine as per MS Excel does. Moreover, I am afraid, we cannot help you much to resolve the issue (if it is there in that version) if you still want to stick with older version(s).

Thanks for your understanding!

Ok. But why it’s (v7.3.5.x) returning different value than 6.0.0?

In v7.3.5.x it’s returning 12 and in 6.0.0 it’s returning 10. Try with Aspose.Cells 6.0.0 and you will see. I need to know what has been changed to fix my issue.

Any idea?

Thanks - Meet


Well, I am not sure why your older version i.e. v6.0.0 gives you 10 instead of 12. I suspect it might be an issue with your older version v6.0.0. You may confirm in MS Excel (as per my screen shot in my previous post) that the correct column width (in pixels) is 12 and not 10. So, our latest versions e.g v7.3.5.x works the same way as MS Excel.

Thank you.