Row Height Problem

I set row height using ExcelWorksheet.DefaultRowHeight = 15 but nothing happend
My Cell have value have rowheight 15
But empty cell have value 12.75

Hi,

First, note that ExcelWorksheet.DefaultRowHeight is in twips (1/20th of a point).
So, try running something like the following:

var workbook = new ExcelFile();
var worksheet = workbook.Worksheets.Add("Sheet1");
worksheet.Cells["A1"].Value = "Sample";

worksheet.DefaultRowHeight = 15 * 20;

workbook.Save("Output.xls");
workbook.Save("Output.xlsx");

Does this reproduce your issue?

If yes, then tell us which version of GemBox.Spreadsheet are you using.
If no, then please send us the snippet code (and perhaps your input file as well) with which we can reproduce your issue.

Regards,
Mario

I am a friend who asked before.
This code:

var workbook = new ExcelFile();
var worksheet = workbook.Worksheets.Add("Sheet1");
worksheet.Cells["A1"].Value = "Sample";

worksheet.DefaultRowHeight = 15 * 20;

workbook.Save("Output.xls");
workbook.Save("Output.xlsx");

didn’t solve our problem. We’ve tried with that code, but the row is still 12.75.
your code not working.

Hi Ade,

I was unable to reproduce your issue, the following screenshot shows the result that I get:

row-height

What version of GemBox.Spreadsheet are you using?
Can you send us a small VS project that reproduces your issue so that we can investigate it?

Regards,
Mario

Hi Mario,

You can download my example project that fail from this link.
https://drive.google.com/file/d/1BQlm4nomAe23xDNbtqBwk12Joa-ytKGX/view?usp=sharing

We use Excel 2007

Hi Ade,

There seems to be some sort of inconsistency in Microsoft Excel.

You see if you set the row’s height to 16:

row-height

row-height-16

And then immediately check what row height value is shown, you’ll notice it’s not the same:

row-height-15-75

So in other words, even though we set the row’s height to 16, it still ends up showing it as 15.75.

Also, if you try to set the row’s height by dragging its edge, you’ll notice that you cannot get it to 16. You can set it either as 15.75 (21 pixels) or as 16.50 (22 pixels).

Currently, I’m not sure why Microsoft Excel behaves like that.
Nevertheless, I hope this information is of use to you.

Regards,
Mario

Hi Mario,

maybe your explanation is correct. But our problem is, when we use this code.

worksheet.DefaultRowHeight = 15 * 20;

There is no result, even if we make the row height 20, the rows will not change at all.

Hi Abe,

The project you previously sent me doesn’t reproduce that.
In your code you have this:

worksheet.DefaultRowHeight = 16 * 20

And that results in an Excel file with 15.75 or 16 (depending on where you’re looking in Microsoft Excel).

Can you send us another project that reproduces your exact issue?

Also, can you send us the Excel file that you get as a result when running that project?
I’ll compare your output file with mine.

Regards,
Mario

H Mario,

We have set the row to 28, why when in Excel export the row height is still 15 for rows containing, and 12.75 for empty rows?

worksheet.DefaultRowHeight = 28 * 20

Hi Ade,

I was finally able to figure out your issue.
The problem is that you’re saving to XLS (not XLSX) with an older version of GemBox.Spreadsheet.

Try downloading the current latest version from the BugFixes page.
Does this solve your issue?

Regards,
Mario

Hi Mario,

You are very helpful, our problem has been resolved. Thank you