This project has moved and is read-only. For the latest updates, please go here.

copying font from one cell to another doesn't function


I want to copy the style from one cell to another.

My code:
_ws.Cells[rowTarget, icol].Style.Font = _ws.Cells[rowSource, icol].Style.Font;
_ws.Cells[rowTarget, icol].Style.Fill = _ws.Cells[rowSource, icol].Style.Fill;
_ws.Cells[rowTarget, icol].Style.Border = _ws.Cells[rowSource, icol].Style.Border;
_ws.Cells[rowTarget, icol].Style.HorizontalAlignment = _ws.Cells[rowSource, icol].Style.HorizontalAlignment;
_ws.Cells[rowTarget, icol].Style.Indent = _ws.Cells[rowSource, icol].Style.Indent;
_ws.Cells[rowTarget, icol].Style.Numberformat = _ws.Cells[rowSource, icol].Style.Numberformat;
_ws.Cells[rowTarget, icol].Style.TextRotation = _ws.Cells[rowSource, icol].Style.TextRotation;
_ws.Cells[rowTarget, icol].Style.VerticalAlignment = _ws.Cells[rowSource, icol].Style.VerticalAlignment;
_ws.Cells[rowTarget, icol].Style.WrapText = _ws.Cells[rowSource, icol].Style.WrapText;

After executing
_ws.Cells[rowTarget, icol].Style.Font = _ws.Cells[rowSource, icol].Style.Font;

I notice that the font hasn't changed.
_ws.Cells[rowSource, icol] has been formatted using Excel. The file is an xlsx file.

I have tried to copy the style using StyleId or StyleName, neither work.