Set column width with pixel

Hi,
I set column width to 100px, the result give me 112px, is there a way to set width exactly I want?

code:

   _excelFile = new FileInfo(tempFilePath);
            _excelpackge = new ExcelFile();
            _worksheet = _excelpackge.Worksheets.Add("report");
            double excelPosition = 0;
            var columnIndex = 1;
            _worksheet.ViewOptions.ShowGridLines = false;
            _worksheet.Columns[0].SetWidth(100, LengthUnit.Pixel);
            _worksheet.Columns[1].SetWidth(200, LengthUnit.Pixel);
            _worksheet.Columns[2].SetWidth(500, LengthUnit.Pixel);

How are you checking the values in Excel? When I test your code I get the correct result. Here is the screenshot:

image


my result is different, version is office 2016

Unfortunately this is not related to the Excel version (mine is 2019) but to the default font. Excel uses a font width related formula for calculating internal width values. GemBox.Spreadsheet doesn’t support that but has this font related value fixed internally. Only thing I can suggest is to try and adjust the input value so it matches the desired width.

OK, that make sense, My real work set width to 72 when I set to 100, will try to correct that