0

I'm writing some code for my NopCommerce webshop, that needs to export an excel sheet.

I'm trying to edit the width of the columns, so the text will fit in. I already tried the following code(for 26 columns):

//adjust excel column width
for (int i = 0; i < 26; i++)
{
    worksheet.Column(i, 1).Width = 45;
}

The code executes and the Width of the columns is 45, so you could say it works. But it gives me the following error at start up:

xlsx error

How can I get rid of this error?

Thanks in advance!

Max
  • 12,622
  • 16
  • 73
  • 101

1 Answers1

0

have you tried worksheet.Column(i).Width = 45; ?

Jeff Brady
  • 1,454
  • 7
  • 35
  • 56