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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Not working Autofit

Thread ID:

Created:

Updated:

Platform:

Replies:

94359 May 10,2010 06:00 AM UTC May 11,2010 05:18 AM UTC ASP.NET Web Forms (Classic) 4
loading
Tags: XlsIO
Ichiro Sugimoto
Asked On May 10, 2010 06:00 AM UTC

I'm using Syncfusion Essential Studio 6.4.0.15.

In the attached sample, text of multiple lines is set to IRange.Text Property.

------
var sb = new System.Text.StringBuilder();
sb.Append( string.Format( "row{0}", i ) );
sb.AppendLine();
sb.Append( string.Format( "col{0}", j ) );
var text = sb.ToString();
sheet.Range[i, j].Text = text;
------

And, the data is exporting to a Excel file.
But in the result of Excel file, whole cell is single-line.
I'd like to export remaining line count of whole cell, and whole cells autofitted by row height.

How can I achieve that?

Ichiro Sugimoto
Replied On May 10, 2010 06:10 AM UTC

Sorry, I sent above though not finished writing.
So I send it again.

-----------------------------------------------------

I'm using Syncfusion Essential Studio 6.4.0.15.

In the attached sample, text of multiple lines is set to IRange.Text Property.

------
var sb = new System.Text.StringBuilder();
sb.Append( string.Format( "row{0}", i ) );
sb.AppendLine();
sb.Append( string.Format( "col{0}", j ) );
var text = sb.ToString();
sheet.Range[i, j].Text = text;
------

And after that, autofit all rows and export to Excel file.

------
for ( int i = 0 ; i < RowCount ; i++ ) {
sheet.AutofitRow( i + 1 );
}
for ( int j = 0 ; j < ColCount ; j++ ) {
sheet.AutofitColumn( j + 1 );
}
------

But in the result of Excel file, whole cell is not autofitted by row.
I'd like to export remaining line count of whole cell, and whole cells autofitted by row height.

How can I achieve that?



ExportExcelSample_2fa16470.zip

Lokesh R [Syncfusion]
Replied On May 10, 2010 01:43 PM UTC

Hi Ichiro,

Thank you very much for using Syncfusion products.

I have analyzed your sample posted in your sample. In XlsIO, we have property called "Wrap text" associated with the IRange which helps to fit the text within the cell. I have attached the modified sample with this post and also i have added the code snippet for your reference. Could you please try the sample from the attachment and let us know if this helps you.

[C#]Code Snippet:

sheet.Range[i, j].WrapText = true;

Please, let us know if you need any clarifications.

Thanks,
Lokesh.





ExportExcelSample_6f87c253.zip

Ichiro Sugimoto
Replied On May 11, 2010 02:37 AM UTC

Hi Lokesh,

I didn't know WrapText property of IRange interface.
I tried your sample, and got the result what I desired.

Thanks,
Ichiro.

Lokesh R [Syncfusion]
Replied On May 11, 2010 05:18 AM UTC

Hi Ichiro,

Thank you very much for the update.

Regards,
Lokesh.

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

;