I'm having a bit of trouble on solving this. Is there a way to set the width of a specific cell from a worksheet using epplus? Because when i use, for example:
ws.Column(1).Width = 40;
the whole column gets affected.
Thanks in advance!
To change the width of columns to fit the contents, select the column or columns that you want to change, and then double-click the boundary to the right of a selected column heading. To change the width of all columns on the worksheet, click the Select All button, and then drag the boundary of any column heading.
Method 2: Manually resize the columnDrag the boundary on the right side of the column heading until the column is the width you want. Format menu and click Width. Type a smaller number and click OK. On the File menu, click Print Preview to preview the page.
Click and drag the column to the right to increase column width or to the left to decrease column width.
As I know, there is no way to change the width of a specific cell. All cells in one column have same width. You can change the width of a cell by merging it with its neighbour. I have an example:
sheet.Cells["A1"].Value = "This is a cell";
sheet.Cells["A1:A2"].Merge = true;
Then you can set width by using
sheet.Column(1).Width = 40;
or
sheet.Cells["A1:A2"].AutoFitColumns();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With