Setting IsTextWrapped to Cells


I’m trying to so something I would have thought would have been very easy. I have worksheet and within that worksheet I want to select some cells and set the IsTextWrapped value to true.

I’ve tried this but it errors:

Range range = myWorkSheet_all.Cells.CreateRange(1, 65535, 1, 20);

Aspose.Cells.Style stl;

stl = workbook.Styles[workbook.Styles.Add()];

stl.IsTextWrapped = true;

StyleFlag flg = new StyleFlag();

range.ApplyStyle(stl, flg);

Any further suggestions greatly appreciated.


Thanks for your posting and using Aspose.Cells for .NET.

Your code seems to be correct. Please download and try the latest version Aspose.Cells
for .NET v7.5.1.1
and see if it works fine.

Your issue might also occur because of large range object. Please try to create your workbook object using the following code.


Workbook workbook = new Workbook(FileFormatType.Xlsx);


Thanks for the reply. I've added to code but now my code is erroring with this line:

workbook.Save(this.Response, "Test.xlsx", ContentDisposition.Inline, new XlsSaveOptions());

Error 2 The name 'ContentDisposition' does not exist in the current context

Any ideas?


Thanks for your posting and using Aspose.Cells for .NET.

Are you using Client Profile .NET Framework? If that is the case, there is a separate dll. Please download it from major version link: Aspose.Cells for .NET 7.5.1

If you are using Client Profile .NET framework, please use the dll inside net3.5_ClientProfile directory.

If you are using Regular .NET Framework, please use the dll inside net2.0 directory.