We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Change column witdth to the heading(first row) width, the heading should be fully visible

Thread ID:





123961 May 3,2016 02:39 PM UTC May 4,2016 05:05 AM UTC ASP.NET MVC 1
Tags: XlsIO
Asked On May 3, 2016 02:39 PM UTC

I have this code:

            List<wert> tempWerte = ...;

            #region Tabelle füllen

            int columnCounter = 1;

            foreach (wert item in tempWerte)
                //for (int i = 0; i < item.Werte.Length; i++)
                worksheet.ImportArray(item.Werte, 1, columnCounter, true);


            #region Formatierung

            int startRow = 1;
            int startColumn = 1;

            IRange usedRange = worksheet.UsedRange;
            for (int i = startColumn; i <= usedRange.LastColumn; i++)
                usedRange[startRow, i].CellStyle.Font.Bold = true;
                usedRange[startRow, i].BorderAround(LineStyle.Thin);

            usedRange.CellStyle.Font.FontName = "verdana";
            usedRange.CellStyle.Font.Size = 10;

Dilli Babu Nandha Gopal [Syncfusion]
Replied On May 4, 2016 05:05 AM UTC

Hi Testname  

Thank you for contacting Syncfusion support.  

Yes, you can auto-fit the column width by using IRange.AutofitColumns method. The code example illustrating this behavior is available in the following UG documentation link.  

We have also shared a sample illustrating this behavior for your reference which can be downloaded from the following link.  

Please let us know if you have any concerns.  

Dilli babu. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon