We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Text alignment is incorrect after "ApplyStyle"


There’s a problem with the “ApplyStyle” function. As you can see in the attached example, after using this function, text alignments becomes invalid. You can compare “Input.xlsx” with “Output.xlsx” to see this.

Hi Andrea,

Thanks for your posting and using Aspose.Cells.

We have tested your issue with the following code using the latest version: Aspose.Cells for .NET 8.3.0 and did not notice any issue.

I have attached the output Excel file for your reference. If you still find any issue, then please highlight it in a screenshot with red circles around the problematic area.


string filePath = @“F:\Shak-Data-RW\Downloads\Test_Hebrew_Alignment\Test_Hebrew_Alignment\Input.xlsx”;

//Open a workbook with hebrew alignments

LoadOptions Opt = new LoadOptions(LoadFormat.Xlsx);

Workbook TableToCopyWbk = new Workbook(filePath, Opt);

Worksheet TableToCopyWsh = TableToCopyWbk.Worksheets[0];

//Create a new cell style

Style NewStyle = new Style();

//Set WrapText

NewStyle.IsTextWrapped = true;

//Set Flag

StyleFlag NewFlag = new StyleFlag();

NewFlag.WrapText = true;

//Apply style

TableToCopyWsh.Cells.ApplyStyle(NewStyle, NewFlag);

//Save the workbook

TableToCopyWbk.Save(filePath + “.out.xlsx”, SaveFormat.Xlsx);


Maybe I was not clear enough…

I have highlight the problem in the screenshot I’ve sent.

The problem is that in the output file (I’ve use the files you have sent to me) text is align to left.

It’s not correct.

Hi Andrea,

Thank you for sharing the snapshot for better elaboration of your presented scenario.

We have further evaluated your presented scenario while using the latest version of Aspose.Cells for .NET 8.3.0, and are able to replicate the problem of text alignment change after applying the text wrapping effect on the worksheet cells. The problem has been logged in our bug tracking system under the ticket CELLSNET-43166 for further investigation. Please spare us little time to properly analyze the problem cause, and to provide the fix at earliest possible. In the meanwhile, we will keep you posted with updates in this regard.

Hi Andrea,

Thanks for your posting and using Aspose.Cells.

We have looked into this issue further and found it is not a bug of Aspose.Cells but a correct behavior.

If you wrap the text in MS Excel, the text is aligned left too. Aspose.Cells
works as MS Excel.


I’ve done some tests using Excel 2013. I’ve sent you an Excel workbook in which I have set some cells with wrap text and “Sheet Right-to-Left” property to true. I’m not able to replicate the behavior you told me.

Maybe you refers to this problem: http://support.microsoft.com/kb/293467. But this is only an Excel 2003 and 2007 problem, as Microsoft says…

Hi Andrea,

Thanks for your posting and using Aspose.Cells.

Please try the same thing with your Input.xlsx in Excel 2013 and you will see alignment gets changed when wrap text is clicked.

Let us know your feedback.


Thank you, I finally figured out!

Many regards!

Hi Andrea,

Thanks for your feedback and using Aspose.Cells.

It is good to know that you found the root cause of this issue. Let us know if you encounter any other issue, we will be glad to look into it and help you further.