The following code correctly sets the “Wrap” property to true but the VerticalAlignment of the cell (when the saved spreadsheet has been opened) is “Center” rather than “Top”:
Hi,
Amjad Sahi:
Hi,I think you may simply use first overloaded version of the method:itemsSheet.Cells[i].SetStyle(cellStyle);instead of:itemsSheet.Cells[i].SetStyle(cellStyle, true);it works fine for your requirement.Thank you.
Hi,
The issues you have found earlier (filed as 30651) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
Seems like the overload version does not work for the latest version of the Aspose.Cells DLL 7.3.2.0
wsheet.Cells[0, 0].SetStyle(Style.Font.IsBold, true);
This line of code gives an error, eventhoug I am using the latest version of Aspose.Cells.
Hi,
Thanks for your posting and using Aspose.Cells for .NET.
Please download and try the latest version:
Aspose.Cells
for .NET v7.3.2.3
Please see the following code that illustrates how to use the Cell.SetStyle(Style style, bool explicitFlag) method for your needs.
I have also attached the source and output xlsx files generated by the code and screenshot for your reference.
C#
string filePath = @“F:\Shak-Data-RW\Downloads\source.xlsx”;
Workbook workbook = new Workbook(filePath);
Worksheet worksheet = workbook.Worksheets[0];
Cell cell = worksheet.Cells[“A1”];
Style style = workbook.CreateStyle();
style.Font.IsBold = true;
cell.SetStyle(style, true);
workbook.Save(filePath + “.out.xlsx”, SaveFormat.Xlsx);
Screenshot: