0

I want to fit column according to header width not the properties width.Ie Header size should be the column width )

i am using sheet.AutoFitColumns(); which fits according to the max length of cell.

ie pic1

I want to have sheet like this.(Header size should be the column width ie 3b 3c)

pic2

Thank you in advance.

1 Answer 1

2

That AutFitColumns method has an overload that allows to specify the range upon which to apply the autofit.

public void AutoFitColumns(int firstRow, int firstColumn, int lastRow, int lastColumn)

For your scenario that might be below one (indexes are 0-based) - you might need to adjust.

sheet.AutoFitColumns(2, 1, 2, 2);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.