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

Column widths - Auto width

Thread ID:

Created:

Updated:

Platform:

Replies:

83618 Jun 26,2009 06:42 AM UTC Jun 29,2009 08:40 AM UTC WinForms 1
loading
Tags: XlsIO
Michael Dausmann
Asked On June 26, 2009 06:42 AM UTC

Hi

I am using XlsIO to merge together .xls files that have been created in one of more unusual flavours of Excel (See Attached). This is an unsupported format for XlsIO.

My approach was to manually parse the .xls file myself and use a Syncfusion.XlsIO.IWorkbook to build up the merged 'output' document.

This has been reasonably successfull and I have managed to port all of the information and style information except for the column widths. In my 'output' documents, the column widths are different than in the input document.

There is nothing in the source file that explicitly specifies column width however I can see this style element in the input document for 'col'...

col
{mso-width-source:auto;}

It appears to indicate that the column should automatically determine its width based on content and I suspect it is the equivalent of this property I need to set in order for my output document to match the look of the input document.

How would I go about setting an equivalent property in my XlsIO Syncfusion.XlsIO.IWorkbook instance ??

Michael





Sample_public_e7b36704.XLS

Geetha M [Syncfusion]
Replied On June 29, 2009 08:40 AM UTC

Hi Michael,

Thank you for your interest in Syncfusion products.

You can set the column width to be calculated as per the content as mentioned in the code snippet given below.

sheet.UsedRange.AutofitColumns();

or you can manually set the width as below

sheet.SetColumnWidth(1, 8.43);

where '1' refers to the first column in the sheet.

Please try this and let me know if you have any questions.

Regards,
Geetha

CONFIRMATION

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.

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

;