NPOI icon indicating copy to clipboard operation
NPOI copied to clipboard

Column Width setting is not working

Open praspratik opened this issue 5 years ago • 3 comments

Hi,

I have created a work book and work sheet and wanted to adjust the column width. I tried both Auto size and setting column width. But both approaches does not seem to work. Is there a issue with the code. Below is the code sample how i am trying to achieve this functionality.

IWorkbook sw = new XSSFWorkbook(); ISheet sheet = sw.CreateSheet("Missing Adress Records");

sheet.AutoSizeColumn(0); -- Does not auto size the columns or sheet.SetColumnWidth(0, 200) -- Column is minimized, meaning it is reduced to zero size.

let me know is there some thing else i need to add to the code.

praspratik avatar Aug 06 '18 23:08 praspratik

Is your content in work sheet are English characters?

yang-xiaodong avatar Aug 07 '18 01:08 yang-xiaodong

Yes

On Mon, Aug 6, 2018, 6:00 PM Savorboard [email protected] wrote:

Is your content in work sheet are English characters?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dotnetcore/NPOI/issues/74#issuecomment-410898893, or mute the thread https://github.com/notifications/unsubscribe-auth/AoGRQG7YDTY5j13pKuHvILeyfanqHTSoks5uOOaygaJpZM4VxRKG .

praspratik avatar Aug 07 '18 01:08 praspratik

@praspratik SetColumnWidth expects a value divisible by 256 due to scaling, so you probably want to pass 51200 instead to get the result you want.

gtbuchanan avatar Oct 10 '18 19:10 gtbuchanan