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

Free Support Forum - aspose.com

Text alignment not working in Excel to PDF conversion


I am doing Pdf export by using a excel template file. Please, see the SampleTemplate.xlsx file which is our template and write text in the excel cell(C6).

I have applied following formatting styles in the excel cell.
1. Align text to the top of the cell
2. Align text to the right
3. Wrap Text

when line break into the second line. The second line text alignment not working as expected in pdf. it's align center but it will be right-aligned.

I use these code to export pdf:

Workbook workbook = new Workbook("D:\\SampleTemplate.xlsx");
CellLocator cellLocator = new CellLocator() { SheetName = "Sheet1", Column = 3, Row = 6 };
Aspose.Cells.Cell cell = workbook.Worksheets["Sheet1"].Cells[5, 2];
workbook.Worksheets["Sheet1"].Cells[5, 2].Value = "Patients treated with brand (%)";
byte[] bytes;
using (MemoryStream fileStream = new MemoryStream())
workbook.Save(fileStream, SaveFormat.Pdf);
bytes = fileStream.ToArray();
string filePath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + @"\saved.pdf";
File.WriteAllBytes(filePath, bytes);

Need help urgently...

Hi Mandy,

Thank you for bringing this issue to our knowledge.

We are able to observe the presented problem while using the latest version of Aspose.Cells for .NET 8.0.0. A ticket (CELLSNET-42502) has been logged in our bug tracking system to further investigate the problem cause, and to provide a fix. Please spare us little time for proper analysis. In the meanwhile, we will keep you posted with updates in this regard.


Thanks for using Aspose.Cells.

Please download and try the fix: Aspose.Cells for .NET and let us know your feedback.

The issues you have found earlier (filed as CELLSNET-42502) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.