Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Thu Sep 29, 2016 7:12 pm

I am adding text to a cell that will go beyond the width of the cell. I have added WrapText = true to the cell. However, the row does not grow in size to accommodate all the text. How do I fix this?

I have attached the template xltx file I am using.

Here is the code.

Workbook oWorkbook = new Workbook();
oWorkbook.LoadFromFile("C:\\Users\\a05998\\Documents\\Visual Studio Projects\\ScreenShots\\SpireXLS\\bin\\Debug\\template1.xltx");
Worksheet oWorkSheet = oWorkbook.Worksheets[0];

CellRange oRange = oWorkSheet.FindString("#SpecialInstruction", false, false);
oRange.Style.WrapText = true;


oRange.Text = "Special instruction number one. Special instruction number two. Special instruction number three. Special instruction number four. Special instruction number five.";
Attachments
template1.zip
(7.41 KiB) Downloaded 290 times

druchti
 
Posts: 8
Joined: Tue Aug 02, 2016 12:47 pm

Fri Sep 30, 2016 6:04 am

Hi,

Well, the behavior is the same as MS Excel, if there are some merged cells in the worksheet with wrapping text on, you cannot auto-fit the row operation on those cells. You can check this behavior in MS Excel manually doing the steps. Spire.Xls follows MS Excel standards.
For your requirement, you should set the height.
Code: Select all
oRange.RowHeight = 100;


Sincerely,
Alan
E-iceblue support team
User avatar

Alan.Li
 
Posts: 35
Joined: Mon Sep 05, 2016 2:51 am

Return to Spire.XLS

cron