Column width

I imported an excel spreadsheet into aspose.grid. When I double click the column header in the web page, the width of the column resizes itself. Can I do this programmatically so that the width sets itself to the maximum when it shows up?

Here is an example:

If a column has the following rows:

A

AA

AAA

AAA

AAAAA

AAAAAAA

I need to double click the column header to see the last row in its entirety.

Thanks.

Hi,

Thanks for considering Aspose.

We will support this feature(programatically autofitting columns) soon.

I think, currently, you may try to adjust columns widht using WebCells.SetColumnWidth() method.

E.g.,

...........

cells.SetColumnWidth(0, new Unit("130pt"));

Thank you.

Hi,

Now there is a client side function you may use to autofit a column. Please refer to this thread:

<A href="https://forum.aspose.com/t/98748</A></P>

Thank you very much for your quick response. It works. Thanks again.

Another question:

I cannot set the showDefaultGridLine property of GridWeb1 to false. I tried setting it to false in the worksheet designer. I also called GridWeb1.showDefaultGridLine = false. Nothing works.

The properties page of GridWeb1 doesn't take 'false'. It defaults to true.

Thanks.

Hi,

Well, it works fine. Where you are implementing it on client side, kindly set it on the server side

E.g., in the page_load event:

private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{

GridWeb1.ShowDefaultGridLine = false;

}
}

Thank you.

Hi,

I'm not sure whether you tried the option that I'm talking about. Select the GridWeb control. Right click on it and bring up the properties window. When you try to change the ShowDefaultGridLine property from true to false, it doesn't change. I tried setting it as you suggested and set the property in the worksheets designer. But nothing helps. The Grid line still shows up. Am I doing something wrong in here?

Thanks.

Hi,

Well, it looks strange as it works fine for me. Did you try my suggested code if it works fine for you.

Could you give some more details about your environment i.e. Aspose.Grid.Web version, OS, .NET framework, IIS Settings, BrowserType, other extensions etc. We will check it soon.

Thank you.

Hi,

If you you are using .NET 2.0, you may disable the XHTML mode manually. Remove the line from the aspx file, and set the GridWeb.XhtmlMode to false. I think that will solve your problem.

Thank you for considering Aspose.

Thank you very much. Problem solved.