autofitcolumn issue

Technical support for Spire.XLS

Moderators: iceblue support, Flash, Manager

autofitcolumn issue

Postby lsong » Tue Aug 22, 2017 9:33 pm

Hi,
I am working on a project which needs to auto fit all of the columns in all rows except first 3 rows. Do you know how to do it?


Thanks,
Lucy
lsong
 
Posts: 24
Joined: Wed Feb 01, 2017 4:13 pm

Re: autofitcolumn issue

Postby Jane.Bai » Wed Aug 23, 2017 3:17 am

Hello lsong,

Thanks for your inquiry.
Please kindly note the "autofit column" take a clolum as a whole, it is impossible to only set the "autofit columns" for certain rows. Even you choose a range, the columns in the first three rows will also be auto fitted following the changes by the columns in other rows.
If there's still any doubt, welcome to write back.

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 345
Joined: Tue Nov 29, 2016 1:47 am

Re: autofitcolumn issue

Postby lsong » Wed Aug 23, 2017 7:35 pm

Could you please send me a code example of how to set autofitcolumn on a worksheet starting with the second column? In my case, I just wanted to skip the first column and autofit with the second column and on.

Thanks,
Lucy
lsong
 
Posts: 24
Joined: Wed Feb 01, 2017 4:13 pm

Re: autofitcolumn issue

Postby Jane.Bai » Thu Aug 24, 2017 1:26 am

Hello Lucy,

Please use the code below.
Code: Select all
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(inputfile);
            Worksheet sheet = workbook.Worksheets[0];
           
            //autofitcloumn from the second column
            var destRange = sheet.Range[sheet.FirstRow, 2, sheet.LastRow, sheet.LastColumn];
            destRange.AutoFitColumns();


Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 345
Joined: Tue Nov 29, 2016 1:47 am

Re: autofitcolumn issue

Postby Jane.Bai » Wed Aug 30, 2017 8:30 am

Hi Lucy,

How is the issue now?
Could you please give us some feedback at your convenience?

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 345
Joined: Tue Nov 29, 2016 1:47 am


Return to Spire.XLS

Who is online

Users browsing this forum: No registered users and 1 guest

cron