locked
Passing Fixed Width in Excel File using C# RRS feed

  • Question

  • User356841293 posted

    Hi, I need help! :(

    I need to write to an excel file in C# but i have to pass a fixed width for each column.

    For Example: 

    Name Length = 30

    Address  Length = 50

    Sex = 1

    In my Excel File, it should look like this:

    Column A                         Column B                                            Column C 

    Jason Anderson                123 Example St.                                   M

    Ann Roberts                     456 Sample St.                                     F

    Thanks!

    Friday, January 6, 2012 3:11 AM

All replies

  • User1508394307 posted

    You can do it using NPOI library.

    sheet1.SetColumnWidth(0, 3000);
    sheet1.SetColumnWidth(1, 5000);
    sheet1.SetColumnWidth(2, 100);
    Friday, January 6, 2012 11:57 AM