Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 600 Bytes

File metadata and controls

23 lines (14 loc) · 600 Bytes

Transpose Ranges

We start with the basic table:

BasicTable.jpg

var workbook = new XLWorkbook("BasicTable.xlsx");
var ws = workbook.Worksheet(1);

var rngTable = ws.Range("B2:F6");

rngTable.Transpose(XLTransposeOptions.MoveCells);

ws.Columns().AdjustToContents();

workbook.SaveAs("TransposeRanges.xlsx");

And we end up with the following table:
Note: Notice how the Transpose function correctly preserves the formats.

TransposeRanges.jpg